Network

Network connectivity starts at a device that links the system to a network, and for Linux systems that is no different. Depending on the physical layer, such as Ethernet of Wi-Fi, the transactions between be better or worse. Besides physical limitations, there is congestion and packet loss that may introduce issues. In this section we look at troubleshooting network performance issues, tooling, and examples.

Interfaces

The first step is to learn what links we have towards the network.

ip link

IP addressing and routing

Most of the communications is using IP , so it makes sense to learn first what IP address(es) is assigned to this system. With the address subcommand, this information can be easily retrieved.

Find IP addresses:

ip address

To learn how traffic is routed, use the route subcommand.

ip route

Is the gateway reachable?

ping 192.168.1.1

Name resolution

Using DNS we can translate between host names and IP addresses. Look up the active DNS resolver using /etc/resolv.conf or for systemd-based systems using the resolvectl.

Retrieve the status:

resolvectl status

Where normally the name servers were used in order, the systemd resolver performs a smart guess. An IP address in the list that is closer to the client system, has a higher chance to be selected.

Dropped packets

Many dropped packets might be a good indication of issues on the network or locally. To see if this is the case, query the statistics of the link.

ip -stats link show

Errors and failures

nstat --reset | grep -iE 'drop|error|fail|timeout'

Got more useful commands to help troubleshooting performance issues on the network? Contribute and make this article better.

Active connections and bandwidth usage

If performance issues occur during network congestion, it may be useful to check the active connections. This can be using iftop, which also can show bandwidth usage.

iftop

The command can use filters to quickly zoom into a specific type of traffic. See the command page for more details.

    Relevant network commands

    Like to learn more about the commands used in this section? Have a look at the cheat sheets or the related command page.