Skip to content

Latest commit

 

History

History
408 lines (320 loc) · 11.6 KB

00_OVERVIEW.md

File metadata and controls

408 lines (320 loc) · 11.6 KB
title Linux Networking - Complete Guide
description Complete guide to Linux Networking - Complete Guide
category Networking
tags
networking
network configuration
systemd
firewall
difficulty beginner
last_updated 2026-06-06
related_commands

Linux Networking - Complete Guide

Purpose

Master the complete Linux networking stack from fundamentals to advanced enterprise configurations. Learn TCP/IP, interface management, routing, VLANs, bonding, and troubleshooting for production environments.

Target Audience

  • Beginners: Network fundamentals and basic configuration
  • System Administrators: Network setup and maintenance
  • Network Engineers: Advanced routing, VLANs, troubleshooting
  • DevOps Engineers: Network automation and container networking
  • Enterprise Architects: Design scalable network infrastructures

Prerequisites

Basic Level:

  • Linux command-line proficiency
  • Understanding of IP addresses (basic concepts)

Advanced Topics:

  • System administration experience
  • Understanding of OSI model
  • Familiarity with network protocols

What You'll Learn

  • Network Fundamentals: TCP/IP, OSI model, subnetting, DNS, DHCP
  • Interface Management: Configure network interfaces with ip, nmcli, NetworkManager
  • Routing: Static routes, default gateway, policy routing
  • VLANs: 802.1Q VLAN configuration and management
  • Bonding/Teaming: NIC aggregation for redundancy and performance
  • Troubleshooting: Debug network issues with modern tools

Section Contents

1. Fundamentals (Fundamentals/)

Topics:

  • OSI Model (7 layers) and TCP/IP Model (4 layers)
  • IP Addressing (IPv4/IPv6, CIDR, subnetting)
  • MAC Addresses and ARP
  • DNS and /etc/hosts, /etc/resolv.conf
  • DHCP client and server configuration
  • Network interface naming (predictable names)

Quick Start:

# View IP addresses
ip addr show

# View routing table
ip route show

# Test connectivity
ping -c 4 8.8.8.8

# DNS lookup
dig google.com

2. Interface Management (Interface_Management/)

Topics:

  • ip command (modern replacement for ifconfig)
  • NetworkManager and nmcli
  • Static IP configuration (RHEL/Debian)
  • Interface states (UP, DOWN, LOWER_UP)
  • Temporary vs persistent configuration

Quick Start:

# List interfaces
nmcli device status

# Configure static IP
nmcli con mod ens33 ipv4.addresses 192.168.1.100/24
nmcli con mod ens33 ipv4.gateway 192.168.1.1
nmcli con mod ens33 ipv4.dns 8.8.8.8
nmcli con mod ens33 ipv4.method manual
nmcli con up ens33

3. Routing (Routing/)

Topics:

  • Routing table management
  • Default gateway configuration
  • Static routes
  • Policy-based routing
  • Multiple routing tables

Quick Start:

# View routes
ip route show

# Add static route
ip route add 10.0.0.0/24 via 192.168.1.1

# Add default gateway
ip route add default via 192.168.1.1

# Persistent routes (RHEL)
echo "10.0.0.0/24 via 192.168.1.1" >> /etc/sysconfig/network-scripts/route-ens33

4. VLANs (VLANs/)

Topics:

  • 802.1Q VLAN tagging
  • VLAN interface creation
  • VLAN trunking
  • Inter-VLAN routing
  • VLAN configuration persistence

Quick Start:

# Load 8021q module
modprobe 8021q

# Create VLAN interface (VLAN 10)
ip link add link ens33 name ens33.10 type vlan id 10

# Assign IP to VLAN interface
ip addr add 192.168.10.1/24 dev ens33.10

# Bring up VLAN interface
ip link set dev ens33.10 up

5. Bonding & Teaming (Bonding_Teaming/)

