Most Linux systems are connected to a network as a client system, or to provide services to other systems. Knowing how to configure, monitor, and audit the network configuration is more than useful. In this section we look at the available options.

Network configuration

The system itself can’t talk with other systems if it doesn’t have any protocol to communicate. Nowadays that is mostly IP . The local configuration for the network is usually stored in /etc/network or in a network manager in /etc.

Common components that help with managing the network configuration, include:

  • Netplan
  • networkd
  • NetworkManager

Good to know: Netplan uses a backend like networkd or NetworkManager to apply the configuration.

IP address information

To retrieve existing network information and IP in particular, we use the ip command. As this command has several subcommands, we use address in this particular case.

ip address

This output might include:

  • Link name
  • Status
  • MTU size
  • MAC address
  • Any alternative name (alias)
  • IP address and netmask
  • IPv6 information

Gateway or router

To connect to systems outside the network, we use a gateway. This is a (virtual) router to move network packets between different networks. To see routing information, we can use the route subcommand.

ip route

DNS servers

To translate between host names and IP addresses, we use DNS . The servers to be used are typically configured within the network manager. In some cases they are defined directly in /etc/resolv.conf. In the past, this was the common way to do this, but that is changing. Still, it is good to check the configuration and see what is defined.

cat /etc/resolv.conf

When using systemd, you might even see the DNS server pointhing to a local address like, meaning it uses a local service.

resolvectl status

Relevant networking commands

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

Frequently Asked Questions

How to see the number of open connections?

ss --summary

» Full answer and more examples

How to see active connections and bandwidth usage?


» Full answer and more examples

How to clear the DNS resolver cache with systemd?

resolvectl flush-caches

» Full answer and more examples

How to show network TCP connection statistics and counters?

nstat --reset Tcp*

» Full answer and more examples

How to see errors on dropped packets on a network interface on Linux?

ip -stats link show ens18

» Full answer and more examples

How to see the default gateway on Linux?

ip route

» Full answer and more examples

How to see which process is using a port?

ss --listening --numeric --processes sport :PORTNUMBER

» Full answer and more examples

How to show open network ports such as TCP and UDP?

ss -plunt

» Full answer and more examples

How to see the TTL value of a DNS record?

dig +noall +answer +ttlunits RECORD HOST

» Full answer and more examples

See all frequently asked questions for Networking