Microsoft Windows XP Professional Administrators Guide

TCP/IP Diagnostic Commands

TCP/IP supplies administrators with a number of commands that they can use to review TCP/IP configuration settings and troubleshoot communications problems. The commands include:

Using the HOSTNAME Command

All computers on a network that uses TCP/IP are assigned a hostname. The hostname is a user-friendly name that can be used when communicating with the computer over the network. One way to determine a computer's assigned name is to examine the Computer Name property sheet located on the System properties dialog, as outlined in the following procedure.

  1. Click on Start and then right-click on My Computer and select Properties. The System Properties dialog appears.

  2. Select the Computer Name property sheet.

  3. The computer's assigned name is listed to the right of the Full computer name entry, as shown in Figure 16.10.

    Figure 16.10: Examining a computer's assigned name

  4. Click on OK.

Note 

To learn how to change a computer's name, refer to Chapter 18, "LAN Configuration."

Another way to look up a computer's name is to use the HOSTNAME command, as demonstrated in the following procedure.

  1. Click on Start/Accessories and then Command Prompt. The Windows XP Command Console appears and displays the command prompt.

  2. Type HOSTNAME and press Enter as demonstrated below.

    C:\>hostname SharedPrintSvr C:\>

  3. Type Exit and press Enter.

Testing Connectivity Using the PING Command

The PING command is used to test connectivity to other computers and networks. In addition, it can be used to test a computer's own TCP/IP configuration. To use the PING command, type PING followed by the name of a computer. If the target computer's name is not known, use the computer's IP address, as demonstrated below.

C:\>ping 192.168.1.200

If the computer cannot be reached, the following output will be displayed.

C:\>ping 192.168.1.200 Pinging 192.168.1.200 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 192.168.1.200: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), C:\>

The PING command may fail for a variety of reasons. For example, the target computer may be turned off or the computer may be located on a network to which there is no connection or for which the connection is down. The following example demonstrates the information that will be displayed from a successful PING command.

C:\>ping 192.168.1.102 Pinging 192.168.1.102 with 32 bytes of data: Reply from 192.168.1.102: bytes=32 time=1ms TTL=128 Reply from 192.168.1.102: bytes=32 time<1ms TTL=128 Reply from 192.168.1.102: bytes=32 time<1ms TTL=128 Reply from 192.168.1.102: bytes=32 time<1ms TTL=128 Ping statistics for 192.168.1.102: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 1ms, Average = 0ms C:\>

The PING command can be used as part of a systematic troubleshooting analysis in order to determine where network communication problems reside, as outlined in the following procedure.

  1. To test the local computer's TCP/IP configuration, type PING 127.0.0.1 and press Enter. 127.0.0.1 is a reserved IP address known as a loopback address. If no output is received, something may be wrong with the computer's network adapter and it may need to be reinstalled or replaced.

  2. To test whether a computer has been properly connected to the network, ping the computer's IP address. If the PING command fails, the computer may not be properly connected. Disconnect the computer and ping the computer's IP address again using another computer. If the PING command is successful, then another computer is already using that computer's IP address. Duplicate IP addresses are not permitted on TCP/IP networks.

  3. To test connectivity to the computer's default gateway, ping the gateway's IP address. If this command fails, the computer will not be able tocommunicate with computers outside of its local subnet until gateway communications are restored. Alternatively, set up an alternate gateway address.

  4. Ping the IP address of a computer located on another network to verify successful communications.

Tracing Network Communications

The TRACERT command allows administrators to trace the path that a data packet takes as it travels the network. The information displayed includes every router through which the data packet passes along the way and how long the data packet took at each step. If the data packet fails to reach the destination computer, the command indicates the last router that successfully processed the data packet. This information can be used when working with network engineers to pinpoint network and router problems.

The following example demonstrates how to use the TRACERT command.