Topics:

  • NIC bonding (7 modes: 0-6)
  • Mode 0 (balance-rr): Round-robin for load balancing
  • Mode 1 (active-backup): Failover for high availability
  • Mode 4 (802.3ad/LACP): Dynamic link aggregation
  • Mode 5 (balance-tlb): Adaptive transmit load balancing
  • Mode 6 (balance-alb): Adaptive load balancing
  • Configuration with NetworkManager
  • Teaming (modern alternative to bonding)

Quick Start:

# Create bond interface (mode 1 - active-backup)
nmcli con add type bond con-name bond0 ifname bond0 mode active-backup
nmcli con add type ethernet con-name bond0-port1 ifname ens33 master bond0
nmcli con add type ethernet con-name bond0-port2 ifname ens34 master bond0
nmcli con up bond0

6. Troubleshooting (Troubleshooting/)

Topics:

  • Connectivity testing (ping, traceroute, mtr)
  • Socket statistics (ss, netstat)
  • Packet capture (tcpdump, wireshark)
  • DNS troubleshooting (dig, host, nslookup)
  • ARP cache management
  • Network performance testing (iperf)

Quick Start:

# Check listening ports
ss -tuln

# Trace route
traceroute google.com

# Capture packets
tcpdump -i ens33 -n

# Test bandwidth
iperf3 -s  # Server
iperf3 -c server_ip  # Client

Navigation

Explore Subsections

Related Sections

  • Network Commands: 01_Commands/Network_Commands/
  • Firewall: 04_Security/Firewall/
  • Performance: 05_Performance/Network_Performance/
  • System Administration: 07_System_Administration/

Main Navigation

  • Previous: @_OVERVIEW.md)
  • Next: @_OVERVIEW.md)
  • Home: @_START_HERE.md)

Common Workflows

1. Configure Static IP Address

RHEL/Rocky (NetworkManager):

nmcli con mod ens33 ipv4.addresses 192.168.1.100/24
nmcli con mod ens33 ipv4.gateway 192.168.1.1
nmcli con mod ens33 ipv4.dns "8.8.8.8 8.8.4.4"
nmcli con mod ens33 ipv4.method manual
nmcli con up ens33

Ubuntu (Netplan):

# /etc/netplan/01-netcfg.yaml
network:
  version: 2
  ethernets:
    ens33:
      addresses: [192.168.1.100/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

2. Setup NIC Bonding for HA

# Create bond (active-backup)
nmcli con add type bond con-name bond0 ifname bond0 mode active-backup
nmcli con mod bond0 ipv4.addresses 192.168.1.100/24
nmcli con mod bond0 ipv4.gateway 192.168.1.1
nmcli con mod bond0 ipv4.method manual

# Add slave interfaces
nmcli con add type ethernet con-name bond0-port1 ifname ens33 master bond0
nmcli con add type ethernet con-name bond0-port2 ifname ens34 master bond0

# Activate
nmcli con up bond0

3. Create VLAN Interfaces

# Load VLAN module
modprobe 8021q
echo "8021q" >> /etc/modules-load.d/vlan.conf

# Create VLAN 10 interface
nmcli con add type vlan con-name vlan10 ifname ens33.10 dev ens33 id 10
nmcli con mod vlan10 ipv4.addresses 192.168.10.1/24
nmcli con mod vlan10 ipv4.method manual
nmcli con up vlan10

Best Practices

DO:

  • Use predictable network interface names (ens33, enp0s3) - standard since systemd
  • Use NetworkManager (nmcli) for RHEL/Rocky/Fedora systems
  • Use Netplan for Ubuntu server configurations
  • Test configuration before rebooting - always maintain console/IPMI access
  • Document network changes in version control or change management system
  • Use bonding/teaming for critical servers (mode 1 or 4)
  • Implement VLAN segmentation for security and traffic isolation
  • Monitor with modern tools (ss, ip, nmcli, ethtool)
  • Use nftables/firewalld instead of raw iptables

DON'T:

  • Don't use deprecated net-tools (ifconfig, route, netstat, arp) - removed from modern distributions
  • Don't use network-scripts - removed in RHEL 9, Ubuntu doesn't use them
  • Don't configure without backup access - always have console/IPMI/serial available
  • Don't forget persistence - temporary changes via ip command are lost on reboot
  • Don't use VLAN 1 (default untagged VLAN) - security best practice
  • Don't bond interfaces across switches without LACP (802.3ad) support
  • Don't skip firewall configuration - firewalld enabled by default, configure it
  • Don't disable IPv6 unless absolutely required - it's the future

Quick Reference

IP Command Cheat Sheet

ip addr show                    # Show IP addresses
ip link show                    # Show interfaces
ip route show                   # Show routes
ip -s link                      # Show interface statistics
ip addr add 192.168.1.100/24 dev ens33  # Add IP
ip link set dev ens33 up        # Bring interface up
ip route add 10.0.0.0/24 via 192.168.1.1  # Add route

NetworkManager (nmcli)

nmcli device status             # Show devices
nmcli connection show           # Show connections
nmcli con show ens33            # Show connection details
nmcli con up ens33              # Activate connection
nmcli con down ens33            # Deactivate connection
nmcli con reload                # Reload configuration

Troubleshooting

ping -c 4 8.8.8.8               # Test connectivity
traceroute google.com           # Trace route
ss -tuln                        # Show listening ports
tcpdump -i ens33                # Capture packets
dig google.com                  # DNS lookup
arp -a                          # View ARP cache

Last Updated: 2026-06-06 Coverage: Fundamentals, Interface Config, Routing, VLANs, Bonding, Troubleshooting Level: Beginner to Advanced Target Distributions: RHEL 8/9/10, Ubuntu 22.04/24.04, SUSE SLES 15/Leap 15+


Modern Linux Networking

This documentation focuses on modern networking tools and configurations (2024-2026).

Modern Networking Stack

RHEL 8/9/10 & Compatible Distributions:

  • NetworkManager - Primary network configuration daemon (network-scripts removed in RHEL 9)
  • nmcli - Command-line NetworkManager interface
  • firewalld - Dynamic firewall using nftables backend (RHEL 9+)
  • nftables - Modern packet filtering framework (replaces iptables)
  • systemd-networkd - Alternative lightweight network manager
  • Predictable network names - ens33, enp0s3 (not eth0)

Ubuntu 22.04/24.04:

  • Netplan - YAML-based network configuration (uses NetworkManager or systemd-networkd backend)
  • NetworkManager - Available for desktop/laptop configurations
  • systemd-networkd - Default for server installations
  • ufw - Simplified firewall (frontend for nftables)
  • nftables - Standard packet filtering

SUSE SLES 15/Leap 15+:

  • wicked - Default network configuration (SUSE-specific)
  • NetworkManager - Alternative for desktops
  • firewalld - Default firewall
  • YaST - System configuration tool includes network management

Deprecated/Removed Networking Tools

Deprecated Tool Modern Replacement Status Notes
ifconfig ip addr, ip link ❌ Removed Not in default install (RHEL 8+, Ubuntu 22.04+)
route ip route ❌ Removed Part of deprecated net-tools
netstat ss ❌ Removed Slower, less detailed than ss
arp ip neigh ❌ Removed Part of deprecated net-tools
network-scripts NetworkManager, Netplan ❌ Removed Removed in RHEL 9, Ubuntu uses Netplan
iptables (direct) firewalld, nftables ⚠️ Legacy Works but discouraged; use firewalld/nftables
ifup/ifdown nmcli con up/down ⚠️ Legacy NetworkManager commands preferred

What's New in Modern Distributions

RHEL 9 / Rocky Linux 9:

  • firewalld uses nftables backend by default
  • network-scripts completely removed
  • nmcli enhanced with better WiFi and VPN support
  • WireGuard VPN in kernel
  • IPv6 enabled by default

Ubuntu 22.04/24.04:

  • Netplan 0.105+ with improved documentation
  • systemd-networkd default for servers
  • nftables default firewall backend
  • WireGuard VPN integrated
  • IPv6 preferred over IPv4

SUSE SLES 15 SP5+:

  • wicked 0.6+ with improved bonding
  • firewalld 1.x with zones
  • Enhanced YaST network configuration