Connect with us


10+ Network Commands in Linux for Troubleshooting [2023]

Let’s Learn Network Commands in Linux with Practical Examples :

Computers use networks to communicate and share information with other resources. A computer network comprises two or more computers connected through different devices to complete the connectivity. It is the task of a System Administrator to set up and maintain the several functions within the network. We are going to look at 10 commonly used Network Commands in Linux for both network configuration and troubleshooting.

1. IFCONFIG (interface configurator)

Ifconfig is a Network Commands in Linux used to check network interface configurations. The common application of this command is to check the IP address assigned to the system. You can also use this command to enable or disable a network interface. This single command also gives in details the Hardware or MAC address and the MTU –maximum transmission unit.

In the example above the IP address (inet addr) is:, the MAC address (HWaddr) is: 0b4:99:ba:e8:34:f4
The ifconfig takes several options, using the ifconfig option will give the status of the interface whether it is enabled or disabled. For example.

Other uses of the ifconfig command are as follows:

Assigning IP Address and netmask

For example,

Enabling or disabling a network interface

Enabling a network interface:

Disabling a network interface:

Please note that eth0 can be replaced by the interface name assigned to your machine, in my case it is enp0s25

Setting the MTU size (the default value of MTU is 1,500)

Where xxx is the numerical value assigned

Finally, to set the network interface to receive all packet and check later you set it in promiscuous mode as follows:

The above command requires superuser privileges.

2. PING (Packet Internet Groper Command) Command

The best way to analyze network connectivity between two communication interfaces. PING works in any network setup whether it is a LAN or WAN. The protocol used by PING is called the ICMP (Internet Control Message Protocol) to send between nodes.

OR using a host name

When executed in Linux, PING command will not stop until you issue the interrupt command using the –c option. Using a number N will issue an interrupt after N PINGs.


Traceroute is used to trace the network path by showing the number of hops taken to reach its destination. This example shows the path taken by the global DNS Server IP Address tracing its path and destination.

4. NETSTAT (Network Statistics)

Display information on the connection and routing table. Displaying the routing table data add the –r option.

Using the –r Option

5. DIG (Domain Information Groper)

This command will query for DNS related data such as the A Record, MX record, CNMAE, etc.


Is also another command used to query the DNS. This example queries the domain name server.


This command is used to show the IP routing table. Using it will give you the default routing table.

The command can also add, delete, and set the default gateway as follows:

Adding Routes

Deleting Routes

Setting the default gateway


The host command is used to find the name of associated to a particular IP address or an IP associated to a specific IP. The HOST command searches in the IPv4 or IPv6 and the DNS records.

9. ARP (Address Resolution Protocol)

System administrators use this command to view or add the contents of a kernel to the ARP table. The default table is viewed by using it in the following format using the –e option


This command was known by the name mii-tool and later on changed to ethtool. The command is used to view Ethernet adapter settings. For example, to view adapter settings for eth0, run

Settings for eth0:

To display device driver run

Sample output

The above Network Commands in Linux should be able to help you troubleshoot your network issues by gathering network information and diagnose an impending problem. This article is meant for use on a day to day for Linux Network Administrator or anyone used to the Linux operating system.

Continue Reading
1 Comment

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *