---
id: linux-administration-network-configuration-and-management
slug: linux-administration-network-configuration-and-management
title: "Linux Administration #4: Network Configuration and Management"
excerpt: "Learn the fundamentals of Linux network configuration: From the physical network layer and DNS configuration to firewall settings and network monitoring."
date: "2024-11-01T09:00:00+01:00"
updated: "2024-11-01T10:00:00+01:00"
author:
  name: "Sebastian Palencsar"
  handle: "AdminDocs"
category: "linux-administration"
tags: ["networking", "ip", "dns", "dhcp", "ssh", "firewall", "network-manager", "linux-administration"]
toc: true
reading_time: 45
---

**Welcome to the fourth part of our technical wiki series on Linux administration!**

After we covered the [fundamentals of system administration](/en/linux-administration/linux-administration-fundamentals-of-linux-administration){.badge-link-text}, [user management](/en/linux-administration/linux-administration-advanced-user-management){.badge-link-text}, and [process management](/en/linux-administration/linux-administration-processes-and-resource-management){.badge-link-text} in previous articles, we now turn to network configuration and management.

As a Linux administrator, it is important to understand how networks work and how you configure them. Think of a network like a postal system: Every computer has its own IP address, and the network configuration determines how packets are exchanged between computers.

<blockquote class="infobox infobox--warn">
⚠️ **Note:** In this article, we use Ubuntu/Debian as the example distribution. The basic concepts are the same on all Linux systems, but package installation and some configuration paths may vary depending on the distribution. If you use a different distribution, please consult the relevant documentation for the specific installation commands and paths.
</blockquote>

### What is a Network?

A network connects computers and enables data exchange. In Linux, there are various tools and concepts to help you with network management.

**Network fundamentals:**

```markdown
┌─────────── Physical Layer ──────────────────────────────────┐
│  • Network interfaces                                        │
│  • Cables and connections                                    │
│  • Hardware addresses (MAC)                                  │
├─────────── Logical Layer ───────────────────────────────────┤
│  • IP addresses                                              │
│  • Routing                                                   │
│  • DNS and name resolution                                   │
└─────────────────────────────────────────────────────────────┘
```

## Understanding Network Fundamentals

In Linux systems, the network is divided into different layers. Let's examine these layers in detail:

### Physical Layer

**Physical network components:**

```markdown
┌─────────── Hardware ────────────────────────────────────────┐
│  • Network interfaces (eth0, wlan0)                          │
│  • Cable connections                                         │
│  • MAC addresses                                             │
├─────────── Management ──────────────────────────────────────┤
│  • Drivers and modules                                       │
│  • Speed/duplex                                              │
│  • Connection status                                         │
└─────────────────────────────────────────────────────────────┘
```

```bash
# Display network interfaces
ip link show

# or traditional
ifconfig -a

# Check MAC address and status
ip link show eth0

# Shows:
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP>
	 link/ether 00:11:22:33:44:55
```

### Logical Layer

**Logical network configuration:**

```markdown
┌─────────── Addressing ──────────────────────────────────────┐
│  • IP addresses (IPv4/IPv6)                                  │
│  • Subnet masks                                              │
│  • Gateway configuration                                     │
├─────────── Name Resolution ─────────────────────────────────┤
│  • DNS servers                                               │
│  • Hostname                                                  │
│  • /etc/hosts                                                │
└─────────────────────────────────────────────────────────────┘
```

### Understanding the Logical Network Layer

<span class="nb-accent">IP Addressing</span>

An IP address is like a postal address for your computer. In IPv4, it consists of four numbers between 0 and 255:

**IP addressing:**

```markdown
┌─────────── IPv4 ────────────────────────────────────────────┐
│  • Format: xxx.xxx.xxx.xxx                                  │
│  • Example: 192.168.1.100                                   │
│  • Subnet mask: 255.255.255.0                               │
├─────────── Ranges ──────────────────────────────────────────┤
│  • Private: 192.168.0.0/16                                   │
│  • Private: 10.0.0.0/8                                       │
│  • Private: 172.16.0.0/12                                    │
└─────────────────────────────────────────────────────────────┘
```