C:\>tracert http://www.premierpress.com Tracing route to http://www.premierpress.com [65.100.44.236] over a maximum of 30 hops: 1 14 ms 19 ms 23 ms 10.226.120.1 2 16 ms 38 ms 12 ms bar01-f1-0-0.shgvhe1.va.attbb.net [24.30.224.53] 3 12 ms 9 ms 12 ms btr02-p0-1.richhe1.va.attbb.net [24.30.224.49] 4 39 ms 12 ms 14 ms bic02-p1-0-0.richhe1.va.attbb.net [24.30.224.157] 5 17 ms 18 ms 18 ms 12.124.234.21 6 53 ms 17 ms 24 ms gbr6-p80.wswdc.ip.att.net [12.123.9.62] 7 80 ms 21 ms 18 ms tbr1-p012301.wswdc.ip.att.net [12.122.11.161] 8 74 ms 22 ms 35 ms tbr1-p013701.n54ny.ip.att.net [12.122.10.53] 9 53 ms 95 ms 48 ms tbr1-p013701.cgcil.ip.att.net [12.122.10.58] 10 * * * Request timed out. 11 78 ms 78 ms 77 ms gbr4-p20.st6wa.ip.att.net [12.122.10.62] 12 86 ms 84 ms 84 ms gbr1-p40.st6wa.ip.att.net [12.122.5.162] 13 93 ms 81 ms 83 ms gar2-p360.st6wa.ip.att.net [12.123.44.113] 14 83 ms 84 ms 82 ms 12.124.173.62 15 105 ms 136 ms 106 ms sttl02-core02.tamerica.net [205.171.26.57] 16 84 ms 86 ms 96 ms ptld01-core02.tamerica.net [205.171.8.74] 17 92 ms 109 ms 114 ms 205.171.130.38 18 88 ms 82 ms 84 ms ptld-dsl-gw8.ptld.uswest.net [216.161.52.8] 19 127 ms 162 ms 123 ms 65.100.44.238 20 142 ms 169 ms 155 ms premier-press.com [65.100.44.236] Trace complete. C:\>

Working with IPCONFIG

The IPCONFIG command has a number of different uses, including viewing TCP/IP configuration data and releasing and renewing configuration settings.

Statically assigned TCP/IP settings can be viewed by right-clicking on Internet Protocol (TCP/IP) on the General property sheet of the Local Area Connection Properties dialog and selecting Properties. However, TCP/IP settings that are automatically assigned by DHCP or APIPA are not visible there. Instead, the administrator can use the Windows XP command prompt and the IPCONFIG command to display TCP/IP settings, as demonstrated in the following procedure.

  1. Click on Start/All Programs/Accessories and then select Command Prompt. The Windows XP Command Console appears and displays the command prompt.

  2. Type IPCONFIG and press Enter. TCP/IP settings for the computer local area network configuration as displayed as demonstrated below.

    C:\>ipconfig Windows IP Configuration Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : ce1.client2.attbi.com IP Address. . . . . . . . . . . . : 192.168.1.101 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 C:\>

    Examine the command output and make sure that each of the following settings is correct.

    • IP address

    • Subnet mask

    • Default gateway

    If the subnet mask displays a value of 0.0.0.0, another computer on the network is already using the IP address assigned to this computer. If IP addresses are statically defined, assign the computer a new IP address. Otherwise, use the IPCONFIG command's /RENEW and /RELEASE arguments as shown in the examples that follow.

  3. To view additional TCP/IP settings, including WINS and DHCP settings, type IPCONFIG /ALL and press Enter, as demonstrated below.

C:\>ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : FamilyPC Primary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Unknown IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : ce1.client2.attbi.com Description . . . . . . . . . . . : NETGEAR FA310TX Fast Ethernet Adapter (NGRPCI) Physical Address. . . . . . . . . : 00-A0-CC-53-46-7A Dhcp Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IP Address. . . . . . . . . . . . : 192.168.1.101 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 DHCP Server . . . . . . . . . . . : 192.168.1.1 DNS Servers . . . . . . . . . . . : 63.240.76.19 204.127.198.19 Lease Obtained. . . . . . . . . . : Thursday, August 15, 2002 7:18:13 PM Lease Expires . . . . . . . . . . : Wednesday, August 21, 2002 7:18:13 PM C:\>

To tell Windows XP to stop using its currently assigned TCP/IP configuration settings, type IPCONFIG /RELEASE and press Enter, as demonstrated below.

C:\>ipconfig /release Windows IP Configuration Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 0.0.0.0 Subnet Mask . . . . . . . . . . . : 0.0.0.0 Default Gateway . . . . . . . . . : C:\>

Releasing TCP/IP settings prevents the computer from communicating with the network until new TCP/IP settings are assigned. This can be done by typing IPCONFIG /RENEW as shown below.

C:\>ipconfig /renew Windows IP Configuration Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : ce1.client2.attbi.com IP Address. . . . . . . . . . . . : 192.168.1.101 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 C:\>

If a computer uses DHCP or APIPA to dynamically assign its TCP/IP settings, new settings will be assigned.

Категории