This page provides some useful information on network troubleshooting using Windows command line tools.
When you troubleshoot a TCP/IP networking problem, begin by checking the TCP/IP configuration on the computer that is experiencing the problem. You can use the ipconfig command to get host computer configuration information, including
When you use the ipconfig command with the /all option, a detailed configuration report is produced for all interfaces, including any configured serial ports. With ipconfig /all, you can redirect command output to a file and paste the output into other documents. You can also use this output to confirm the TCP/IP configuration of each computer on the network or to further investigate of TCP/IP network problems.
For example, if a computer is configured with an IP address that is a duplicate of an existing IP address, the subnet mask appears as 0.0.0.0.
The following example shows the output of the ipconfig /all command on a computer that is configured to use the DHCP server for automatic TCP/IP configuration, and WINS and DNS servers for name resolution.
Windows 2000 IP Configuration
Node Type . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . : No
WINS Proxy Enabled. . . . . : No
Ethernet adapter Local Area Connection:
Host Name . . . . . . . . . : host.grape-info.com
DNS Servers . . . . . . . . : 10.1.0.200
Description . . . . . . . . : 3Com 3C90x Ethernet Adapter
Physical Address. . . . . . : 00-60-08-3E-46-07
DHCP Enabled. . . . . . . . : Yes
Autoconfiguration Enabled . : Yes
IP Address. . . . . . . . . : 192.168.0.112
Subnet Mask . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . : 192.168.0.2
DHCP Server . . . . . . . . : 192.168.0.1
Primary WINS Server . . . . : 192.168.0.1
Secondary WINS Server . . . : 192.168.0.3
Lease Obtained. . . . . . . : Wednesday, September 02, 1998 10:32:13 AM
Lease Expires . . . . . . . : Friday, September 18, 1998 10:32:13 AM
If no problems appear in the TCP/IP configuration, the next step is testing the ability to connect to other host computers on the TCP/IP network.
If the computer that is experiencing the problem is DHCP-enabled and is using a DHCP server to obtain configuration, you can initiate a refresh of the lease by using the ipconfig /renew command.
When you use ipconfig /renew, all network adapters on the computer that uses DHCP (except those that are manually configured) try to contact a DHCP server and renew their existing configuration or obtain a new configuration.
You can also use the ipconfig command with the /release option to immediately release the current DHCP configuration for a host.
You can also use the ipconfig command to:
The ping command helps to verify IP-level connectivity. When troubleshooting, you can use ping to send an ICMP echo request to a target host name or IP address. Use ping whenever you need to verify that a host computer can connect to the TCP/IP network and network resources. You can also use ping to isolate network hardware problems and incompatible configurations.
It is usually best to verify that a route exists between the local computer and a network host by first using the ping command and the IP address of the network host to which you want to connect. Try pinging the IP address of the target host to see if it responds, as follows:
ping <IP_address>
You should perform the following steps when using ping:
ping 127.0.0.1
ping <IP_address_of_local_host>
ping <IP_address_of_default_gateway>
ping <IP_address_of_remote_host>
The ping command uses Windows Sockets-style name resolution to resolve a computer name to an IP address, so if pinging by address succeeds, but pinging by name fails, then the problem lies in address or name resolution, not network connectivity.
If you cannot use ping successfully at any point, confirm that:
You may find the following ping options particularly useful:
Switch | Specifies... |
---|---|
-l <size> | the size of packets to use |
-n <count> | how many packets to send |
-R | whether to record the route used |
-i <TTL> | what Time-to-Live (TTL) value to use |
-f | whether to set the "don't fragment" flag |
For more detail on these (and other) options, type ping -?.
The following example illustrates how to send two pings, each 1,450 bytes in size, to IP address 192.168.0.1:
C:\>ping -n 2 -l 1450 192.168.0.1
Pinging 192.168.0.1 with 1450 bytes of data:
Reply from 192.168.0.1: bytes=1450 time<10ms TTL=32
Reply from 192.168.0.1: bytes=1450 time<10ms TTL=32
Ping statistics for 192.168.0.1:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate roundtrip times in milli-seconds:
Minimum = 0ms, Maximum = 10ms, Average = 2ms
By default, ping waits 1,000 ms (1 second) for each response to be returned before displaying the Request Timed Out message. If the remote system being pinged is across a high-delay link, such as a satellite link, responses may take longer to be returned. You can use the -w <msecs> (wait) option to specify a longer time-out.
The Address Resolution Protocol (ARP) allows a host to find the media access control address of a host on the same physical network, given the IP address of the host. To make ARP efficient, each computer caches IP-to-media access control address mappings to eliminate repetitive ARP broadcast requests.
You can use the arp command to view and modify the ARP table entries on the local computer. The arp command is useful for viewing the ARP cache and resolving address resolution problems.
NetBIOS over TCP/IP (NetBT) resolves NetBIOS names to IP addresses. TCP/IP provides many options for NetBIOS name resolution, including
nbtstat is a useful tool for troubleshooting NetBIOS name resolution problems. You can use the nbtstat command to remove or correct preloaded entries:
Switch | Action |
---|---|
-n | Displays the names that were registered locally on the system by programs such as the server and redirector |
-c | Shows the NetBIOS name cache, which contains name-to-address mappings for other computers |
-R | Purges the name cache and reloads it from the Lmhosts file |
-RR | Releases NetBIOS names registered with a WINS server and then renews their registration |
-a <name> | Performs a NetBIOS adapter status command against the computer specified by name. The adapter status command returns the local NetBIOS name table for that computer plus the media access control address of the adapter |
-S | Lists the current NetBIOS sessions and their status, including statistics, as shown in the example below![]() NetBIOS connection table Local name State In/out Remote Host Input Output |
You can use the netstat command to display protocol statistics and current TCP/IP connections:
Switch | Action |
---|---|
-a | Displays all connections![]() C:\>netstat -a |
-r | Displays the route table plus active connections |
-e | Displays Ethernet statistics![]() C:\>netstat -e |
-s | Displays per-protocol statistics![]() C:\>netstat -s |
-n | Addresses and port numbers are not converted to names |
tracert (Trace Route) is a route-tracing utility that is used to determine the path that an IP datagram takes to reach a destination. The tracert command uses the IP Time-to-Live (TTL) field and ICMP error messages to determine the route from one host to another through a network.
tracert determines the route taken to a destination by sending Internet Control Message Protocol (ICMP) echo packets with varying IP Time-to-Live (TTL) values to the destination. Each router along the path is required to decrement the TTL on a packet by at least 1 before forwarding it. When the TTL on a packet reaches 0, the router should send an ICMP Time Exceeded message back to the source computer.
tracert determines the route by sending the first echo packet with a TTL of 1 and incrementing the TTL by 1 on each subsequent transmission until the target responds or the maximum TTL is reached. The route is determined by examining the ICMP Time Exceeded messages sent back by intermediate routers. Some routers silently drop packets with expired TTLs and are invisible to the tracert utility.
tracert prints out an ordered list of the near-side interface of the routers in the path that returned the ICMP Time Exceeded message. If the -d switch is used, the tracert utility does not perform a DNS lookup on each IP address.
In the following example, the packet must travel through routers to get to host 202.144.128.22. The default gateway of the host is 192.168.0.2 and the IP address of the router on the 192.168.0.0 network is 192.168.0.2.
C:\>tracert 202.144.128.22
Tracing route to 202.144.128.22 over a maximum of 30 hops:
1 6 ms 2 ms 2 ms 192.168.0.2
2 4 ms 3 ms 4 ms 202.144.158.206
3 78 ms 78 ms 78 ms 202.144.159.195
4 78 ms 78 ms 78 ms 202.144.129.2
5 227 ms 163 ms 83 ms 202.144.128.220
Trace complete.
You can use the tracert command to determine where a packet stopped on the network. In the following example, the default gateway has determined that there is not a valid path for the host on 192.168.10.99. There is probably a router configuration problem or the 192.168.10.0 network does not exist (a bad IP address).
C:\>tracert www.grape-info.com
Tracing route to www.grape-info.com [202.144.128.220]over a maximum of 30 hops:
1 6 ms 2 ms 2 ms 192.168.0.2
2 4 ms 3 ms 4 ms gw.grape-info.com [202.144.158.206]
3 tpu-gw1.grape-info.com [202.144.159.195] reports: Destination net unreachable.
Trace complete.
The tracert utility is useful for troubleshooting large networks where several paths can be taken to arrive at the same point.
The tracert command supports several options, as shown in the following table.
Option | Action |
---|---|
-d | Specifies that IP addresses are not resolved to host names |
-h <max_hops> | Specifies the number of hops to allow in tracing a route to the host named in <target_name> |
-j <host-list> | Specifies the list of router interfaces in the path taken by the tracert utility packets |
-w <timeout> | Waits the number of milliseconds specified by <timeout> for each reply |
<target_name> | Name or IP address of the target host |
The pathping command is a route tracing tool that combines features of the ping and tracert commands with additional information that neither of those tools provides.
The pathping command sends packets to each router on the way to a final destination over a period of time, and then computes results based on the packets returned from each hop. Since the command shows the degree of packet loss at any given router or link, it is easy to determine which routers or links might be causing network problems.
The following switches are available:
Switch | Action |
---|---|
-n | Does not resolve addresses to host names. |
-h <max_hops> | Maximum number of hops to search for target. Default is 30. |
-g <host_list> | Loose source route along host list. |
-p <period> | Number of milliseconds to wait between pings. Default is 250ms. |
-q <num_queries> | Number of queries per hop. Default is 100. |
-w <timeout> | Number of milliseconds to wait for each reply. Defaults to 3000ms (3 secs) |
-T | Attaches a layer-2 priority tag (for example, for IEEE 802.1p) to the packets and sends it to each of the network devices in the path. This helps in identifying the network devices that do not have layer-2 priority configured properly. The -T switch is used to test for Quality of Service (QoS) connectivity. |
-R | Checks to determine whether each router in the path supports the Resource Reservation Protocol (RSVP), which allows the host computer to reserve a certain amount of bandwidth for a data stream. The -R switch is used to test for Quality of Service (QoS) connectivity. |
The following is a typical pathping report. The compiled statistics that follow the hop list indicate packet loss at each individual router.
D:\>pathping www.grape-info.com
Tracing route to www.grape-info.com [202.144.128.220]over a maximum of 30 hops:
0 hoge.grape-info.com [192.168.0.24]
1 192.168.0.2
2 gw-dit.grape-info.com [202.144.158.206]
3 tpu-gw1.grape-info.com [202.144.159.195]
4 e0-0.tpu-br2.grape-info.com [202.144.129.2]
5 w3ext.grape-info.com [202.144.128.220]
Computing statistics for 125 seconds...
Source to Here This Node/Link
Hop RTT Lost/Sent = Pct Lost/Sent = Pct Address
0 hoge.grape-info.com [192.168.0.24]
0/ 100 = 0% |
1 3ms 0/ 100 = 0% 0/ 100 = 0% 192.168.0.2
0/ 100 = 0% |
2 4ms 0/ 100 = 0% 0/ 100 = 0% gw-dit.grape-info.com [202.144.158.206]
13/ 100 = 13% |
3 140ms 0/ 100 = 0% 1/ 100 = 1% tpu-gw1.grape-info.com [202.144.159.195]
0/ 100 = 0% |
4 126ms 0/ 100 = 0% 3/ 100 = 3% e0-0.tpu-br2.grape-info.com [202.144.129.2]
0/ 100 = 0% |
5 155ms 0/ 100 = 0% 0/ 100 = 0% aw3ext.grape-info.com [202.144.128.220]
Trace complete.
When pathping is run, you first see the results for the route as it is tested for problems. This is the same path that is shown by the tracert command.
The pathping command then displays a busy message for the next 125 seconds (this time varies by the hop count). During this time, pathping gathers information from all the routers previously listed and from the links between them. At the end of this period, it displays the test results.
The two rightmost columns - This Node/Link Lost/Sent=Pct and Address - contain the most useful information. The link between gw-dit.grape-info.com (hop 2), and tpu-gw1.grape-info.com (hop 3) is dropping 13 percent of the packets. All other links are working normally. The routers at hops 3 and 4 also drop packets addressed to them (as shown in the This Node/Link column), but this loss does not affect their forwarding path.
The loss rates displayed for the links (marked as a | in the rightmost column) indicate losses of packets being forwarded along the path. This loss indicates link congestion. The loss rates displayed for routers (indicated by their IP addresses in the rightmost column) indicate that those routers' CPUs might be overloaded. These congested routers might also be a factor in end-to-end problems, especially if packets are forwarded by software routers.