**The IP address is divided into network and host parts:**

* `192.168.1.0` is the network
* `.100` is the host in this network
* The subnet mask `255.255.255.0` separates these areas

<span class="nb-accent">DNS (Domain Name System)</span>

DNS translates domain names into IP addresses, similar to how a telephone directory translates names into numbers:

**DNS resolution:**

```markdown
┌─────────── Process ─────────────────────────────────────────┐
│  1. Request: www.example.com                                │
│  2. Query DNS server                                         │
│  3. Receive IP: 93.184.216.34                               │
├─────────── Configuration ───────────────────────────────────┤
│  • /etc/hosts for local names                                │
│  • /etc/resolv.conf for DNS                                  │
│  • NetworkManager settings                                   │
└─────────────────────────────────────────────────────────────┘
```

### DNS Resolution in Detail

DNS resolution in Linux follows a specific process, similar to a telephone directory that searches through various directories sequentially.

<span class="nb-accent">DNS Resolution Process</span>

**DNS resolution process:**

```markdown
┌─────────── Client Request ──────────────────────────────────┐
│  1. Browser requests www.example.com                         │
│  2. System checks local DNS cache                            │
│  3. System checks /etc/hosts                                 │
├─────────── DNS Server ──────────────────────────────────────┤
│  4. Request to configured DNS                                │
│  5. DNS queries root server                                  │
│  6. DNS queries TLD server (.com)                            │
│  7. DNS queries authoritative server                         │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">DNS Configuration in Linux</span>

DNS configuration is mainly done via two files:

```bash
# 1. /etc/resolv.conf - DNS server configuration
nameserver 8.8.8.8          # Google DNS

nameserver 8.8.4.4          # Google DNS backup

search example.com          # Local domain search

domain example.com          # Local domain
# 2. /etc/hosts - Local DNS entries
127.0.0.1 localhost
192.168.1.10 server1.local server1
```

<span class="nb-accent">DNS Query Tools</span>

**DNS tools overview:**

```markdown
┌─────────── dig ─────────────────────────────────────────────┐
│  • Detailed DNS queries                                      │
│  • Various record types                                      │
│  • Query specific nameservers                                │
├─────────── nslookup ────────────────────────────────────────┤
│  • Simple DNS queries                                        │
│  • Interactive mode                                          │
│  • Reverse lookups                                           │
├─────────── host ────────────────────────────────────────────┤
│  • Quick, simple queries                                     │
│  • IP to name and vice versa                                 │
│  • Basic DNS information                                     │
└─────────────────────────────────────────────────────────────┘
```

```bash
# Example with dig
dig example.com

# Shows A record (IPv4)
# Example with nslookup
nslookup example.com

# Shows name and IP
# Example with host
host example.com

# Shows simplified DNS information
```

<span class="nb-accent">DNS Troubleshooting in Practice</span>

**DNS troubleshooting tools:**

```markdown
┌─────────── Diagnosis ───────────────────────────────────────┐
│  • ping (reachability)                                       │
│  • dig (DNS queries)                                         │
│  • nslookup (name resolution)                                │
├─────────── Logs ────────────────────────────────────────────┤
│  • /var/log/syslog                                           │
│  • /var/log/messages                                         │
│  • dmesg                                                     │
└─────────────────────────────────────────────────────────────┘
```

```bash
# 1. Check basic connectivity
ping 8.8.8.8
ping google.com

# 2. Test DNS resolution
dig google.com
nslookup google.com

# 3. Check DNS server
cat /etc/resolv.conf
```

<span class="nb-accent">Understanding Routing</span>

Routing in Linux determines how network packets find their way through the network. Think of routing like a navigation system:

**Routing concepts:**

```markdown
┌─────────── Default Route ───────────────────────────────────┐
│  • Default Gateway                                           │
│  • Path to the Internet                                      │
│  • Fallback for unknown destinations                         │
├─────────── Static Routes ───────────────────────────────────┤
│  • Manually configured paths                                 │
│  • Direct connections                                        │
│  • Specific networks                                         │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Understanding the Routing Table</span>

