Network Troubleshooting Commands 2
Network Troubleshooting Commands 2
These are measures and processes used to identify, diagnose and solve problems within a
computer network.
Troubleshooting is the process of diagnosing the source of a problem. It is used to fix problems
with hardware, software, and many other products. The basic theory of troubleshooting is that
you start with the most general (and often most obvious) possible problems, and then narrow it
down to more specific issues.
Some of the processes within network troubleshooting include but are not limited to:
Network troubleshooting is a repeatable process, which means that you can break it down into
clear steps that anyone can follow.
On Windows PCs, the command prompt can be accessed by searching for it in the start menu or
by typing “cmd” into the Run window. On a Linux system, you can press Ctrl + Alt + T to open
the command line.
The following commands can be entered into the command prompt one at a time to reveal
specific information about the network status:
Ping
Ping is the ideal command to use when you need to confirm network connectivity, at the IP level,
between two hosts, or to confirm whether the TCP/IP stack is working on your local machine. A
successful ping confirms network connectivity between the two hosts and it also gives reports on
packet loss.
Key Features:
Widely used
Connection error detection
Free to use
Below is an example of a successful run of the ping command to the “google.com” remote host.
C:\Users>ping google.com
In addition to confirming IP connectivity to “google.com”, these results confirm that we are able
to properly resolve domain names (i.e. DNS is working on the local machine).
That Loss figure that you see in the last line of the ping output is the number of lost packets
followed by the packet loss rate in brackets.
A few pro-tips for working with the ping command for advanced troubleshooting:
Would continue to ping google.com until the ping was interrupted. Press control-c (the “CTRL”
and “C” keys) to end a continuous ping.
If you cannot ping domain names like google.com, but you can ping IP addresses on the
Internet like 8.8.8.8 (Google’s DNS servers), you may have a DNS-related problem.
If you cannot ping IP addresses on the Internet like 8.8.8.8, but you can ping hosts on
your Local Area Network (LAN), you may have a problem with your default gateway.
You can use “ping localhost”, “ping::1”, or “ping 127.0.0.1” to test the TCP/IP stack on
your local machine. “Localhost” is a name that resolves to one of the loopback addresses
of a local machine, “::1” is an IPv6 loopback address, and “127.0.0.1” is an IPv4
loopback address.
Ipconfig
Key Features:
If ipconfig returns an IP address that starts with 169.254 (e.g. 169.254.0.5), your PC is
likely configured for DHCP but was unable to receive an IP address from a DHCP server.
Use ipconfig /all to get the full TCP/IP configuration information for all network adapters
and interfaces.
Use ipconfig /release to release the current DHCP assigned network parameters.
Use ipconfig /renew to renew the current DHCP assigned network parameters.
Use ipconfig /flushdns to clear the DNS cache when troubleshooting name resolution
issues.
Tracert
Tracert is similar to ping, except it leverages Time To Live (TTL) values to show how many
“hops” are between two hosts. This makes it a helpful tool in determining where a network
connectivity breakdown is occurring. Basically, tracert helps you understand if the router or
network that is down between your computer and a remote host is one you control or not.
Key Features:
Again using google.com as an example, we can see there were 10 hops between our PC and
google.com.
C:\Users>tracert google.com
Tracing route to google.com [172.217.4.78] over a maximum of 30 hops:
1. 1 ms 1 ms 3 ms 192.168.1.1
2. 246 ms 49 ms 56 ms 10.198.1.17
3. 58 ms 48 ms 54 ms 10.167.184.102
4. 63 ms 55 ms 85 ms 10.167.184.107
5. 50 ms 55 ms 56 ms 10.164.72.244
6. 72 ms 365 ms 69 ms 10.164.165.43
7. 92 ms 61 ms 45 ms 209.85.174.154
8. 67 ms 42 ms 58 ms 108.170.244.1
9. 372 ms 66 ms 46 ms 216.239.51.145
Netstat
Netstat allows you to display active connections on your local machine. This can be helpful
when determining why users are unable to connect to a given application on a server or to
determine what connections are made to remote hosts from a computer. Entering netstat at the
command prompt will display all active TCP connections. Adding parameters to the netstat
command will extend or alter the functionality.
Key Features:
Here are a few helpful netstat commands and what they do:
1. Netstat –a displays all active TCP connections and the TCP and UDP ports a computer is
listening on.
2. Netstat –n displays all active TCP connections just like the netstat command, but it does
not attempt to translate addresses or port numbers to names and just displays the
numerical values.
3. Netstat –o displays all active TCP connections and includes the process ID (PID) for the
process using each connection.
You can combine different parameters to extend the functionality of netstat. For example,
netstat –ano would display all active TCP connections and the TCP and UDP ports a computer
is listening on, use numerical values, and report the PID associated with the connections.
Nslookup This is a useful command-line utility that enables DNS troubleshooting and
diagnostics. It’s available on Windows and *nix operating systems. There are a variety of use
cases for this flexible utility and it can be run in interactive mode or by entering commands
directly at the command prompt.
To help you get started, we’ll review some nslookup commands that are helpful in three of the
most common use cases: finding an IP address based on a domain name, finding a domain name
based on an IP address, and looking up email servers for a domain.
Key Features:
C:\Users>nslookup google.com
Server: ns2.dns.mydns.net
Address: 192.168.247.45
Non-authoritative answer:
Name: google.com
Addresses: 2607:f8b0:4009:805::200e
172.217.10.46
The output above shows us that the DNS server used on our local machine was
ns2.dns.mydns.net and since ns2.dns.mydns.net is not an authoritative name server on Google’s
domain, we get a “Non-authoritative answer”. If we wanted to specify a different DNS server in
our query, we simply add the DNS server’s domain name or IP address after the command, like
this (using the 1.1.1.1 DNS server from CloudFlare).
Server: 1dot1dot1dot1.cloudflare-dns.com
Address: 1.1.1.1
Non-authoritative answer:
Name: google.com
Addresses: 2607:f8b0:4009:812::200e
216.58.192.174