Testing a computer network means checking each layer in order: your own address settings, the connection to the router, the path to the internet, name lookups, and then the specific services you use. Most of the tests use commands that come with Windows and Linux, so you do not need to install anything to start.
Start with your own address
Check what your computer has been given before you test anything else.
- Windows: run
ipconfig /allin Command Prompt. Look at the IPv4 address, subnet mask, default gateway and DNS servers. - Linux: run
ip addr showfor addresses, andip routeto see the default gateway.
On Windows, an address starting with 169.254 usually means the computer did not receive an address from the DHCP server. Check the cable or Wi-Fi connection first, then the router.
Before you start, it helps to know how to see if an IP address is static. A changing address can cause confusing results, especially with saved shares or port forwarding.
Ping your default gateway
Ping the router at the gateway address you noted. Addresses vary, and many home routers use something such as 192.168.1.1 or 192.168.0.1, but use the address your own computer reports.
- Windows:
ping -n 4 192.168.1.1 - Linux:
ping -c 4 192.168.1.1
If the gateway does not answer, the fault is on your local side: the cable, the Wi-Fi link, the router or your computer’s settings. A gateway that replies while the internet does not points further along the path.
If you are not sure of your gateway address, see how do I find my 192.168 IP address first.
Ping an outside address
Ping a public address such as 8.8.8.8 or 1.1.1.1. These are public DNS services. Some networks and firewalls block ping replies, so a timeout does not always mean the internet is down. Try a web page as well before you decide.
- Windows:
ping -n 4 8.8.8.8 - Linux:
ping -c 4 8.8.8.8
If pings to the address work but web pages do not load, the problem is more likely in name lookups or in one application.
Check name lookups
Names depend on DNS, so test a domain name directly:
- Windows:
nslookup example.com - Linux:
dig example.com. Ifdigis missing, install the dnsutils package on Debian or Ubuntu, or the bind-utils package on Fedora.
If pinging an address works but the name lookup fails, try a different DNS server to see whether the problem is the one you are using. On Windows, ipconfig /flushdns clears the local DNS cache, which can help after a change.
Trace the path
tracert example.com on Windows and traceroute example.com on Linux show each hop between your computer and the destination. On some Linux systems traceroute must be installed first, and tracepath example.com is a common alternative.
Each line shows how long that hop took to reply. Lines with * * * are common, because some routers do not answer these probes. Look instead for a delay that appears at one hop and carries through every hop after it. A single slow reply on its own is often not important.
Test loss and consistency
One successful ping does not show whether a connection is steady. Run a longer test and read the summary:
- Windows:
ping -t example.comruns until you press Ctrl+C. - Linux:
ping example.comruns until you press Ctrl+C.
Look for dropped replies and large changes in response time. If you can, repeat the test over a cable to separate Wi-Fi problems from problems further out.
Test specific ports
Some services fail even when the internet works, so test the port a service uses. Port 443 is the one used for secure web traffic.
- Windows, in PowerShell:
Test-NetConnection -ComputerName example.com -Port 443 - Linux, if netcat is installed:
nc -vz example.com 443
A successful result means a connection opened. A failure can mean the service is down, a firewall is blocking it, or nothing is listening on that port.
Test between devices on your network
Ping another device on the same network, such as a file server or printer, using its address. If the gateway works but one local device does not, check that device and its firewall. Windows Firewall often blocks incoming ping requests, so a Windows PC may not reply to ping even when it is working properly.
Read the results
Testing is the first step of troubleshooting. For the wider idea behind it, see what does it mean to troubleshoot a network.
The results point to a likely layer rather than proving the cause:
- An address starting with 169.254 on Windows points to address assignment or the physical link.
- A failed gateway test points to the local cable, Wi-Fi, router or computer settings.
- A working gateway with a failed outside address points to the upstream connection or the router’s configuration.
- A working outside address with failed name lookups points to DNS.
- Working names with one failing service points to that service, its port or a firewall rule. On Linux, if a network service has stopped, you may need to know how to restart network services in Linux.
Keep a record and retest
Write down the date, the tests you ran, the results and any change you made. Retest after each change, so you know which change helped and which did not.
Test only networks you manage
Run these tests on networks you own or are allowed to manage. Scanning ports or probing systems on networks you do not control can break a network’s rules and may be unlawful, even when the intent is to help.