```bash
# Display routing table
ip route show

# or traditional
route -n
```

**Example output:**

* default via 192.168.1.1 dev eth0
* 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100

<span class="nb-accent">Configuring Routes</span>

```bash
# Set default gateway
ip route add default via 192.168.1.1

# Add specific route
ip route add 10.0.0.0/24 via 192.168.1.254

# Delete route
ip route del 10.0.0.0/24
```

## Network Configuration

After the fundamentals, we now turn to the practical configuration of your network. In Linux, there are various tools and methods for making network settings:

**Network configuration:**

```markdown
┌─────────── Interfaces ──────────────────────────────────────┐
│  • Assign IP addresses                                       │
│  • Set subnet masks                                          │
│  • Configure gateway                                         │
├─────────── DNS ─────────────────────────────────────────────┤
│  • Set nameservers                                           │
│  • Configure hostname                                        │
│  • Define domains                                            │
└─────────────────────────────────────────────────────────────┘
```

### Interface Configuration

<span class="nb-accent">Assign IP address</span>

* sudo ip addr add 192.168.1.100/24 dev eth0

<span class="nb-accent">Set gateway</span>

```bash
sudo ip route add default via 192.168.1.1

# Check changes
ip addr show eth0
ip route show
```

### Configuring DNS Servers

DNS configuration is mainly done via three important files:

**DNS configuration files:**

```markdown
┌─────────── /etc/resolv.conf ────────────────────────────────┐
│  • DNS server addresses                                      │
│  • Search domains                                            │
│  • DNS options                                               │
├─────────── /etc/hosts ──────────────────────────────────────┤
│  • Local DNS entries                                         │
│  • Hostname-IP mappings                                      │
│  • Static entries                                            │
├─────────── /etc/nsswitch.conf ──────────────────────────────┤
│  • Name resolution order                                     │
│  • DNS priorities                                            │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Configure DNS servers in `/etc/resolv.conf`</span>

```bash
nameserver 8.8.8.8          # Google DNS (primary)

nameserver 8.8.4.4          # Google DNS (secondary)

nameserver 192.168.1.1      # Router/local DNS

search local.domain         # Local search domain

domain local.domain         # Default domain
```

<span class="nb-accent">Define local hosts in `/etc/hosts`</span>

* 127.0.0.1       localhost
* 192.168.1.10    server1.local server1
* 192.168.1.11    server2.local server2

<span class="nb-accent">DNS resolution order in `/etc/nsswitch.conf`</span>

* hosts: files dns

## Network Security

Securing your network is an important task in Linux administration. Here we learn the fundamental security concepts:

**Network security:**

```markdown
┌─────────── Firewall ────────────────────────────────────────┐
│  • Open/close ports                                          │
│  • Define rules                                              │
│  • Access control                                            │
├─────────── SSH ─────────────────────────────────────────────┤
│  • Secure connections                                        │
│  • Key management                                            │
│  • Access restrictions                                       │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Firewall Configuration</span>

The Linux firewall (`iptables/nftables`) is your first line of defense against unwanted network access. Let's understand how it works:

**Firewall fundamentals:**

```markdown
┌─────────── Inbound ─────────────────────────────────────────┐
│  • Connections from outside                                  │
│  • Port access                                               │
│  • Service requests                                          │
├─────────── Outbound ────────────────────────────────────────┤
│  • Connections to outside                                    │
│  • Updates & downloads                                       │
│  • Service responses                                         │
└─────────────────────────────────────────────────────────────┘
```

### UFW (Uncomplicated Firewall)

