Windows command line program
This part includes:
Use ipconfig/all to view configurations
Use ipconfig/renew to refresh the configuration
Use ipconfig to manage DNS and DHCP category IDS
Use ping to test the connection
Use ARP to solve hardware address problems
Use NBTSTAT to solve NetBIOS name problems
Use netstat to display connection statistics
Use tracert to track Network Connections
Use pathping to test the vro
Use ipconfig/all to view configurations
When detecting and solving TCP/IP network problems, first check the TCP/IP configuration on the computer where the problem occurs. You can use the ipconfig command to obtain the host configuration information, including the IP address, subnet mask, and default gateway.
Note:
For Windows 95 and Windows 98 clients, use the winipcfg command instead of the ipconfig command.
When you use the ipconfig command with the/all option, a detailed configuration report of all interfaces is provided, including any configured serial ports. You can use ipconfig/all to redirect command output to a file and paste the output to other documents. You can also use the output to confirm the TCP/IP configuration of each computer on the network, or further investigate TCP/IP network problems.
For example, if the IP address configured on the computer is the same as the existing IP address, the subnet mask is 0.0.0.0.
The following example shows the ipconfig/all command output. The computer is configured to use the DHCP server to dynamically Configure TCP/IP and use wins and DNS server to resolve the name.
Windows 2000 IP configuration
Node Type...: Hybrid
IP routing enabled...: No
Wins proxy enabled...: No
Ethernet Adapter local area connection:
Host Name ......: corp1.microsoft.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.0
Default Gateway...: 192.168.0.1
DHCP server...: 10.1.0.50
Primary WINS server...: 10.1.0.101
Secondary WINS server...: 10.1.0.102
Lease obtained ......: Wednesday, September 02,199 8 10:32:13 AM
Lease expires ......: Friday, September 18,199 8 10:32:13 AM
If the TCP/IP configuration is correct, perform the next step to connect to other hosts on the TCP/IP network.
Use ipconfig/renew to refresh the configuration
To solve a TCP/IP network problem, first check the TCP/IP configuration on the computer where the problem occurs. If the computer enables DHCP and uses the DHCP server for configuration, use the ipconfig/Renew command to refresh the lease.
When ipconfig/Renew is used, all NICs (except those manually configured adapters) on the computer using DHCP are connected to the DHCP server whenever possible to update existing configurations or obtain new configurations.
You can also use the ipconfig command with the/release option to immediately release the current DHCP configuration of the host. For more information about DHCP and lease, see how clients get configurations.
Note:
For Windows 95 and Windows 98 that enable DHCP, use the release and renew options of the winipcfg command instead of the ipconfig/release and ipconfig/Renew commands, manually release or update the customer's IP Address Configuration lease.
You can also use the ipconfig command to manage DNS and DHCP class IDS by using ipconfig:
Displays or resets the DNS cache.
For more information, see use ipconfig to view or reset the client resolution program cache.
Refresh the registered DNS name.
For more information, see use ipconfig to update DNS customer registration.
Displays the DHCP category ID of the adapter.
For more information, see show DHCP category ID information on the client.
Set the DHCP category ID of the adapter.
For more information, see set DHCP category ID on the client.
Use ping to test the connection
The Ping Command helps verify IP connectivity. When detecting and resolving the problem, you can use ping to send an ICMP response request to the target host name or IP address. When you need to verify whether the host can connect to the TCP/IP network and network resources, use Ping. You can also use ping to isolate network hardware problems and incompatible configurations.
Generally, it is best to use the ping command to verify whether the route between the local computer and the network host exists and the IP address of the network host to be connected. Ping the IP address of the target host to check whether the host responds as follows:
Ping ip_address
Perform the following steps when using Ping:
Ping the loopback address to verify whether TCP/IP is installed on the Local Computer and whether the configuration is correct.
Ping 127.0.0.1
Ping the IP address of the Local Computer to verify that the IP address is correctly added to the network.
Ping ip_address_of_local_host
Ping the IP address of the default gateway to verify whether the gateway is running and whether it can communicate with the local host on the local network.
Ping ip_address_of_default_gateway
Ping the IP address of the remote host to verify whether the router can communicate.
Ping ip_address_of_remote_host
The ping command uses Windows Socket style name resolution to resolve the computer name to an IP address. Therefore, if the address is successfully used but the ping command fails, the problem lies in address or name resolution, instead of network connectivity issues. For more information, see use ARP to solve hardware address problems.
If you cannot successfully use ping at any point, make sure that:
After installing and configuring TCP/IP, restart the computer.
The IP address of the local computer on the "General" tab of the "Internet Protocol (TCP/IP) properties" dialog box is valid and correct.
Use IP routing, and the links between routers are available.
You can use different options of the ping command to specify the size of the data packet to be used, the number of data packets to be sent, whether to record the used route, and the TTL) value and whether to set the "Do Not segment" flag. You can type Ping -? View these options.
The following example shows how to send two ping requests to IP address 172.16.48.10, each of which is 1,450 Bytes:
C:/> Ping-N 2-l 1450 172.16.48.10
Pinging 172.16.48.10 with 1450 bytes of data:
Reply from 172.16.48.10: bytes = 1450 time <10 ms TTL = 32
Reply from 172.16.48.10: bytes = 1450 time <10 ms TTL = 32
Ping statistics for 157.59.8.1:
Packets: Sent = 2, stored ED = 2, lost = 0 (0% loss ),
Approximate roundtrip times in Milli-seconds:
Minimum = 0 ms, maximum = 10 ms, average = 2 ms
By default, before "request time-out" is displayed, Ping waits for 1,000 milliseconds (1 second) for each response to return. If the remote system tested by Ping goes through a long-delayed link, such as a satellite link, the response may take a longer time to return. You can use the-W (wait) option to specify a longer timeout period.
Use ARP to solve hardware address problems
The Address Resolution Protocol (ARP) allows the host to find the Media Access Control Address of the host on the same physical network, if the latter IP address is given. To make ARP more effective, each computer caches IP addresses to the Media Access Control Address ing to eliminate repeated ARP broadcast requests.
You can use ARP commands to view and modify ARP table items on the local computer. ARP commands are useful for viewing ARP caches and solving address resolution problems.
For more information, see view the Address Resolution Protocol (ARP) cache and add static ARP cache items.
Use NBTSTAT to solve NetBIOS name problems
The NetBIOS (netbt) on TCP/IP resolves the NetBIOS name into an IP address. TCP/IP provides many options for NetBIOS name resolution, including local cache search, WINS Server query, broadcast, DNS Server query, and LmHosts and host file search.
NBTSTAT is a useful tool for resolving NetBIOS name resolution issues. You can use the nbtstat command to delete or correct a pre-loaded project:
NBTSTAT-N displays the names registered locally on the system by programs such as the server or redirection.
NBTSTAT-C displays the NetBIOS name cache, including the name-to-address ing of other computers.
NBTSTAT-r clears the name cache and then reloads it from The LmHosts file.
NBTSTAT-rr releases the NetBIOS names registered on the WINS server, and refresh their registration.
NBTSTAT-a name executes the NetBIOS adapter STATUS Command on the computer specified by name. The adapter status command returns the local NetBIOS name table of the computer and the Media Access Control Address of the adapter.
NBTSTAT-s lists the current NetBIOS session and its status (including statistics), as shown in the following example:
NetBIOS connection table
Local name state in/out remote host Input Output
------------------------------------------------------------------
Corp1 <00> connected out corpsup1 <20> 6 MB 5 MB
Corp1 <00> connected out corpprint <20> kilobytes KB
Corp1 <00> connected out corpsrc1 <20> 299kb 19kb
Corp1 <00> connected out corpemail1 <20> 324kb 19kb
Corp1 <03> listening
Use netstat to display connection statistics
You can use the netstat command to display the Protocol statistics and the current TCP/IP connection. The netstat-a command displays all connections, while the netstat-R command displays the route table and active connections. The netstat-e command displays Ethernet statistics, while netstat-s displays statistics for each protocol. If netstat-N is used, the address and port number cannot be converted to the name. The following is an output example of netstat:
C:/> netstat-e
Interface statistics
Received sent
Bytes 3995837940 47224622
Unicast packets 120099 131015
Non-unicast packets 7579544 3823
Discards 0 0
Errors 0 0
Unknown protocols 363054211
C:/> netstat-
Active connections
PROTO local address foreign address State
TCP corp1: 1572 172.16.48.10: nbsession established
TCP corp1: 1589 172.16.48.10: nbsession established
TCP corp1: 1606 172.16.105.245: nbsession established
TCP corp1: 1632 172.16.48.213: nbsession established
TCP corp1: 1659 172.16.48.169: nbsession established
TCP corp1: 1714 172.16.48.203: nbsession established
TCP corp1: 1719 172.16.48.36: nbsession established
TCP corp1: 1241 172.16.48.101: nbsession established
UDP corp1: 1025 *:*
UDP corp1: SNMP *:*
UDP corp1: nbname *:*
UDP corp1: nbdatagram *:*
UDP corp1: nbname *:*
UDP corp1: nbdatagram *:*
C:/> netstat-S
IP statistics
Packets received = 5378528
Inclued header errors = 738854
Received address errors = 23150
Required rams forwarded = 0
Unknown protocols committed ED = 0
Inclued packets discarded = 0
Received packets delivered = 4616524
Output requests = 132702
Routing discards = 157
Discarded output packets = 0
Output packet no route = 0
Reassembly required = 0
Reassembly successful = 0
Reassembly failures =
Required rams successfully fragmented = 0
Required rams failing fragmentation = 0
Fragments created = 0
ICMP statistics
Received sent
Messages 693 4
Errors 0 0
Destination Unreachable 685 0
Time exceeded 0 0
Parameter problems 0 0
Source quenches 0 0
Redirects 0 0
Echoes 4 0
Echo replies 0 4
Timestamps 0 0
Timestamp replies 0 0
Address masks 0 0
Address Mask replies 0 0
TCP statistics
Active opens = 597
Passive opens = 135
Failed connection attempts = 107
Reset connections = 91
Current connections = 8
Segments received = 106770
Segments sent = 118431
Segments retransmitted = 461
UDP statistics
Required rams received = 4157136
No ports = 351928
Receive errors = 2
Required rams sent = 13809
Use tracert to track Network Connections
Tracert is a routing tracking utility used to determine the path adopted by the IP datagram access target. The tracert command uses the ip ttl field and the ICMP error message to determine the route from one host to other hosts on the network.
How tracert works
By sending "Internet Control Message Protocol (ICMP)" response packets with different TTL values to the target, the tracert diagnostic program determines the route adopted by the target. Each vro on the path must at least decrease the TTL of the data packet by 1 before forwarding the data packet. When the TTL value on the data packet is reduced to 0, the router should send the "ICMP timeout" message back to the source system.
Tracert sends a response packet whose TTL is 1, and increases TTL by 1 in each subsequent sending process until the target response or TTL reaches the maximum value to determine the route. Check the ICMP timeout message sent back by the Intermediate router to determine the route. Some routers directly discard TTL expired data packets without asking, which is not seen in the tracert utility.
The tracert command prints out the list of nearby router interfaces in the path that returns the "ICMP timeout" message in sequence. If the-D option is used, the tracert utility does not query DNS on each IP address.
In the following example, data packets must pass through two routers (10.0.0.1 and 192.168.0.1) to reach host 172.16.0.99. The default gateway of the host is 10.0.0.1, And the IP address of the router on the 192.168.0.0 network is 192.168.0.1.
C:/> tracert 172.16.0.99-d
Tracing Route to 172.16.0.99 over a maximum of 30 hops
1 2 S 3 S 2 S 10, 0.0, 1
2 75 MS 83 MS 88 MS 192.168.0.1
3 73 MS 79 MS 93 MS 172.16.0.99
Trace complete.
Use tracert to solve the problem
You can use the tracert command to determine the stop position of a data packet on the network. In the following example, the default gateway determines that there is no valid path for the host 192.168.10.99. This may be due to a vro configuration problem, or the 192.168.10.0 network does not exist (the wrong IP address ).
C:/> tracert 192.168.10.99
Tracing Route to 192.168.10.99 over a maximum of 30 hops
1 10.0.0.1 reportsestination net unreachable.
Trace complete.
The tracert utility is very useful for solving large network problems. In this case, several paths can be taken to reach the same point.
Tracert command line options
The tracert command supports multiple options, as shown in the following table.
Tracert [-D] [-H maximum_hops] [-J host-list] [-W timeout] target_name
Option description
-D: do not resolve the IP address to the host name.
-H maximum_hops specifies the number of hops to track the route of the host called target_name.
-J host-List specifies the list of router interfaces in the path used by the tracert utility package.
-W Timeout: the number of milliseconds specified for each reply.
The target host name or IP address of target_name.
For more information, see trace paths using the tracert command.
Use pathping to test the vro
The pathping command is a routing tracking tool that combines the Ping and tracert commands with other information not provided by the two tools. The pathping Command sends data packets to each vro in the path to the destination within a period of time, and then returns the data packet-based computer results from each hop. Because the command shows how much data packets are lost on any given vro or link, it is easy to determine the vro or link that may cause network problems. Some options are available, as shown in the following table.
Option |
Name |
Function |
-N |
Hostnames |
Do not resolve the address to the Host Name |
-H |
Maximum hops |
Maximum number of hops for a search Target |
-G |
Host-list |
Release source route entries along the route list |
-P |
Period |
Number of milliseconds between ping requests |
-Q |
Num_queries |
Queries per hop |
-W |
Time-out |
Number of milliseconds for each reply |
-T |
Layer 2 tag |
Connect the layer-1 Priority mark (for example, for IEEE 2nd p) to a data packet and send it to each network device in the path. This helps identify network devices that are not correctly configured with Layer 2 priority. -T switch is used to test QoS connectivity |
-R |
RSVP isbase Che |
Check to determine whether each vro in the path supports the resource retention Protocol (RSVP), which allows the host to retain a certain amount of bandwidth for the data stream. The-r switch is used to test QoS connectivity. |
The default number of hops is 30, and the default waiting time before timeout is 3 seconds. The default time is 250 milliseconds, and the number of queries per vro along the path is 100.
The following is a typical pathping report. The statistical information edited after the hop list indicates the packet loss on each independent router.
D:/> pathping-N MSW
Tracing Route to MSW [7.54.1.196]
Over a maximum of 30 hops:
0 172.16.87.35
1 172.16.87.218
2 192.68.52.1
3 192.68.80.1
4 7.54.247.14
5 7.54.1.196
Computing statistics for 125 seconds...
Source to here this node/Link
Hop RTT lost/sent = pct address
0 172.16.87.35
0/100 = 0% |
1 41 MS 0/100 = 0% 0/100 = 0% 172.16.87.218
13/100 = 13% |
2 22 Ms 16/100 = 16% 3/100 = 3% 192.68.52.1
0/100 = 0% |
3 24 Ms 13/100 = 13% 0/100 = 0% 192.68.80.1
0/100 = 0% |
4 21 Ms 14/100 = 14% 1/100 = 1% 10.54.247.14
0/100 = 0% |
5 24 Ms 13/100 = 13% 0/100 = 0% 10.54.1.196
Trace complete.
When you run pathping, first view the routing results when testing the problem. This path is the same as the path displayed by the tracert command. Then the pathping command displays a busy message for the next 125 milliseconds (this time varies according to the hop count ). During this period, pathping collects information between all the routers listed earlier and the links between them. At the end of this period, it displays the test results.
The rightmost two columns of this node/link lost/sent = pct and address are the most useful. 172.16.87.218 (hops 1) and 192.68.52.1 (hops 2) lose 13% of data packets. All other links are working properly. Routers in hops 2 and 4 also lose packets destined for them (as shown in this node/link column), but this loss does not affect the forwarding path.
The loss rate displayed on the Link (marked as | in the rightmost column) indicates that the lost data packets are forwarded along the path. This loss indicates that the link is blocked. The loss rate displayed on the router (displayed by the IP address in the rightmost sidebar) indicates that the CPU of these routers may be overloaded. These congested routers may also cause peer-to-peer problems, especially when the software router forwards packets.