Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.

CompTIA Linux+ XK0-005 - 1.5 - Interface Management: iproute2 Tools

In Linux, interface management involves configuring and managing network interfaces on your system. This includes tasks such as assigning IP addresses, configuring network routes, enabling or disabling interfaces, and monitoring network connections. The iproute2 tools, specifically the ip and ss commands, provide powerful capabilities for managing network interfaces and networking in general.

ip Command

The ip command is a versatile utility that allows you to perform various network-related tasks. Here are some common use cases:

  • Viewing Interface Information: To view detailed information about network interfaces, use the ip addr show command. It displays the IP addresses, network masks, MAC addresses, and other relevant details for all available interfaces.

    ip addr show

    Sample Output:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 00:0c:29:4b:6d:ee brd ff:ff:ff:ff:ff:ff
        inet brd scope global dynamic noprefixroute eth0
           valid_lft 85748sec preferred_lft 85748sec
        inet6 fe80::20c:29ff:fe4b:6dee/64 scope link noprefixroute
           valid_lft forever preferred_lft forever
  • Configuring IP Addresses: You can use the ip addr add command to assign an IP address to a network interface. Specify the interface name and the IP address followed by the network mask.

    sudo ip addr add dev eth0
  • Bringing Interfaces Up or Down: The ip link set command allows you to bring an interface up or down. Specify the interface name and the desired state (up or down).

    sudo ip link set eth0 up
  • Managing Routes: Use the ip route command to manage network routes. It allows you to add, delete, or modify routes on your system.

    sudo ip route add via dev eth0

ss Command

The ss command is a powerful tool for displaying detailed information about network sockets and connections. It provides a comprehensive overview of active network connections, listening ports, and other socket-related information.

  • Viewing Established Connections: To view established connections on your system, use the ss -t command. It displays TCP connections, including the local and remote addresses, state, and process information.

    ss -t

    Sample Output:

    State   Recv-Q   Send-Q      Local Address:Port     Peer Address:Port   Process
    ESTAB   0        0 
  • Monitoring Network Connections: The ss -s command provides a summary of network socket statistics, including the number of established connections, listening sockets, and other useful metrics.

    ss -s

    Sample Output:

    Total: 100 (kernel 120)
    TCP:   50 (estab 2, closed 48, orphaned 0, synrecv 0, timewait 0/0), ports 0
    Transport Total     IP        IPv6
    *         120       -         -
    RAW       0         0         0
    UDP       2         2         0
    TCP       49        47        2
  • Filtering Connections: You can use the ss command with various options to filter and display specific types of connections. For example, ss -t state established shows only established TCP connections.

    ss -t state established

    Sample Output:

    State   Recv-Q   Send-Q      Local Address:Port     Peer Address:Port   Process
    ESTAB   0        0    -


Proper interface management and network monitoring are essential skills for Linux administrators. The iproute2 tools, including the ip and ss commands, offer a robust set of features for managing network interfaces, assigning IP addresses, configuring routes, and monitoring network connections. By mastering these tools, you can efficiently manage your network interfaces, troubleshoot connectivity issues, and optimize network performance. Remember to consult the command documentation (man ip and man ss) for more options and advanced usage. With practice and experience, you will gain confidence in managing networking tasks on your Linux system.

Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.