Skip to content

22. Network Configuration

While commands like ip addr add manipulate networking state in memory, those changes are lost upon reboot. To establish persistent, production-grade networking, modern Linux distributions rely on management daemons—primarily NetworkManager.

NetworkManager runs as a system service (NetworkManager.service) and manages both physical and virtual network interfaces. It separates physical Devices (hardware ports) from logical Connections (configuration profiles).

Terminal window
# Verify NetworkManager service state
sudo systemctl status NetworkManager
# Enable and start NetworkManager
sudo systemctl enable --now NetworkManager
# Toggle entire networking subsystem on or off
nmcli networking off
nmcli networking on
Terminal window
# View status of physical and virtual network hardware
nmcli device status
# Connect or disconnect a physical interface
sudo nmcli device connect eth0
sudo nmcli device disconnect eth0
# List all configured connection profiles
nmcli connection show
# View detailed properties of a specific profile
nmcli connection show "office-eth0"

22.2 Configuring Network Profiles with nmcli

Section titled “22.2 Configuring Network Profiles with nmcli”

Production servers require predictable network configuration—either explicitly assigned Static IPs or centrally administered DHCP reservations.

Create a persistent profile with an IP address, subnet mask, default gateway, and DNS servers:

Terminal window
sudo nmcli connection add type ethernet \
con-name static-eth0 \
ifname eth0 \
ipv4.method manual \
ipv4.addresses 192.168.2.20/24 \
ipv4.gateway 192.168.2.1 \
ipv4.dns "8.8.8.8 1.1.1.1" \
autoconnect yes

Configure an interface to automatically lease networking parameters:

Terminal window
sudo nmcli connection add type ethernet \
con-name dhcp-eth1 \
ifname eth1 \
ipv4.method auto \
autoconnect yes

Update properties on an active profile without recreating it:

Terminal window
# Change IP address
sudo nmcli connection modify static-eth0 ipv4.addresses 192.168.2.30/24
# Update default gateway
sudo nmcli connection modify static-eth0 ipv4.gateway 192.168.2.1
# Update DNS servers
sudo nmcli connection modify static-eth0 ipv4.dns "8.8.4.4 1.0.0.1"

4. Activating, Deactivating, and Deleting Connections

Section titled “4. Activating, Deactivating, and Deleting Connections”
Terminal window
# Activate a connection profile
sudo nmcli connection up static-eth0
# Deactivate a connection profile
sudo nmcli connection down static-eth0
# Delete a profile permanently
sudo nmcli connection delete static-eth0

In enterprise environments, a single network cable or NIC represents a single point of failure. NIC Teaming (and the kernel-level Bonding) aggregates multiple physical interfaces into a single logical link.

  • Increased Bandwidth: Aggregates individual link throughput for data-heavy workloads.
  • Fault Tolerance & Redundancy: If one NIC or switch port fails, standby interfaces automatically sustain connectivity without downtime.
  • Load Balancing: Distributes outbound and inbound traffic across member ports.

| Feature | Kernel Bonding | NIC Teaming (teamd) | |||| | Architecture | Kernel-space module | User-space daemon (teamd) | | Modularity & Logic | Monolithic kernel drivers | Modular runner plugins | | Configuration Format | Kernel module options | JSON-based configuration | | Performance Overhead | Very low | Slightly higher (context switches) | | Distribution Status | Universally supported | RHEL 7/8, SUSE (Deprecated in RHEL 9 in favor of bonding) |

The operational behavior of a team is governed by its Runner:

| Runner Mode | Description | Switch Requirement | Common Use Case | ||||| | activebackup | One port active; others stay on standby for instant failover | Standard unmanaged switch | High availability without switch config | | loadbalance | Distributes traffic across ports using BPF hash algorithms | Standard unmanaged switch | Increased throughput | | roundrobin | Transmits packets sequentially across all ports | Standard unmanaged switch | Maximum bandwidth (can cause out-of-order packets) | | broadcast | Transmits all traffic across every port concurrently | Standard unmanaged switch | Ultra-reliable telemetry (rarely used) | | lacp (802.3ad) | Dynamic link aggregation protocol | Requires managed switch configured with LACP | Enterprise datacenters & SANs |

  • RHEL / AlmaLinux / Rocky:
    Terminal window
    sudo dnf install teamd -y
  • Debian / Ubuntu:
    Terminal window
    sudo apt install teamd -y

Create the virtual master device team0 with the activebackup runner:

Terminal window
sudo nmcli connection add type team \
con-name team0 \
ifname team0 \
team.runner activebackup

(For load balancing, use team.runner loadbalance)

Attach physical interfaces (eth1 and eth2) to the team:

Terminal window
sudo nmcli connection add type team-slave \
con-name team0-port1 \
ifname eth1 \
master team0
sudo nmcli connection add type team-slave \
con-name team0-port2 \
ifname eth2 \
master team0

Step 4: Configure Team IP Address & Activate

Section titled “Step 4: Configure Team IP Address & Activate”
Terminal window
# Assign static IP to team0
sudo nmcli connection modify team0 \
ipv4.method manual \
ipv4.addresses 192.168.1.100/24 \
ipv4.gateway 192.168.1.1 \
ipv4.dns "1.1.1.1"
# Activate the team and port connections
sudo nmcli connection up team0
sudo nmcli connection up team0-port1
sudo nmcli connection up team0-port2

Inspect real-time port states and active runners:

Terminal window
sudo teamdctl team0 state

Optional: Manual JSON Configuration (/etc/teamd/team0.conf)

Section titled “Optional: Manual JSON Configuration (/etc/teamd/team0.conf)”

Alternatively, teamd can be configured directly with JSON:

{
"runner": { "name": "activebackup" },
"ports": {
"eth1": {},
"eth2": {}
}
}

Run teamd as a daemon:

Terminal window
sudo teamd -g -f /etc/teamd/team0.conf -d

A network bridge behaves like a virtual Ethernet switch inside the Linux kernel. It allows multiple interfaces or virtual machines to share the same physical network segment.

Terminal window
# Create bridge interface
sudo nmcli connection add type bridge con-name br0 ifname br0
# Attach physical interface to bridge
sudo nmcli connection add type bridge-slave con-name br0-slave ifname eth0 master br0
# Bring bridge up
sudo nmcli connection up br0

Crucial in hypervisors and container engines (e.g., Docker creates docker0 as a default bridge).

VLANs logically isolate traffic on a single physical link by tagging packets with an integer ID (1 - 4094).

Terminal window
# Create VLAN 10 interface on physical device eth0
sudo nmcli connection add type vlan \
con-name vlan10 \
ifname eth0.10 \
dev eth0 \
id 10 \
ipv4.method manual \
ipv4.addresses 10.10.10.50/24
# Activate VLAN
sudo nmcli connection up vlan10