linux network troubleshooting commands

The 9 Best Linux Network Troubleshooting Commands

A community administrator’s routine tasks like administration, monitoring, configuration, and troubleshooting do not require you to study difficult third-party instruments. As a substitute, you may carry out all these duties with available instruments that come pre-installed with most Linux distributions.

This text focuses on the community troubleshooting a part of a community administrator’s tasks and covers instruments that resolve these points underneath totally different classes. It additional covers how these utilities assist in sensible situations.

1. ifconfig

ifconfig is a command-line utility recognized for interface configuration in Linux/Unix working methods. Community directors additionally use it to question and handle interface parameters with the assistance of configuration scripts.

It helps you allow or disable a community interface and lets you assign an IP handle and netmask to the chosen interface. It’s also possible to view all of the accessible interfaces, IP addresses, {hardware} addresses, and most transmission unit measurement for energetic interfaces.

You possibly can activate/deactivate any interface through the use of up/down parameters, as follows:

sudo ifconfig up eth0
sudo ifconfig down eth0

To assign an IP handle to an interface:

sudo ifconfig eth0 netmask

Nevertheless, this utility will not be available in Linux distributions, and it’s possible you’ll obtain an error “ifconfig: command not discovered“. You possibly can resolve the difficulty by putting in the net-tools package deal utilizing your distribution’s package deal supervisor.


On Ubuntu/Debian:

sudo apt-get set up net-tools

On Fedora, CentOS, and different RPM-based distros:

yum set up net-tools

On Arch Linux:

sudo pacman -S net-tools

2. ip

ip is a substitute for the great previous ifconfig. Nevertheless, the scope of its performance covers two layers of TCP/IP protocol, the Information Hyperlink layer and the Community layer.

It shows community interfaces and configures community gadgets, similar to the ifconfig utility. It additionally exhibits and modifies the kernel routing tables with the addition/elimination of ARP cache entries.

To show all interfaces and their particulars:

ip addr present

So as to add and take away interfaces:

ip a add dev eth0
ip a del dev eth0

To allow/disable ARP protocol for the interface, use the on/off choices:

ip hyperlink set dev eth0 arp on
ip hyperlink set dev eth0 arp off

3. ping

The ping utility helps you determine the provision of a community and host. It checks if the host is reachable or if a service is operating. It’s also possible to test for community connectivity points like excessive latency and package deal drop utilizing the ping command.

ping sends ICMP (Web Management Message Protocol) echo request messages and waits for the ICMP echo reply packets to test host availability. The output accommodates the entire despatched and acquired messages with the time a packet takes to succeed in its vacation spot.


4. netstat

netstat is a command-line utility that helps uncover linked and listening TCP, UDP, and UNIX sockets. It shows details about routing tables, listening ports, and knowledge statistics.

You possibly can record each listening or closed connections by typing:

netstat -a

To record solely listening TCP connections:

netstat -tl

Netstat Active TCP
Creator’s Screenshot

It additionally lets you record the PID of the processes and program names utilizing TCP connections:

netstat -ptl 

5. host

host is a minimal but strongest CLI utility that performs DNS lookups and resolves hostname to IP addresses and vice versa. Along with troubleshooting DNS server issues, it additionally shows and verifies NS and MX DNS document varieties and ISP DNS servers.

To search out NX for the Google web site:

host -t ns

It’s also possible to discover MX data by operating:

host -n -t mx

6. arp

The arp command manipulates the cache of the system ARP desk by including/deleting addresses and displaying them. ARP stands for Handle Decision Protocol and maps the IP handle to the machine’s MAC handle. Therefore, the arp command performs the duty and belongs to the instruments accessible contained in the net-tools package deal.

Run the command with none parameters to view the desk content material:


Arp Command
Creator’s Screenshot

It’s also possible to discover the MAC handle mapped to a selected IP by offering the IP handle:

arp <ip_address>

7. traceroute

As soon as the ping utility offers details about the community connectivity and the general time a packet takes to succeed in the vacation spot, you need to use the traceroute command to determine in-depth element of the trail the packet takes to the vacation spot host and resolve that problem.

The output shows the packet route and all of the intermediate hosts between the supply and vacation spot with their response time.

As an example, the next command outputs all of the hops to the vacation spot host (Google) from the native machine:


The utility makes use of the time-to-live (TTL) area of the IP packet, which tells about its life within the community because it decreases a digit when the packet reaches the hop.

The utility additionally makes use of the idea of round-trip-time (RTT), which ensures that every intermediate node drops the packet and sends again the ICMP error message that helps traceroute in measuring the time a packet takes to succeed in every hop alongside the way in which.

This performance helps community directors to determine the foundation reason for web connectivity points and resolve the precise downside within the route.

8. dig

dig, an acronym for Area Info Groper gathers DNS-related data and troubleshoots DNS issues.

The dns command output shows data accessible inside recordsdata containing DNS data and helps community directors confirm if the host to IP handle identify decision is working advantageous.

You possibly can carry out the DNS lookup question as follows:


Equally, you may question all kinds of DNS data related to a site with the assistance of the ANY choice:

dig ANY

9. Wireshark

Wireshark is a robust and versatile open-source packet analyzer software. It captures the site visitors out of your chosen interface card in real-time. It permits community directors to seize site visitors primarily based on protocol/port for monitoring and troubleshooting functions.

Aside from the seize filter, it additionally has a show filter with numerous choices that enable you view the site visitors of concern.

Troubleshooting Networks on Linux

Community troubleshooting is a part of the day-to-day actions of a community administrator. Figuring out which software to make use of within the absence of 1 or with a broader performance is equally vital for efficient troubleshooting of quite a lot of community circumstances.

You possibly can study extra about analyzing community site visitors with Wireshark and community connections with the ss command.

a socket and a plug
The way to Monitor Community Connections on Linux With ss

In the event you suspect a community problem in your Linux system, here is the right way to hint and troubleshoot it with the ss command.

Learn Subsequent

About The Creator

1 thought on “The 9 Best Linux Network Troubleshooting Commands”

  1. Pingback: 6 Linux Security Tips to Reduce System Vulnerabilities - OnlinePixelz

Leave a Comment

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