Best Windows 10 commands to diagnose your Internet connection

Diagnosing an Internet connection in Windows can be a frustrating experience. To help with this, we have outlined six Windows 10 commands that you can use to troubleshoot your Internet connection and help determine why you cannot reach a website.

All of the commands we list below require you to execute them via the Windows 10 command prompt.

To access the command prompt, click on the Start button, type cmd, and click on the ‘Command Prompt‘ search result when it appears.

Windows 10 will now open the Command Prompt and wait for commands that you type in and then press enter on your keyboard to execute.

Windows 10 Command Prompt
Windows 10 Command Prompt

The commands below are found in older versions of Windows, and their instructions are almost identical, but our additional instructions focus on Windows 10.

Nslookup

When connecting to a website, you enter a textual URL such as https://www.google.com. However, when your browser connects to the hostname, www.google.com, it must first convert it into an IP address by querying your configured DNS servers.

If your DNS servers are not working or are returning wrong information, your computer will not be able to connect to requested websites and network resources.

To diagnose these issues, you can use the nslookup utility to convert a domain into an IP address.

For example, if you wanted to see the IP addresses associated with www.google.com, you would open the command prompt and enter the nslookup www.google.com command, as shown below.

Looking up the IP address for www.google.com
Looking up the IP address for www.google.com

When using nslookup, the command will return both an IPv4 and an IPv6 address. We are only concerned with the IPv4 IP address.

If your existing DNS servers are not responding or returning an IP address for websites, your issues may be DNS-related.

To fix this, try different DNS servers, such as the public Google and Cloudflare DNS servers, and see if they resolve your issues.

To do this, please follow these steps:

  1. Click the Start button and type Network Status. When the Network Status result appears, click on it to open the screen.
  2. At the Network Status screen, click on Change adapter options.
  3. Find your Ethernet or WiFi connection and right-click on it, and select Properties.
  4. Under “This connection uses the following items:”, double-click on the Internet Protocol Version 4 (TCP/IP) item to open it.
  5. Select Use the following DNS server addresses and enter either 1.1.1.1 (Cloudflare) or 8.8.8.8 (Google) as your preferred DNS server.
  6. Press OK and then OK again, and your Internet should work again.

Ping

The ping command allows you to check if you can connect to a hostname or an IP address and provide a basic measurement of the latency or lag between your connection and the remote device.

To use the ping command, simply open a command prompt and type ping [hostname] or ping [ip address] and then press enter. For example, to check if you can connect to www.google.com, you would type ping www.google.com and press enter.

Pinging www.google.com
Pinging www.google.com

As you can see from the above screenshot, when we pinged www.google.com, we received four replies from its IP address 172.217.12.196.

Each of those replies had roundtrip times of 3ms to 9ms, which is very fast. If you start seeing ping response times in the hundreds, this indicates a poor connection between you and the site.

In addition, the ping commands show that we sent four packets and received four back, with 0% lost. If you start seeing packet loss, then that is a good indicator of a connection problem.

Finally, if you use the ping command, and it shows ‘Destination host unreachable’ for each attempt, but other computers have no problem connecting to your network, then you have a network connectivity problem on your computer.

It should be noted that some networks block ping requests, so even if you do not receive a response, it does not definitively mean the remote device is not accessible.

Tracert

When you connect to a remote device, your requests travel through a series of different routers, called hops, before they make it to their ultimate destination.

If you are finding that your connection to a remote server is slow, you can use the tracert command to check which router along the way is slow.

When using the Windows tracert command (or traceroute in Linux), you will see each connection your request goes through before it reaches the final destination.

For each connection, tracert will display three response times so you can see how fast that particular connection is.

For example, you can use the tracert www.google.com command to see what connections your requests go through before reaching Google’s web server.

The fewer hops and lower the response time, the faster your connection is, as shown below.

Tracert showing little congestion to www.google.com
Tracert showing little congestion to www.google.com

However, if there are routing problems or you are using a VPN, you will find many connections with high latency between your computer and the remote device, indicating the connection is slow, as shown below.

Tracert showing a lot of congestiong to www.google.com
Tracert showing a lot of congestion to www.google.com

Unfortunately, routing congestion is not typically something you can fix, and you will need to wait until there is less traffic or the routing issue is fixed by the ISP providers.

PathPing

The PathPing command is an interesting utility as it combines both the ping and tracert commands into one tool.

Using this tool, you can check the route your request makes when connecting to a remote device and perform pings to each router to check if the device is reachable and how slow its response is.

To use the command, you would enter pathping www.google.com from the command prompt, as shown below.

Using the PathPing command on Windows 10
Using the PathPing command on Windows 10

While you may wonder why you would use ping or tracert over the pathping command, the latter takes much longer to finish. Therefore, the other tools may be better suited for quick tasks.

Telnet

If your Internet appears to be working correctly, but you have issues connecting to a particular website or service, you can use the Telnet command to check if that service is running on the remote host.

The telnet command is a utility that allows bidirectional communication between your computer and a remote device. Initially designed for remote console access to a server, Telnet can also be used to diagnose whether you can connect to a particular service running on a hostname.

When a server is running on a remote computer, it will listen on certain TCP ports, which you can Telnet to, and see if you can connect to the service.

Some of the more common ports you would check with Telnet are:

Service Name TCP Port
FTP 21
SSH 22
HTTP 80
HTTPS 443

For example, if you are want to check if a web server is listening on www.google.com, you can use the telnet www.google.com 443 command to connect to the webserver on port 443.

If a service is not running on the 443 TCP port, the Telnet program will state, “Connecting To www.google.com…Could not open connection to the host, on port 443: Connect failed”

However, if the service is running, you will see a blinking cursor indicating a connection exists.

Using Telnet to check if a web server is running
Using Telnet to check if a web server is running

Another example that shows a bit more detail is to check if an FTP server is running on TCP Port 21 on a remote host. For example, the command telnet speedtest.tele2.net 21 would show the following screen if the FTP service is running.

Using Telnet to check if a FTP server is running
Using Telnet to check if an FTP server is running

Telnet is not installed by default in Windows 10 but can be installed from the ‘Turn Windows features on and off’ settings screen, which you can search for at the Start Menu.

Install the Telnet utility
Install the Telnet utility

Once at the Windows Features screen, put a checkmark next to the Telnet Client option and press OK to install the program.

How to fix your network connection

After using these commands, you find that your Internet connection is not working or is slow, it can be difficult to determine the cause.

To troubleshoot connection issues, Microsoft suggests the following steps:

  • Use the Network troubleshooter by clicking on Start  > Settings  > Network & Internet > Status. Under Change your network settings, select Network troubleshooter. Run through the troubleshooting wizard to see if Windows 10 can automatically resolve any detected issues.

  • If you are using WiFi, make sure you are connected by going to Start  > Settings  > Network & Internet > Wi-Fi. Next, select Show available networks, and if a network you expect to see appears in the list, select it, then select Connect.

    If you are using Ethernet, make your cable is inserted correctly into your computer and that there are no issues with your network hub. You can also try swapping out the cable, if possible, to make sure it’s not a loose cable head or other physical
    issue causing the problem.

  • Check your Internet connection by going to websites from a different device. If you can connect from other devices at your location, you know it’s an issue with the individual computer. However, if no one at your location can access the Internet, it is likely either a router or Internet modem issue, which you should restart.

You can also try changing DNS servers as described above, disconnecting from a VPN, or performing a SpeedTest to ensure your ISP connection is not the problem.

After performing this troubleshooting, if you find that you can still not connect to the Internet or the speed tests show a very low number, you should contact your ISP and have them help you troubleshoot.