Understanding Linux Networking
Networking is the backbone of modern IT infrastructure. Whether you're managing cloud servers, on-premises data centers, or hybrid environments, solid networking knowledge is essential for every Linux administrator.
This guide covers practical networking skills you'll use daily, from basic configuration to advanced troubleshooting.
The Modern Linux Network Stack
Linux networking has evolved significantly. While traditional tools like ifconfig and route still work, modern administrators use the ip command suite:
# View all interfaces
ip addr show
# View routing table
ip route show
# View neighbor (ARP) table
ip neigh show
Understanding both legacy and modern tools is importantโyou'll encounter systems using either.
IP Address Configuration
Static IP Configuration
For servers, static IP addresses provide consistency. Configuration varies by distribution:
Netplan (Ubuntu 20.04+):
# /etc/netplan/00-installer-config.yaml
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.100/24
gateway4: 192.168.1.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
NetworkManager
Desktop distributions and RHEL-based systems often use NetworkManager:
nmcli con mod "Wired connection 1" \
ipv4.addresses 192.168.1.100/24 \
ipv4.gateway 192.168.1.1 \
ipv4.dns "8.8.8.8,8.8.4.4" \
ipv4.method manual
DNS Configuration
Domain Name System resolution is critical for network connectivity. Modern systems use systemd-resolved:
# Check DNS resolution status
resolvectl status
# Test DNS resolution
dig example.com
nslookup example.com
For servers, configure DNS in network configuration files. For testing, /etc/hosts overrides DNS for specific entries.
Routing Fundamentals
Every packet needs a route to its destination:
# View routing table
ip route show
# Add a static route
ip route add 10.0.0.0/8 via 192.168.1.254
# Set default gateway
ip route add default via 192.168.1.1
Understanding routing is crucial for multi-network environments, VPNs, and container networking.
Firewall Configuration
Linux firewalls protect your systems from unauthorized access. Modern options include:
firewalld (RHEL/CentOS/Fedora)
# Check status
firewall-cmd --state
# Allow HTTP traffic
firewall-cmd --permanent --add-service=http
# Open specific port
firewall-cmd --permanent --add-port=8080/tcp
# Reload rules
firewall-cmd --reload
UFW (Ubuntu)
# Enable firewall
ufw enable
# Allow SSH
ufw allow ssh
# Allow specific port
ufw allow 8080/tcp
# Check status
ufw status verbose
Network Troubleshooting Tools
Connectivity Testing
# Basic connectivity
ping 8.8.8.8
# Trace route to destination
traceroute google.com
mtr google.com # Interactive version
Port and Connection Analysis
# List listening ports
ss -tulnp
# Check specific port
ss -tulnp | grep :80
# View all connections
ss -tunapl
Packet Capture
# Capture traffic on interface
tcpdump -i eth0
# Capture specific port
tcpdump -i eth0 port 80
# Save to file for Wireshark analysis
tcpdump -i eth0 -w capture.pcap
Network Performance
Monitor network performance with these tools:
# Real-time bandwidth monitoring
iftop -i eth0
# Network statistics
nload eth0
# Bandwidth testing
iperf3 -s # Server mode
iperf3 -c server-ip # Client mode
Common Network Services
Linux administrators frequently configure:
- SSH - Secure remote access
- HTTP/HTTPS - Web servers (Nginx, Apache)
- DNS - Name resolution (BIND, dnsmasq)
- DHCP - Dynamic IP assignment
- NFS/SMB - File sharing
- VPN - Secure tunnels (WireGuard, OpenVPN)
Conclusion
Networking skills are fundamental to Linux administration. Practice these concepts in a lab environment, and you'll be prepared to handle real-world networking challenges.
Our Linux networking eBooks provide deeper exploration of each topic, with hands-on labs and real-world scenarios.