USD ($)
$
United States Dollar
Euro Member Countries
India Rupee
د.إ
United Arab Emirates dirham
ر.س
Saudi Arabia Riyal

Network Interface Configuration

Lesson 16/40 | Study Time: 20 Min

Network interface configuration is fundamental for establishing and managing connectivity in Linux systems. Tools like ip and ifconfig allow real-time interface status and configuration adjustments, while persistent settings are maintained via utilities like Netplan or NetworkManager on modern distributions.

Additionally, bonding and teaming techniques enhance network availability and throughput by aggregating multiple physical interfaces into one logical interface. 

Network Configuration Tools

Linux provides multiple tools to configure and troubleshoot network interfaces. The list below highlights both recommended and legacy utilities.


1. ip: The modern, versatile tool recommended for managing network interfaces, addresses, routes, and tunnels.

Example commands:

bash
ip link show # Show all interfaces
ip addr add 192.168.1.10/24 dev eth0 # Add IP address
ip link set eth0 up # Bring interface up
ip link set eth0 down # Shut down interface


2. ifconfig: Traditional utility for interface configuration, now largely deprecated but still present in some systems.

Install with net-tools package if missing.

Example:

bash
ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
ifconfig eth0 down

Interface Status and Settings

Use ip link show or ifconfig to check interface states (up/down), MAC address, MTU size, and statistics. Important for troubleshooting connectivity and verifying configurations.

Permanent Network Configuration

Linux provides modern tools to manage long-term network configuration reliably. The list below highlights utilities used to apply and maintain persistent network settings.


1. Netplan: YAML-based utility used primarily in Ubuntu 18.04+ and derivatives.

Configuration files reside in /etc/netplan/. A typical file may configure interfaces, IP addresses, gateways, and DNS with options for DHCP or static addressing.

After editing, apply changes with:

bash
sudo netplan apply


Example snippet:

text
network:
version: 2
renderer: NetworkManager
ethernets:
eth0:
dhcp4: yes


2. NetworkManager: Modern, flexible daemon managing network connections across desktop and server environments. Supports dynamic configuration via GUI tools or the nmcli command-line client.

Example to activate connection:

bash
nmcli connection up eth0

Bonding and Teaming

To build resilient network setups, it is important to understand bonding and teaming in Linux networking. The list below introduces their purpose and configuration.


1. Network Bonding merges multiple physical interfaces into a single logical interface to increase bandwidth and provide fault tolerance. Modes include:


balance-rr (round-robin)

active-backup (redundancy)

802.3ad (LACP for link aggregation)


2. Configure bonding via Netplan or NetworkManager by specifying bond mode, slave interfaces, and IP parameters.


Example (using ip and ifconfig): 

bash
sudo ip link add bond0 type bond mode 802.3ad
sudo ip link set eth0 master bond0
sudo ip link set eth1 master bond0
sudo ip link set bond0 up
ifconfig bond0 192.168.1.100 netmask 255.255.255.0 up


3. Teaming is a newer alternative to bonding, providing link aggregation features with better flexibility, managed by teamd daemon.