August 4, 2017

10 Linux Network Troubleshooting Commands

Updated by subhakaran Nitijanandhan

1.    PING-  to check network connectivity:

Ping is one of the widely used Linux network commands in network troubleshooting. It checks the availability of the network. It works by sending an ICMP echo request to check the connectivity of the network. Until you interrupt, the ping command will keep executing. However, you can restrict the number of echo requests.
linux network commands


2.    tcpdump- packet analyzer:

it is considered the most powerful command line  tool  which is used to capture or filter TCP /IP and other packets that are being received or sent over an IP Network on a particular  interface of the switch or router. This access to the packets can be of immense importance when troubleshooting the network. You can capture packet from the specific port. The other option given by it is that it enables the user to save captured packets to a file that can be used in future for analysis. The file is saved in pcap format, that can be accessed by tcpdump command.  Another open source GUI based most powerful tool called Wire shark which also reads tcpdump pcap format files.

3.    Ifconfig:

It is used for displaying current network configuration number, setting up an IP address, netmask or broadcast address to a network interface. Additional network interfaces can be configured using alias feature. Using this command interface can be enabled and disabled on demand. Maximum Transmission Unit size can also be altered with the help of this command. Besides, by setting interface in promiscuous mode inconfig will enable you in receiving all packets irrespective of particular NIC.

4.    Traceroute command- diagnose Network Latency

With the help of this, you can find the number of hops required for a particular packet to reach the destination. It will provide names and identity of every device on the path and also report network latency. Besides, it will identify the device responsible for latency.

5.    DIG (Domain Information Grouper) command:

If you have DNS related query dig command will help you by providing DNS related information like A Record, CNAME, MX Record etc. A better understanding of DNS topography is possible with dig command. Dig command when used with the domain name will display record for that particular domain name.

6.    Host command:

DNS lookups can be performed with this host command. Its normal usage includes converting domain names to IP address

7.    IWCONFIG command:

This command is similar to ifconfig, but it configures a wireless network interface. It helps in setting the parameters of the network interface which are specific to the wireless operation, for instance, the wireless frequency. It may also be used to display those parameters and the wireless statistics. Basic Wi-fi details like SSID channel and encryption can be set using this command. Other advanced settings like receive sensitivity, RTS/CTS, fragmentation and retries can also be viewed and altered accordingly.

8.    ETHTOOL command:

Ethernet device parameters can be viewed and altered using this command. Ethernet card properties such as speed, wake on, duplex and the link detection status can be displayed with this. This command also enables you to alter the speed of Ethernet device to work with some specific network devices. However, the newly assigned speed should be within the limited capacity. On changing the speed when the adapter is online, the adapter will go offline automatically and in order to bring it online ifup command is used.

9.    HOSTNAME command:

It will enable you to view and change the hostname or NIS domain name for the system. These names enable the networking program to identify the machine. It is to be noted that only the super-user/root can change the names. The hostname is temporary and it will not be used after rebooting the system. In order to change it permanently modify the /etc/hostname file.

10.    NETSTAT command:

Both incoming and outgoing network connections can be monitored using this command. It also allows to view routing tables, interface statistics etc. It proves to be very useful in Linux network troubleshooting and determine traffic performance. It is one of the most commonly used network service debugging tool and will also tell you about the ports that are open and whether any programs are listening on ports.