The Ubuntu server provides tons of utilities to ease network monitoring and administration.
Step 1 : We will start with a commonly used command, that is, ifconfig. You will need to install net-tools.
We mostly use this command to read the network configuration details such as the IP address.
Step 2 : If you are only interested in quick network statistics, use ifconfig with flag -s
Step 3 : Another commonly used command is ping. It sends ICMP requests to a specified host and waits for the reply.
Step 4 : Next, comes netstat. It is mainly used to check network connections and routing tables on the system.
Step 5 : Another command, lsof, gives you a list of all open files. It includes the files used for network connections or sockets
Step 6 : Next, we will look at a well-known tool, tcpdump. It collects network traffic and displays it to a standard output or dump in a file system
When no interface is specified, tcpdump defaults to the first configured interface
Step 7 : Next, to get statistics of network traffic, use the command sar.
Step 8 : There is one more utility named collectl. you will need to separately install this command as well:
Use collectl with the -s flag and value sn to get statistics about the network.