```bash
# Enable UFW
sudo ufw enable

# Set default rules
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Open ports
sudo ufw allow 22/tcp        # SSH

sudo ufw allow 80/tcp        # HTTP

sudo ufw allow 443/tcp       # HTTPS
# Check status
sudo ufw status verbose
```

<span class="nb-accent">Advanced Firewall Rules</span>

### UFW (Uncomplicated Firewall)

**Advanced UFW rules:**

```markdown
┌─────────── Port Ranges ─────────────────────────────────────┐
│  • Open/close ports                                          │
│  • Define port ranges                                        │
│  • Set protocols                                             │
├─────────── IP Addresses ────────────────────────────────────┤
│  • Allow/block individual IPs                                │
│  • Manage networks                                           │
│  • Subnet rules                                              │
└─────────────────────────────────────────────────────────────┘
```

```bash
# Define port ranges
sudo ufw allow 3000:4000/tcp   # Port range

sudo ufw allow 80,443/tcp      # Multiple ports
# IP-based rules
sudo ufw allow from 192.168.1.0/24  # Subnet

sudo ufw deny from 10.0.0.5         # Individual IP
```

### IPtables (Classic Firewall)

**IPtables structure:**

```markdown
┌─────────── Chains ──────────────────────────────────────────┐
│  • INPUT (inbound)                                           │
│  • OUTPUT (outbound)                                         │
│  • FORWARD (forwarded)                                       │
├─────────── Actions ─────────────────────────────────────────┤
│  • ACCEPT (allow)                                            │
│  • DROP (discard)                                            │
│  • REJECT (reject)                                           │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Practical Examples for IPtables</span>

IPtables is a powerful tool for firewall configuration. Here are the most important use cases:

**IPtables basic rules:**

```markdown
┌─────────── Inbound ─────────────────────────────────────────┐
│  • SSH (Port 22)                                             │
│  • Web (Port 80/443)                                         │
│  • DNS (Port 53)                                             │
├─────────── Outbound ────────────────────────────────────────┤
│  • Updates and downloads                                     │
│  • DNS requests                                              │
│  • Web access                                                │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Basic Configuration</span>

```bash
# Delete all existing rules
iptables -F

# Set default policies
iptables -P INPUT DROP      # Block everything

iptables -P FORWARD DROP    # No routing

iptables -P OUTPUT ACCEPT   # Allow outbound
# Allow loopback
iptables -A INPUT -i lo -j ACCEPT
```

<span class="nb-accent">Allow Important Services</span>

```bash
# Allow SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

# Allow web server
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT

# Allow existing connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
```

### nftables

nftables is the modern successor to iptables. Here are the most important concepts and configurations:

**nftables structure:**

```markdown
┌─────────── Tables ──────────────────────────────────────────┐
│  • filter (packet filtering)                                 │
│  • nat (address translation)                                 │
│  • mangle (packet modification)                              │
├─────────── Chains ──────────────────────────────────────────┤
│  • input (inbound)                                           │
│  • output (outbound)                                         │
│  • forward (forwarded)                                       │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Basic Configuration</span>

```bash
# Create new table
nft add table inet firewall

# Create base chain
nft add chain inet firewall input { type filter hook input priority 0 \; }
nft add chain inet firewall output { type filter hook output priority 0 \; }

# Set basic rules
nft add rule inet firewall input ct state established,related accept
nft add rule inet firewall input ct state invalid drop
```

<span class="nb-accent">Practical Examples</span>

```bash
# Allow SSH
nft add rule inet firewall input tcp dport 22 accept

# Allow HTTP/HTTPS
nft add rule inet firewall input tcp dport { 80, 443 } accept

