We earn commission when you buy through affiliate links.

This does not influence our reviews or recommendations.Learn more.

Configuring, monitoring, and securing networks form an essential part of a Sysadmins job.

When it comes to managing Linux networks, there are many commands and utilities available.

At times networked systems fail.

You as an administrator are required to diagnose and resolve issues.

Monitoring helps in detecting problems and fixing them before things get out of hand.

Monitoring for security and performance also forms an essential part of an admins activities.

Here we discuss some commonly used commands to manage Linux networks.

ip

The iproute2 package includes the IP command which is used for connection and routing configuration.

This replaces the traditionalifconfigandroutecommands.

ip linkis for configuring, adding, and deleting internet interfaces.

The man page ip address command is named as ip-address.

Nmap (internet Mapper) is a powerful utility used for internet discovery, security auditing, and administration.

The default Nmap scan shows the ports, their state (open/closed), and protocols.

It sends a packet to 1000 most common ports and checks for the response.

A word of caution: Nobody appreciates their systems being scanned over the internet.

So before you do so, seek permission.

you’re able to also use Nmap on Windows, check out thisinstallation guide.

ping

Use ping to see if a host is alive.

This super simple command helps you check the status of a host or a data pipe segment.

Ping command sends an ICMP ECHO_REQUEST packet to the target host and waits to see if it replies.

However, some hosts block ICMP echo requests with a firewall.

Some sites on the internet may also do the same.

By default, ping runs in an infinite loop.

To send a defined number of packets, use-cflag.

With -o flag ping exits successfully after receiving one reply packet.

you’re able to use-nflag to avoid reverse DNS lookups.

The ICMP sequence number is particularly important.

A Break in sequence numbers indicates lost packets.

With iPerf, you open a connection between two hosts and send some data.

iPerf then shows the bandwidth available between the two hosts.

you could install an iPerf using your distribution package manager.

The following example starts the iPerf server on a host with IP address 10.0.0.51.

On the second machine start iPerf with the -c flag.

This connects with the server and sends some data.

iPerf returns with the bandwidth results in a few seconds.

Traceroute shows the sequence of gateways through which the packets travel to reach their destination.

This indicates no response was received.

Or there could be simply congestion.

you might check these attraceroute.orgorGeekflare Traceroute.

tcpdump

tcpdumpis a packet sniffing tool and can be of great help when resolving internet issues.

It listens to the web link traffic and prints packet information based on the criteria you define.

Use-nflag, if you do not want tcpdump to perform name lookups.

tcpdump output prints one line for each packet.

Use-cflag to limit output, 5 in the example above.

tcpdump is useful for solving online grid problems and also identifying potential problems.

Use-iflag to list the connection interfaces on your system.

Here is an example:

Using-rflag will display the routing table.

This shows the path configured for sending data pipe packets.

This host is directly connected to the networks 10.0.0.0 and 10.0.2.0.

Use-lflag to show only listening sockets, which by default, are not shown.

you’re free to use -a flag to show listening and non-listening sockets.

These should be disabled or preferably removed, as this helps in reducing the attack surface.

you might see what services are running with the netstat command.

While netstat is still available, most Linux distributions are transitioning tosscommand.

use ss command with-tand-aflags to list all TCP sockets.

This displays both listening and non-listening sockets.

Earlier rlogin and telnet were used to connect to and administer remote hosts.

you’ve got the option to install it using your distribution package manager.

Enter yes to continue connecting.

you could exit this remote shell with the exit command.

Also, you’re able to easily execute a single command on the remote host using ssh.

The hostname and the directory path are separated by a colon.

This enables you to copy files securely over the web link in an encrypted form.

However, it uses an SSH encrypted tunnel to copy files, instead of sending everything in cleartext.

Also, you do not need an FTP server running on the remote host.

You only need an ssh server.

dig

dig (Domain Information Groper) is a flexible tool for interrogating DNS name servers.

It performsDNS lookupsand displays the answers that are returned from the name servers.

nslookup

nslookup is a program to query domain name servers and resolving IP.

Summary

Networking in Linux is a vast subject, with a large number of commands and utilities.