Skip to content

Networking

Use the ip command to inspect network interfaces.

ip a
ip link show

To show statistics about network performance:

ip -s link show enp1s0

To test connectivity use the ping command:

ping 192.168.122.10

To show the IPv4 routing table:

ip route

Use traceroute or tracepath to trace network traffic takes to reach a remote host through multiple routers:

tracepath www.google.com

Use the ss command to display socket statistics. The ss command is meant to replace the older tool netstat:

netstat -an | grep LISTEN
ss -ta

NetworkManager is a daemon that monitors and manages network settings. Command-line and graphical tools talk to NetworkManager and save configuration files under /etc/sysconfig/network-scripts.

Use the nmcli utility to create and edit connection files from the command line.

nmcli dev status
nmcli con show
nmcli con show --active

Use the nmcli con add command to add new network connections.

nmcli con add con-name enp9s0 type ethernet ifname enp9s0
nmcli con add con-name enp10s0 type ethernet ifname enp10s0 ipv6.address fe80::b608:7af5:c9d3:fa66/64 ipv6.gateway 2001:1:1:1443::400 ipv4.address 192.168.122.120/24 ipv4.gateway 192.168.122.1

The nmcli con up name command activates the connection, the nmcli con down name and the nmcli dev dis device to deactivate a network interface.

nmcli con reload
nmcli con up enp10s0

By default, changes made with nmcli con mod name are automatically saved to /etc/sysconfig/network-scripts/ifcfg- name. It is possible to configure the network by directly editing the connection configuration files.

Example:

DEVICE=enp1s0
NAME="enp1s0"
BOOTPROTO=none
IPADDR0=192.168.122.8
PREFIX0=24
GATEWAY0=192.168.122.254
DNS1=192.168.122.254
ONBOOT=yes

Summary

The TCP/IP network model is a simplified, four-layered set of abstractions that describes how different protocols interoperate for computers to send traffic from one machine to another over the Internet. NetworkManager is a daemon that monitors and manages network configuration. Use the nmcli command for configuring network settings with NetworkManager.

Command References:

ip, ping, tracepath, traceroute, ss, netstat, NetworkManager, nmcli.