# Display rules
nft list ruleset
```

<span class="nb-accent">SSH Security</span>

SSH (Secure Shell) is an important tool for secure remote administration of your system. Let's look at the most important security aspects:

**SSH security:**

```markdown
┌─────────── Authentication ──────────────────────────────────┐
│  • Password vs. keys                                         │
│  • Public/Private key pairs                                  │
│  • SSH-Agent                                                 │
├─────────── Configuration ───────────────────────────────────┤
│  • Change port                                               │
│  • Disable root login                                        │
│  • Protocol version                                          │
└─────────────────────────────────────────────────────────────┘
```

### SSH Configuration in Detail

SSH (Secure Shell) is an important tool for secure remote administration. Let's go through the most important configuration aspects:

**SSH configuration:**

```markdown
┌─────────── Server ──────────────────────────────────────────┐
│  • Port and binding                                          │
│  • Authentication                                            │
│  • Access control                                            │
├─────────── Client ──────────────────────────────────────────┤
│  • Key management                                            │
│  • Connection options                                        │
│  • Known Hosts                                               │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Server Configuration (`/etc/ssh/sshd_config`)</span>

```bash
# Basic security settings
Port 22                      # Standard SSH port

PermitRootLogin no           # Forbid root login

PasswordAuthentication no    # Only allow keys

MaxAuthTries 3               # Maximum login attempts
# Restart service after changes
sudo systemctl restart sshd
```

<span class="nb-accent">Key-based Authentication</span>

```bash
# Create key pair
ssh-keygen -t ed25519 -C "server1"

# Copy public key to server
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server

# Check permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
```

### Advanced SSH Security Settings

Securing your SSH server is crucial for system security. Here are the most important advanced settings:

**SSH security options:**

```markdown
┌─────────── Access Control ──────────────────────────────────┐
│  • Allowed/forbidden users                                   │
│  • IP-based restrictions                                     │
│  • Time-based restrictions                                   │
├─────────── Encryption ──────────────────────────────────────┤
│  • Key algorithms                                            │
│  • Cipher suites                                             │
│  • MAC algorithms                                            │
└─────────────────────────────────────────────────────────────┘
```

<span class="nb-accent">Advanced `sshd_config` Settings</span>

```bash
# /etc/ssh/sshd_config
# Security settings
AllowUsers anna bob            # Only specific users

PermitRootLogin no             # Forbid root login

MaxAuthTries 3                 # Maximum login attempts

LoginGraceTime 30              # Time limit for login
# Encryption options
Ciphers aes256-ctr,aes192-ctr
MACs hmac-sha2-512,hmac-sha2-256
KexAlgorithms curve25519-sha256
```

## Network Monitoring

Monitoring your network is essential for stable operation. Here are the most important tools and concepts.

### Installing Monitoring Tools

```bash
sudo apt install net-tools      # for netstat

sudo apt install iproute2       # for ss

sudo apt install iftop          # for interface monitoring

sudo apt install nethogs        # for process monitoring

sudo apt install iptraf-ng      # for detailed network analysis
```

**Monitoring tools in practice:**

```markdown
┌─────────── Traffic Monitor ─────────────────────────────────┐
│  nethogs: Process-based                                     │
│  iftop:   Interface-based                                   │
│  iptraf:  Detailed statistics                                │
├─────────── Output Examples ─────────────────────────────────┤
│  nethogs:  PID USER PROGRAM KB/s                            │
│  iftop:    SOURCE <-> DEST KB/s                             │
│  iptraf:   PORTS, PROTOCOLS                                 │
└─────────────────────────────────────────────────────────────┘
```

### Traffic Monitoring

```bash
# Process-based monitoring
sudo nethogs eth0

# Interface-based monitoring
sudo iftop -i eth0

# Bandwidth monitoring
nload eth0
```

### Connection Monitoring

```bash
# Display active connections
ss -tuln

# Check open ports
netstat -tulpn

# Processes with network connections
lsof -i
```

### Monitoring Tools in Practice

<span class="nb-accent">Bandwidth Monitoring with nload</span>

```bash
nload eth0

# Shows:
Incoming: ▁▂▃▅█▇ 2.5 MB/s
Outgoing: ▁▁▂▃▂▁ 1.2 MB/s
```

<span class="nb-accent">Process-based Monitoring with nethogs</span>

