HSR Sector 6 · Bangalore +91 96110 27980 Mon–Sat · 09:30–20:30
Chapter 8 of 20 — Linux Administration
intermediate Chapter 8 of 20

Linux Networking — IP Configuration, Routing & Interfaces

By Vikas Swami, CCIE #22239 | Updated Mar 2026 | Free Course

Network Interfaces — eth0, ens33, lo & Naming Conventions

Understanding network interfaces is fundamental to mastering Linux networking. Linux systems recognize multiple types of interfaces, each serving distinct purposes and following specific naming conventions that have evolved over time. Historically, interface names like eth0 and lo were commonplace, but recent Linux distributions have adopted more predictable naming schemes such as ens33 and enp0s3.

The eth0 interface was the default Ethernet interface in older Linux distributions. It represents the first Ethernet device recognized during system boot. The lo interface, on the other hand, is the loopback interface, which facilitates communication within the local system. It is always present and typically assigned the IP address 127.0.0.1.

Modern Linux distributions, especially those using systemd, prefer "predictable network interface names" to avoid inconsistencies across reboots and hardware changes. These names are based on the hardware location, such as ens33 (Ethernet, on slot 33), enp0s3, or eno1. This approach simplifies network configuration and troubleshooting, especially in environments with multiple interfaces.

For example, a typical network interface list can be obtained using:

ip link show

which displays all available interfaces along with their current state and naming conventions. Recognizing these interfaces is critical when configuring IP addresses, setting up routing, or troubleshooting network issues. In the context of Networkers Home, mastering interface identification forms the backbone of effective Linux network configuration.

IP Configuration — ip addr, ip link & Legacy ifconfig

Configuring and managing IP addresses is a core task in Linux networking. The most modern tool for this purpose is the ip command, which replaces the legacy ifconfig. The ip command provides extensive control over network interfaces, IP addresses, routing, and other network parameters, making it indispensable for intermediate Linux administrators.

To view the current IP addresses assigned to interfaces, use:

ip addr show

This command displays detailed information, including IP addresses, subnet masks, and interface status. For example, output might look like:

2: ens33:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:3e:1b:2a brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic ens33
       valid_lft 86399sec preferred_lft 86399sec

To configure or modify IP addresses, the command syntax is:

ip addr add 192.168.1.20/24 dev ens33

Similarly, the ip link command allows you to bring interfaces up or down, or change their properties:

ip link set ens33 up
ip link set ens33 down

While ifconfig remains available on some systems for legacy support, it is deprecated because it offers limited functionality and does not support IPv6 configuration. For example, to view interfaces using ifconfig:

ifconfig

In practical scenarios, Linux administrators leverage the ip command for its comprehensive capabilities, scripting, and automation. Understanding these tools is vital for effectively managing Linux network configuration, especially when deploying complex network topologies or troubleshooting connectivity issues.

Routing — ip route, Default Gateway & Static Routes

Routing determines how packets traverse the network to reach their destination. Linux routing is primarily managed through the ip route command, which provides a detailed view and control over the routing table. Proper configuration of routes ensures efficient data flow and connectivity across different network segments.

To view the current routing table, execute:

ip route show

This displays entries such as:

default via 192.168.1.1 dev ens33
192.168.1.0/24 dev ens33 proto kernel scope link src 192.168.1.10

The default route, indicated by default via, directs all unspecified traffic to the specified gateway, usually your network’s router. Configuring a default gateway involves adding a route like:

ip route add default via 192.168.1.1

Static routes are essential when managing multiple subnets or directing traffic through specific pathways. For example, to add a static route to a remote network:

ip route add 10.0.0.0/24 via 192.168.1.254

Managing the Linux routing table effectively is crucial for network segmentation, security, and performance. It’s also important to understand how the routing table interacts with other network configurations, such as IP addressing and DNS. Linux network administrators often verify routes and troubleshoot connectivity issues by examining the routing table, employing commands like ip route and ping.

NetworkManager & nmcli — Modern Network Configuration

In contemporary Linux distributions, Linux networking management is streamlined through NetworkManager, which provides a unified interface to configure network interfaces, VPNs, Wi-Fi, and Ethernet settings. The command-line tool nmcli enables administrators to script and automate network configuration tasks with precision and ease.

To list all active connections, use:

nmcli connection show

This displays current network profiles, including Ethernet, Wi-Fi, and VPN connections. To view detailed information about a specific connection, run:

nmcli connection show 

Enabling or disabling interfaces can be achieved via:

nmcli connection up 
nmcli connection down 

Creating a new Ethernet connection with static IP configuration involves:

nmcli connection add type ethernet ifname ens33 con-name StaticEthernet ip4 192.168.1.50/24 gw4 192.168.1.1

Compared to manual ifconfig and ip commands, nmcli offers a more user-friendly, persistent, and integrated approach to network management. It simplifies complex configurations, especially in environments where dynamic and static connections coexist. For Linux administrators, mastering Networkers Home courses on NetworkManager enhances operational efficiency and flexibility.

Feature Traditional Commands (ifconfig/ip) NetworkManager & nmcli
Ease of Use Manual, command-based, sometimes complex for beginners Intuitive, consistent interface, scriptable
Persistence Requires manual configuration files or scripting for persistence Configurations are persistent across reboots
Dynamic Management Limited; often needs additional scripting or tools Supports dynamic changes, connection profiles, and automation
Scope Primarily basic IP and interface management Comprehensive management including Wi-Fi, VPNs, proxies

Mastering network configuration with NetworkManager and nmcli is essential for agile Linux network administrators, especially in environments with diverse and dynamic network requirements.

DNS Configuration — /etc/resolv.conf, systemd-resolved & dig

Domain Name System (DNS) configuration is vital in Linux networking to resolve hostnames into IP addresses, enabling seamless network navigation and service access. The primary file governing DNS settings traditionally is /etc/resolv.conf. However, modern Linux systems often utilize systemd-resolved for DNS management, providing enhanced features such as DNS caching and DNSSEC validation.

In classic setups, /etc/resolv.conf contains nameserver entries like:

nameserver 8.8.8.8
nameserver 8.8.4.4

This file directs the system to use Google's public DNS servers. When systemd-resolved is active, it manages DNS settings dynamically, often linking /etc/resolv.conf to a local stub resolver (e.g., 127.0.0.53).

To verify DNS resolution, tools like dig are invaluable. For example:

dig www.google.com

This command queries DNS servers directly and displays detailed information about the resolution process, including the response time, authoritative servers, and DNS records. It is essential for troubleshooting DNS issues, verifying propagation, or testing configuration changes.

Configuring DNS in modern systemd-based distributions involves editing appropriate network configuration files or using Networkers Home Blog tutorials to set specific DNS servers for network profiles. Proper DNS configuration ensures reliable hostname resolution, critical for cloud services, internal networks, and internet access.

Network Troubleshooting — ping, traceroute, mtr, ss & netstat

Effective Linux networking troubleshooting requires a toolkit of commands to diagnose connectivity and performance issues. Key utilities include ping, traceroute, mtr, ss, and netstat.

Ping tests basic reachability of a host or network segment:

ping 8.8.8.8

It measures latency and packet loss. Persistent ping tests can reveal intermittent network problems.

Traceroute maps the path packets take to reach a destination, identifying bottlenecks or failures along the route:

traceroute www.google.com

mtr (My Traceroute) combines traceroute and ping, providing real-time insight into network performance:

mtr www.google.com

ss and netstat display socket statistics, open connections, and listening ports, aiding in diagnosing service issues:

ss -tuln
netstat -tuln

Mastering these tools enables Linux network administrators to quickly identify issues, optimize routes, and ensure network reliability. Regular use of these commands is recommended for maintaining high network availability and performance, especially in enterprise environments managed through Networkers Home.

Bonding & VLAN Tagging — Network Interface Aggregation

To enhance bandwidth, provide redundancy, or segregate traffic, Linux supports interface bonding and VLAN tagging. These techniques are critical for setting up resilient and scalable networks.

Bonding combines multiple physical interfaces into a single logical interface. It offers load balancing, fault tolerance, and increased throughput. Common bonding modes include:

  • mode 0 (balance-rr): Round-robin load balancing
  • mode 1 (active-backup): Failover redundancy
  • mode 4 (802.3ad): LACP link aggregation

Configuring bonding involves editing /etc/network/interfaces or using nmcli. For example, creating an LACP bond with nmcli:

nmcli con add type bond con-name bond0 mode 802.3ad
nmcli con add type ethernet con-name ens33-slave ifname ens33 master bond0
nmcli con add type ethernet con-name ens34-slave ifname ens34 master bond0

VLAN tagging allows multiple logical networks over a single physical interface. It assigns a VLAN ID to the interface, enabling traffic segmentation. To create a VLAN interface:

ip link add link ens33 name ens33.100 type vlan id 100
ip addr add 192.168.100.1/24 dev ens33.100
ip link set ens33.100 up

Both bonding and VLANs are essential in data centers and enterprise networks for optimizing performance and security. Comparing their features:

Feature Bonding VLAN Tagging
Purpose Aggregate multiple interfaces for redundancy or increased bandwidth Segment network traffic logically over a single interface
Configuration Complexity Moderate; requires bond setup and interface configuration Simple; involves adding VLAN tags to existing interfaces
Use Cases Server NIC teaming, link aggregation, failover Network segmentation, security zones, virtual LANs
Compatibility Supported by most switches with LACP Supported by managed switches supporting VLAN standards

Implementing bonding and VLANs effectively enhances network resilience and scalability. For comprehensive training, consider enrolling at Networkers Home.

Network Namespaces — Isolation for Testing and Containers

Linux network namespaces provide isolated network environments within a single host, enabling developers and administrators to test configurations, run containers, or simulate complex networks without interference. Each namespace has its own network stack, interfaces, routing tables, and firewall rules.

Creating a network namespace is straightforward using the ip netns command. For example:

ip netns add test_ns
ip netns exec test_ns ip link set lo up
ip netns exec test_ns ip addr add 10.1.1.1/24 dev lo

This sets up a new namespace called test_ns with its own loopback interface and IP address. You can add virtual interfaces, create veth pairs, and connect namespaces to simulate network segments. For instance, to connect two namespaces:

ip link add veth0 type veth peer name veth1
ip link set veth0 netns test_ns
ip netns exec test_ns ip link set veth0 up
ip link set veth1 up
ip addr add 10.1.1.2/24 dev veth1

Network namespaces are integral to containerization platforms like Docker and Kubernetes, providing network isolation for containerized applications. Mastery of namespaces allows Linux professionals to implement secure, scalable, and testable network environments. As part of Networkers Home curriculum, understanding namespaces is crucial for advanced network architecture.

Key Takeaways

  • Understanding network interface naming conventions, including legacy (eth0) and modern (ens33) schemes, is fundamental for Linux network configuration.
  • The ip command is the primary tool for managing IP addresses and interfaces, replacing deprecated utilities like ifconfig.
  • Routing tables, manipulated via ip route, define packet paths, with default gateways and static routes essential for connectivity.
  • NetworkManager and nmcli provide an efficient, persistent, and scriptable approach for network configuration in contemporary Linux systems.
  • DNS configuration involves both static files (/etc/resolv.conf) and dynamic management with systemd-resolved, with tools like dig aiding troubleshooting.
  • Tools like ping, traceroute, and mtr are critical for diagnosing network issues, while ss and netstat reveal socket and connection states.
  • Bonding and VLAN tagging enhance network performance, resilience, and segmentation, supporting scalable enterprise architectures.
  • Linux network namespaces provide isolated environments for testing, containerization, and complex network simulation.

Frequently Asked Questions

What is the difference between ifconfig and ip addr in Linux?

ifconfig is a legacy utility used for viewing and configuring network interfaces, primarily in older Linux distributions. It offers basic features such as assigning IP addresses and enabling interfaces. In contrast, ip addr is part of the modern iproute2 suite, providing extensive capabilities including detailed interface information, IPv6 configuration, and advanced routing options. ip commands are more flexible, script-friendly, and supported across current Linux distributions, making them the preferred choice for Linux networking tasks.

How do I check the current Linux routing table?

The most reliable way to view the Linux routing table is by using ip route show. This command displays all active routes, including default gateways and static routes. For example:

ip route show

It provides comprehensive information about network destinations, gateways, and interface associations. Alternatively, older systems may use netstat -rn, but ip route is now the standard and more versatile method for route inspection and management.

What are network namespaces, and why are they important?

Network namespaces are Linux kernel features that isolate network environments within a single host. Each namespace has its own interfaces, routing tables, and firewall rules, enabling multiple independent networks to coexist securely. They are essential for containerization, testing, and network segmentation, allowing developers to emulate complex topologies or secure multi-tenant environments. Mastering network namespaces is crucial for advanced Linux networking, especially when deploying container-based applications or designing scalable network infrastructures.

Ready to Master Linux Administration?

Join 45,000+ students at Networkers Home. CCIE-certified trainers, 24x7 real lab access, and 100% placement support.

Explore Course