Networking
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 127.0.0.53, 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.
- cat
- ip
- resolvectl