```bash
sudo nethogs eth0

# Shows:
PID   USER     PROGRAM                    SENT      RECEIVED
1234  anna     firefox                    2.5KB/s   15.4KB/s
5678  bob      wget                       0.1KB/s   350.2KB/s
```

<span class="nb-accent">Interface Statistics with iftop</span>

```bash
sudo iftop -i eth0

# Shows:
Source                    Destination             Transfer
192.168.1.100:443         10.0.0.5:52431          1.2Mb  2.5Mb
```

### Long-term Monitoring

<span class="nb-accent">Collecting Traffic Statistics</span>

```bash
vnstat -i eth0

# Shows:
heute:        15.24 GB  /  25.31 GB  /  40.55 GB
gestern:      12.54 GB  /  22.35 GB  /  34.89 GB
dieser Monat: 345.45 GB / 678.12 GB /    1.02 TB
```

<span class="nb-accent">Graphical Evaluation with vnstati</span>

* vnstati -s -i eth0 -o summary.png

## Troubleshooting

When network problems occur, a systematic approach helps with troubleshooting:

**Troubleshooting steps:**

```markdown
┌─────────── Connection ──────────────────────────────────────┐
│  • ping (reachability)                                       │
│  • traceroute (routing path)                                 │
│  • netstat (connections)                                     │
├─────────── DNS ─────────────────────────────────────────────┤
│  • nslookup (name resolution)                                │
│  • dig (detailed DNS info)                                   │
│  • Check /etc/resolv.conf                                    │
├─────────── Logs ────────────────────────────────────────────┤
│  • dmesg (kernel messages)                                   │
│  • /var/log/syslog                                           │
│  • journalctl                                                │
└─────────────────────────────────────────────────────────────┘
```

### Practical Troubleshooting

<span class="nb-accent">Basic Connectivity</span>

```bash
ping 8.8.8.8          # Internet connection

ping gateway          # Router reachable

ip route show         # Routing table
```

<span class="nb-accent">Diagnosing DNS Problems</span>

```bash
nslookup google.com   # DNS resolution

dig google.com        # Detailed DNS info

cat /etc/resolv.conf  # DNS configuration
```

<span class="nb-accent">Checking Network Interfaces</span>

```bash
ip addr show          # Interface status

ethtool eth0          # Link status

iwconfig wlan0        # WLAN status
```

## Exercise

In this exercise, we will practically apply the most important concepts from the article.

**Exercise tasks:**

```markdown
┌─────────── Fundamentals ────────────────────────────────────┐
│  1. Check network status                                     │
│  2. DNS configuration                                        │
│  3. Firewall rules                                           │
├─────────── Goals ───────────────────────────────────────────┤
│  • Interface configuration                                   │
│  • Set up DNS server                                         │
│  • Set up basic firewall                                     │
└─────────────────────────────────────────────────────────────┘
```

**Task 1:** Basic network configuration

```bash
# 1. Check your network interfaces
ip addr show

# 2. Configure a static IP
sudo ip addr add 192.168.1.100/24 dev eth0

# 3. Set the default route
sudo ip route add default via 192.168.1.1
```

**Task 2:** DNS configuration

```bash
# 1. Configure DNS server
sudo nano /etc/resolv.conf

# Add:
nameserver 8.8.8.8
nameserver 8.8.4.4

# 2. Test DNS resolution
nslookup google.com
```

**Task 3:** Basic firewall setup

```bash
# 1. Enable UFW
sudo ufw enable

# 2. Create basic rules
sudo ufw default deny incoming
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp

# 3. Check status
sudo ufw status verbose
```

## Command Reference (Cheatsheet)

For quick access during network administration, troubleshooting, and firewall configuration, the following reference table summarizes the most important Linux commands:

