Pages

RHEL Linux Network Management

Linux networking is the backbone of everything from home servers to enterprise clouds. Understanding it is essential for system administrators, DevOps engineers, and network specialists. This guide covers core concepts, configuration, troubleshooting, and advanced tuning, focusing on RHEL/CentOS systems, but applicable broadly across Linux distributions.

Core Networking Components
A Linux system communicates with the network via several key components:
  • NICs (Network Interface Cards) – Hardware devices like Ethernet or Wi-Fi ports. Use MAC addresses for Layer 2 identification, manage framing/checksums, and support offloads like TSO (TCP Segmentation Offload) and GRO (Generic Receive Offload).
  • IP Addresses – Uniquely identify hosts on a network (e.g., 192.168.1.100). Subnet masks (/24 or 255.255.255.0) split IPs into network and host portions.
  • Gateways – Route traffic to external networks, usually your router (192.168.1.1).
  • DNS (Domain Name System) – Resolves domain names to IPs (8.8.8.8, 1.1.1.1).
  • Protocols – TCP (reliable), UDP (fast), ARP (MAC resolution), ICMP (ping/traceroute). Together they form the TCP/IP stack, fundamental to Linux networking.
Interface Types and Virtualization

Linux supports a variety of interface types:

Pro Tip: Use ip link to inspect interface types and states.

Network Configuration Files
TypePurposeKey Command Example
EthernetWired LAN (enp0s3)ip link show enp0s3
LoopbackLocalhost (lo, 127.0.0.1)ping localhost
VLANTagged segmentation (802.1Q)ip link add link eth0 name eth0.10 type vlan id 10
BridgesVM/container connectivitybrctl addbr br0 cycle
BondingRedundancy (active-backup, LACP)modprobe bonding; ip link add bond0 type bond
NamespacesContainer isolation (ip netns)ip netns add cont1 dotlinux

RHEL 7/8
NetworkManager uses /etc/sysconfig/network-scripts/ifcfg-<iface>:

Static IP Example:

DEVICE=enp0s3
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.100
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4

For DHCP: BOOTPROTO=dhcp

RHEL 9+
Uses /etc/NetworkManager/system-connections/<iface>.nmconnection (keyfile format):

[connection]
id=enp0s3
type=ethernet
interface-name=enp0s3
autoconnect=true

[ipv4]
method=manual
address1=192.168.1.100/24,192.168.1.1
dns=8.8.8.8;8.8.4.4;

Always run:
# nmcli con reload
# systemctl restart NetworkManager
to apply changes.

Managing with nmcli and ip Tools

nmcli simplifies network management:
# nmcli device status          # List interfaces
# nmcli con show               # Show profiles
# nmcli con add type ethernet ifname enp0s3 con-name mynet 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
# nmcli con mod mynet ipv4.method auto    # Switch to DHCP
# nmcli con up/down mynet                  # Bring interface up/down

ip commands for runtime management:
# ip addr show dev enp0s3                  # Show IP addresses
# ip link set enp0s3 up/down               # Activate/deactivate
# ip addr add 192.168.1.200/24 dev enp0s3 # Temporary IP
# ip route show                            # Show routing table
# ip route add default via 192.168.1.1     # Add default route

DNS is in /etc/resolv.conf, but use nmcli for persistence.

Firewalls and Security

RHEL uses firewalld by default:
# firewall-cmd --state                     # Status
# firewall-cmd --get-active-zones          # Active zones
# firewall-cmd --zone=public --add-port=80/tcp --permanent
# firewall-cmd --reload

For legacy setups, iptables can be used for more granular control.

Pro Tip: Always assign interfaces to the correct zone (public, internal, dmz) to avoid unexpected access.

Troubleshooting Essentials
  • ping 8.8.8.8 – Reachability
  • traceroute google.com – Path hops
  • nslookup / dig google.com – DNS issues
  • tcpdump -i enp0s3 -n – Capture packets
  • ethtool -S enp0s3 – NIC stats
  • ethtool enp0s3 – Speed/duplex
Check for:
  • Physical cable or link issues
  • Duplex mismatches (full/half)
  • MTU misconfiguration (default 1500)

Advanced Tuning for Performance
High-performance servers require network stack tuning:

Key sysctl parameters:
CategoryParameterTune ValueBenefit
Buffersnet.core.rmem_max16777216Larger RX for high traffic
TCPnet.ipv4.tcp_rmem4096 87380 16777216Adaptive receive cycle
Congestionnet.ipv4.tcp_congestion_controlbbrBetter for high-BDP (AWS)
Timeoutsnet.ipv4.tcp_fin_timeout15Faster connection recycle

Persist in /etc/sysctl.d/99-network.conf and apply:
# sysctl --system


Other optimizations:
  • Interrupt coalescing: ethtool -C enp0s3 rx-usecs 50 batches interrupts for lower CPU usage.
  • Jumbo frames: ip link set enp0s3 mtu 9000 for high-throughput networks.
  • Offloads: Enable TSO/GRO/LRO for large-volume transfers.
BBR TCP congestion control is highly recommended for high-BDP links like cloud environments (AWS, GCP).

Monitoring Tools
ToolPurpose
iftop -i enp0s3Real-time per-connection bandwidth
nload enp0s3Graphical traffic monitoring
ss -sSocket statistics
sar -n DEV 1Historical network stats (sysstat)
bpftrace/nethogsPer-process network monitoring
Prometheus Node ExporterProduction-grade metrics

Pro Tip: Always test tuning in a lab environment before deploying to production.

Best Practices
  • Use consistent interface naming for scripts.
  • Maintain DNS and gateway consistency across servers.
  • Apply firewall rules per zone, not per interface, when possible.
  • Monitor CPU utilization and IRQ load after tuning offloads.
  • Document all tuning changes in version control.
Linux networking in RHEL/CentOS is highly flexible and tunable, but careful planning and testing are key. With proper configuration, monitoring, and tuning, you can achieve robust, high-performance networks suitable for enterprise workloads.

No comments:

Post a Comment