Table of contents
1.
Introduction
2.
About Linux
3.
ip Command
3.1.
Syntax
3.2.
Examples
4.
nslookup Command
4.1.
Syntax
4.2.
Examples
5.
nmcli Tool
5.1.
Syntax
5.2.
Examples
6.
ping Command
6.1.
Syntax
6.2.
Examples
7.
Frequently Asked Questions
7.1.
What are network troubleshooting tools in Linux?
7.2.
Which command is used to check network connectivity in Linux?
7.3.
Which command is used to check the DNS resolution in Linux?
7.4.
How to list all the available network connections in Linux?
8.
Conclusion
Last Updated: Mar 27, 2024
Easy

Network Troubleshooting Tools in Linux

Author Sohail Ali
1 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Troubleshooting is the process in which we analyse and solve a series of problems in the system. Similarly, network troubleshooting is the act in which we discover the issue and improve it with regard to its security, connectivity, and many more. It is the duty of sysadmins to perform this task regularly. Thus, it becomes important to know the correct tool to achieve the results in a faster and more accurate way.

Network Troubleshooting tools in Linux

In this blog, we will look at various network troubleshooting tools in Linux in detail. So without any further wait, let’s start learning!

About Linux

Linux was released by Linus Torvalds in the year 1991. It is an open-source operating system with a wide global user base. Linux is an operating system just like Windows, Mac, and iOS. It was created for personal computers but later used in mainframe computers, servers, etc. It is also used in routers, televisions, video recorders, smartwatches, etc.

linux

Some  features of linux operating system are:

  • Open-source
  • Security
  • Portability
  • Multitasking
  • Customised keyboard
     

Now, let us look at some of the most used network troubleshooting tools in Linux.

ip Command

The IP stands for Internet Protocol. It is a command in Linux which is available in net-tools. This command is used to show and manipulate devices, routing, and tunnels. It is an all-in-one command which can manipulate network objects on your Linux system.

Syntax

ip < object > [command]

 

Some of the most common objects used are:

  • link: It displays link layer information.
     
  • address: It shows all IP addresses of all network devices.
     
  • route: It is used to handle routing table entries.

Examples

Let’s now look at some examples around ip command.

Show all the IP addresses

In order to show all the IP addresses of all the associated devices, we can use the below syntax:

ip address

 

This will show the IP address of the interfaces on the system. 

show ip address

 

Show the IP address of a particular interface

To show the IP address of a particular interface, you can use the below syntax:

ip address show interface_name
show ip address of an interface

The link command will display the link layer information. It will fetch the information of networking devices which has a driver loaded.

 

Show the link status of networking devices

The command to show the link status of networking devices is:

ip link 
show link status

 

Show the statistics of network interfaces

To show the statistics of network interfaces, you can use the below command:

ip -s link
show statistics of network interface

 

Get information about a particular interface

You can get information about a particular interface by just adding a show command followed by the interface name.

information of particular interface

 

Display the routing table of your network

The route command will display the routing table of your network.

ip route
display routing table

The first entry is the default route of the network.

nslookup Command

The nslookup stands for Name Server Lookup. It is a command that fetches information from the DNS server. It is used to troubleshoot DNS-related issues.

To install it, use the below command:

Syntax

nslookup <options>

Examples

Display the IP address of the domain name

The nslookup followed by the domain name will display the IP address of the domain name. It will query the domain name servers and fetch you the result.

display ip address

 

Reverse DNS lookup

The above command performed a basic DNS lookup. Similarly, we can do a reverse DNS lookup by passing the IP address as the argument.

reverse dns lookup

 

View all the available DNS records

We can also view all the available DNS records using the following command:

nslookup -type=any <address>
view available dns records

nmcli Tool

The nmcli is a command-line tool that is used to control the network manager. It will allow you to view the device status, create, edit, and delete network connections, etc.

Syntax

nmcli <object> [command]

Examples

Check the device status

In order to check the device status, you can use the below command:

nmcli dev status
Check the device status

It will show the type and state of the connected device in columns.

 

View the active connections

To view the active connections on the device, use the below command:

nmcli connection
view active connections

 

View a specific connection

To view a specific connection, you can use the following command:

nmcli connection show enp1s3

 

This will show the status of the specified interface.

 

Display help-related information

You can also display help-related information in case of any problem.

display help information

ping Command

The ping stands for Packet Internet Groper. It is a command which is used to check the network connectivity between the host and the server. It takes the URL as input and sends data packets to the specified address, and gets back the response from the server.

Syntax

ping <hostname>

Examples

Control the ping number

The above command will ping the host and send packets to it continuously. To control the pink number, you can use the -c option followed by the number of pings.

control ping number

Here, the min, avg, and max are the minimum, average, and maximum time to get the response.

 

Change the default packet size

You can change the default packet size sent to the host using the -s option.

change default packet size

 

Change the default wait period

By default, the ping waits for 1 sec to send the consecutive packet. We can change this period using the -i option.

change default wait period

 

Completely stop the pinging

To completely stop the pinging after a specific duration, use the -w options.

completely stop pining

Here, we wanted to ping 5 times, but it happened only 3 times because, after 3 seconds, the ping was stopped due to the -w option.

Frequently Asked Questions

What are network troubleshooting tools in Linux?

In Linux, the network troubleshooting tools are the set of command line utilities that helps to diagnose and resolve network issues.

Which command is used to check network connectivity in Linux?

The ping command in Linux is used to check the connectivity to a specific domain name or IP address.

Which command is used to check the DNS resolution in Linux?

The nslookup command is used to query the DNS server and verify the domain name for a correct IP address.

How to list all the available network connections in Linux?

You can use the command nmcli connection show to list all the available network connections on your Linux system.

Conclusion

This article discusses the network troubleshooting tools in Linux. We discussed various commands available in Linux for network troubleshooting in detail. We hope this blog has helped you enhance your knowledge of network troubleshooting tools in Linux. If you want to learn more, then check out our articles.

Refer to our Guided Path to upskill yourself in DSACompetitive ProgrammingJavaScriptSystem Design, and many more! If you want to test your coding ability, you may check out the mock test series and participate in the contests hosted on Coding Ninjas!

But suppose you have just started your learning process and are looking for questions from tech giants like Amazon, Microsoft, Uber, etc. In that case, you must look at the problemsinterview experiences, and interview bundles for placement preparations.

However, you may consider our paid courses to give your career an edge over others!

Happy Learning!

Live masterclass