| Command / Syntax | Category | Function & Description |
|---|---|---|
| `ip link show` | Interfaces | Shows all network adapters and their link status (UP/DOWN). |
| `ip addr show` | IP Addresses | Lists all IPv4 and IPv6 addresses of all interfaces. |
| `ip route show` | Routing | Shows kernel routing table and active default gateway. |
| `ip route get <IP>` | Routing | Determines interface and next-hop for a specific destination IP. |
| `sudo netplan try` | Netplan | Tests YAML network configuration with automatic 120s rollback. |
| `sudo netplan apply` | Netplan | Applies Netplan network configurations permanently. |
| `nmcli device status` | NetworkManager | Shows status and connection profiles of all NetworkManager devices. |
| `nmcli connection up <id>` | NetworkManager | Activates a defined NetworkManager connection profile. |
| `resolvectl status` | DNS | Shows active DNS servers and search domains of systemd-resolved. |
| `dig +short <domain>` | DNS | Provides precise IP addresses of a domain via DNS query. |
| `sudo ss -tulpn` | Ports & Sockets | Lists all listening TCP/UDP sockets with associated PID. |
| `sudo ufw default deny incoming` | Firewall | Sets restrictive default policy for all incoming packets. |
| `sudo ufw allow 22/tcp` | Firewall | Opens TCP port 22 (SSH) in the Uncomplicated Firewall. |
| `sudo ufw limit 22/tcp` | Firewall | Activates automatic rate limiting against SSH brute-force attacks. |
| `sudo ufw status verbose` | Firewall | Shows detailed list of all active UFW rules and policies. |
| `nc -zv <host> <port>` | Diagnose | Checks quick TCP connectivity to a target port (Netcat). |
| `traceroute <host>` | Diagnose | Shows hop-by-hop router stations on the way to the target. |

## Further Resources

The following guides, specifications, and internal course modules deepen Linux network configuration and troubleshooting:

| Resource | Description |
|---|---|
| [Netplan Documentation](https://netplan.readthedocs.io/){.badge-link-text} | Official documentation for declarative YAML network configuration. |
| [iproute2 Documentation](https://wiki.linuxfoundation.org/networking/iproute2){.badge-link-text} | Official guide for ip, ss, tc, and network namespaces. |
| [systemd-resolved Manual](https://manpages.debian.org/systemd-resolved.8){.badge-link-text} | Official documentation for the systemd Name Resolution Service. |
| [UFW Community Documentation](https://help.ubuntu.com/community/UFW){.badge-link-text} | Comprehensive guide for the Uncomplicated Firewall on Ubuntu/Debian. |
| [Linux Administration #3: Processes](/en/linux-administration/linux-administration-processes-and-resource-management){.badge-link-text} | The previous module: processes, signals, nice & cgroups. |
| [Linux Administration #5: Shell Scripting](/en/linux-administration/linux-administration-shell-scripting-and-automation){.badge-link-text} | The next module: automation, cron, traps & bash. |
| [Command Line Processor in Linux](/en/linux-beginners/command-line-processor-in-linux){.badge-link-text} | Fundamental knowledge about shells, I/O streams, and pipes. |

## Conclusion

Network management is the fundamental link that integrates standalone Linux servers into fail-safe cloud and data center infrastructures. Through mastery of modern `iproute2` commands, declarative network configuration via Netplan and NetworkManager, transparent DNS resolution via `systemd-resolved`, and solid firewall rules with UFW and nftables, you are able to set up high-availability server networks and systematically locate disruptions during operation.

<blockquote class="infobox infobox--info">
💡 **Practical Tip:** Always test new network configurations via Netplan with `sudo netplan try`. This command applies the configuration and automatically reverts it after 120 seconds if you lock yourself out of SSH access due to a typo and cannot confirm the timeout with Enter in time.
</blockquote>

In the next module of our administration course, we turn to automating recurring tasks:
👉 **Next up:** [Linux Administration #5: Shell Scripting and Automation](/en/linux-administration/linux-administration-shell-scripting-and-automation){.badge-link-text}

👉 **Course Overview:** [All Linux Administration Articles & Modules](/en/category/linux-administration){.badge-link-text}
