TCP/IP Configuration  «Prev  Next»

Lesson 6 Listing configuration interfaces
Objective Use ifconfig command to list all currently configured interfaces on system

Listing Linux Configuration Interfaces using iproute2

The `iproute2` suite is a collection of utilities for network management and configuration in Linux, central to which is the `ip` command. This suite supersedes the older `net-tools` package (which included commands like `ifconfig`, `route`, `netstat`, etc.) and provides a more powerful and consistent interface for network configuration. The `ip` command within the `iproute2` suite is designed to manage both network interfaces and routing tables, along with various other network-related tasks.
Purpose The primary purpose of the `iproute2` suite, and the `ip` command specifically, is to offer administrators a unified toolset for network layer configuration and management. It encompasses tasks related to IP addressing, routing, link layer configuration, neighbor discovery, and tunneling, among others. This consolidation into a single toolset simplifies the complexity of network management, enabling more efficient and comprehensive control over network resources.

Function of the `iproute2`command

The `ip` command's functionality can be broadly categorized into several key areas:
  1. Interface Configuration: The `ip` command allows for the configuration and management of network interfaces. This includes bringing interfaces up or down, assigning IP addresses, setting MTU sizes, and configuring other interface-related parameters.
    ip link set dev eth0 up  # Bring up the eth0 interface
    ip addr add 192.168.1.10/24 dev eth0  # Assign IP address to eth0
    
  2. Routing Management: Routing tables are crucial for directing traffic to its intended destination. The `ip` command provides extensive capabilities to view, add, and delete routing table entries, enabling precise control over network traffic paths.
    ip route show  # Display the routing table
    ip route add default via 192.168.1.1  # Set the default gateway
    
  3. Neighbor and ARP Management: Managing ARP (Address Resolution Protocol) tables and neighbor relationships is essential for the resolution of IP addresses to MAC addresses on a local network. The `ip` command facilitates the viewing and manipulation of these tables.
    ip neigh show  # Show neighbor (ARP) table entries
    
  4. Traffic Control and QoS: `iproute2` includes utilities for traffic shaping, scheduling, and quality of service (QoS) management. These tools allow administrators to control the flow of traffic on the network, ensuring optimal performance and prioritization of critical services.
  5. Tunneling and IPsec: For secure and specialized network connections, the `ip` command supports the configuration of tunneling protocols and IPsec for encrypted communications.
  6. Multicast Management: The suite provides tools for managing multicast configurations, important for applications that require efficient delivery of data to multiple recipients.
  7. Monitoring and Diagnostics: Beyond configuration, the `iproute2` suite offers capabilities for monitoring the state of the network, interfaces, and routing, aiding in diagnostics and troubleshooting.

In summary, the `iproute2` suite, through the `ip` command, serves as a comprehensive tool for network administrators, providing a wide range of capabilities for interface configuration, routing management, and various other network functions. Its extensive feature set and unified approach make it an indispensable resource in modern Linux network administration.


Use the Legacy ifconfig command to list all currently configured interfaces

How do I use the ifconfig command to list all currently configured interfaces on the system? Now that you have seen which network interfaces are available on your system, you can learn how to configure them. To configure a TCP/IP network interface, you must program it with its IP address and netmask. The command for working with network interfaces under UNIX is ifconfig. The ifconfig command has three purposes: listing configured interfaces, bringing interfaces up and down, and setting the IP address and netmask. Legacy: If run with no arguments, ifconfig will list all currently configured interfaces on the system and basic status information about each interface.

`ifconfig` command has been deprecated in Linux

The `ifconfig` command has been deprecated in Linux. The `net-tools` package, which includes `ifconfig` among other traditional networking tools, has not been actively developed for many years. Modern Linux distributions have largely replaced `net-tools` with the `iproute2` suite, which provides the `ip` command for network interface and routing configuration. The `ip` command offers more comprehensive functionality compared to `ifconfig` and aligns better with modern networking standards and protocols. It is capable of handling more complex tasks such as managing IP addresses, routes, link parameters, and more, with a more consistent syntax.
Linux administrators are encouraged to use the `ip` command and other tools from the `iproute2` suite for network management tasks. For instance, to display network interfaces, instead of `ifconfig`, the `ip` command equivalent is `ip addr show` or `ip link show`. While `ifconfig` is still available in many Linux distributions for backward compatibility, its usage is discouraged for new deployments or scripts. Users should familiarize themselves with the `ip` command and transition their workflows to utilize the `iproute2` utilities for more robust and future-proof network management.


PPP interface - Listing Configuration Interfaces

The following diiagram below examines the output from a Linux machine, which shows a configured PPP interface.
Linux Machine Output
Linux Machine Output

  1. The link-layer protocol (Point-to-Point Protocol=PPP)
  2. The IP address of the two ends of the PPP connection (128.248.9.157 and 128.248.9.13, respectively)
  3. The netmask (255.255.0.0)
  4. The interface status, plus other flags (UP, RUNNING, POINTTOPOINT)
  5. The maximum transmission unit (MTU), which is the largest link-layer frame the protocol supports (1500 bytes)
  6. The metric, an artificial number representing the distance between the two ends of the connection. The metric is used by the routing protocols.
  7. Statistics on packets received (RX)
  8. Statistics on packets transmitted (TX)

Solaris Command

The Solaris version of this command is slightly less informative, and requires the option -a.
The following example contains the list config.
listconfig consisting of lo0: and hme0:
listconfig consisting of lo0: and hme0:

In this example, we see two configured interfaces. The first, lo0, is the loopback address[1]. We can tell from its inet address of 127.0.0.1 and from the LOOPBACK flag shown.
The second, hme0, is an ethernet card with IP address 131.183.175.221, netmask ffffff00=255.255.255.0, and MTU 1500. (Notice that in this example, Solaris ifconfig does not report the ethernet address of hme0. Some versions of Solaris ifconfig, however, will list ethernet addresses, so your listing may differ slightly.)

Bringing Interfaces up and down

The ifconfig command may be used to activate and deactivate a network interface. For example, to toggle the state of the eth0 device, use:
host# /sbin/ifconfig eth0 down
host# /sbin/ifconfig eth0 up

Note that root permissions are necessary to bring an interface up or down.

Configuring Interface - Quiz

Click the Quiz link below to take a short multiple-choice quiz on configuring an interface.
Configuring Interface - Quiz

[1] Loopback address: 127.0.0.1. This address is used for diagnostics.

SEMrush Software