If you think that your network connection have an issue, and you don’t know what cause the issue, you can run some simple commands to exclude some common problems.

If you think that the problem is caused by your network card, you can run a simple ping command against your localhost (no internet connection is required). If your packets do not get lost, that’s mean that your hardware (network card) is more likely OK and you should look elsewhere.

ping localhost
Troubleshoot network connection

You can also run the same test to some external domain name to see if it is accessible.

ping google.com
Troubleshoot network connection

In the image above, you see the connection time presented in milliseconds. If your packets do not get lost, like in the example above Lost = 0 you can surly assume that you are connected to the Internet.

If your connection is slow, or you were not able to connect to internet, you can try to troubleshoot the connection using another tool: On Windows tracert <domain name or IP> on Linux and Mac use traceroute <domain name or IP>.

This tool returns each router IP on the way to reach the designated domain name / IP. Not only it will show you the path it takes to reach the target machine, but it also will show you the time I take to reach each router.

This is very useful to investigate any bottleneck on the network.

# on Windows run 
tracert google.com

# on Linux or Mac run
traceroute google.com
Troubleshoot network connection is your router getaway, then you will see your IP address assigned to your router by your ISPS provider (usually dynamic IP, unless you are paying for a static IP). Then you get IP of other routers on the network that make your way to the server on which you are served with google.com website. If you run on a local network, this will also be shown on the above routing path.

On Windows, this tool is already pre-installed. Open PowerShell terminal and run the above.

If not present on Linux, you can install this utility using sudo apt install inetutils-traceroute for version 2 and sudo apt install traceroute for version 1.

Troubleshoot network connection

Other resources

Would love your thoughts, please comment.x