5 Linux commands for troubleshooting connectivity issues

Digital Zoo/Getty Pictures

Fashionable community connectivity is mild years forward of what it as soon as was. Regardless that it is rather more dependable than it was within the Nineteen Nineties, points nonetheless come up — which is why I am glad that Linux features a bevy of instructions I can use to begin troubleshooting the issue.

Additionally: The first 5 Linux commands every new user should learn

Listed below are the 5 instructions I flip to first.

1. ip

The ip command is not simply a straightforward approach to uncover your laptop’s IP tackle (ip a will do the trick), nevertheless it’s additionally able to troubleshooting connectivity. For instance, I can examine the standing of all my community units with the command:

The output of the above command shows the identify of your community system, the MTU pace, the configuration choices utilized, and the IPv6 tackle of your connection. You can even begin and cease community units with ip hyperlink, like this:

sudo ip hyperlink set wlp15s0 down
sudo ip hyperlink set wlp15s0 up

You can even view the routes outlined in your machine with:

From that command, you may see the default route, the configurations utilized, and the subnet of your community.

2. nslookup

The nslookup lets you troubleshoot DNS identify decision. As an example you are attempting to achieve a web site and it isn’t developing. Is it a neighborhood or distant situation? 

Additionally: Vanilla OS Orchid improves on an already brilliant Linux distribution

To begin troubleshooting, situation the command:

In case you obtain a solution (which is able to embody the location’s IP tackle), likelihood is fairly good the issue is native, and you may focus your troubleshooting efforts in your laptop or your LAN. If you don’t obtain a solution, the issue is distant, and there is not a lot you are able to do (apart from watch for the location to return again up).

You can even run a reverse DNS lookup by utilizing the IP tackle, like this:

On this case, IP is the IP tackle. This command will show the host of the IP tackle (equivalent to googleusercontent.com).

3. ss

The ss command changed the deprecated netstat package deal and supplies detailed data as to how your laptop communicates to different units, networks, or providers. This command’s foremost performance is to dump socket statistics and show extra TCP and state data than different instruments. 

In case you situation the ss command with out choices, it would checklist all non-listening sockets with established connections. In different phrases, you may see each system with a longtime connection to your laptop. This may be very useful when looking for out what machines and/or ports are speaking together with your desktop or server. 

Additionally: 5 Linux terminal apps that are better than your default

The output additionally contains the variety of despatched and obtained packets, so for those who see an inventory with an unusually excessive quantity of despatched or obtained packets, that may very well be an issue. You can even checklist solely connections to a particular IP tackle. As an example you think an IP tackle is sending and/or receiving too many packets to your machine. You may examine that with:

As soon as once more, IP is the IP tackle. You see an inventory of the community ID, state, obtained packets, despatched packets, native tackle port, peer tackle port, and course of.

4. tracepath

The tracepath command shows the community connectivity path between native and distant hosts and identifies all routers used to make the connection. If you’re unable to make a connection to a web site, situation the command:

Right here, SITE is the area or IP tackle of the location in query.

The output of the command will checklist all hops between native and distant machines. In case you see machines in that path posting a no reply, that may very well be the place the issue lies. 

The good factor about tracepath is that it lists all IP addresses of the machines routing the packets out of your native host to the distant. The utmost variety of hops tracepath will try is 30. You may change that utilizing the -m choice, like this:

SITE is the location in query. You most likely would by no means must examine 50 hops, however you possibly can if wanted.

5. ping

That is all the time the primary command I exploit when networking issues come up. If my community appears down, I am going to situation the command:

If the command works, then the difficulty isn’t DNS-related. 

Additionally: How to replace Windows with Linux Mint on your PC

I exploit the ping command both after I suspect my native community is down or when a web site is down. If I obtain a response, I transfer on to different troubleshooting efforts.

These 5 Linux instructions ought to enable you to troubleshoot any networking points. To seek out out extra bout these instructions, make certain to learn the person web page for every (equivalent to man ip, man nslookup, man ss, man tracepath, and man ping).

Sensi Tech Hub
Logo