Checking Connectivity with the PING Command
As you might know, a
submarine can detect a nearby object by using sonar to send out a sound
wave and then seeing whether the wave is reflected. This is called pinging an object.
Windows 7 has a PING command that performs a similar function. PING sends out a special type of IP packet—called an Internet Control Message Protocol (ICMP) echo packet—to a remote location. This packet requests that the remote location send back a response packet. PING
then tells you whether the response was received. In this way, you can
check your network configuration to see whether your computer can
connect with a remote host.
To use PING,
first open a command-line session by selecting Start, All Programs,
Accessories, Command Prompt. Here’s a simplified version of the PING syntax:
ping [-t] [-n count] target_name
|-t||Pings the specified target_name until you interrupt the command.|
count||Sends the number of echo packets specified by count. The default is 4.|
|target_name||Specifies either the IP address or the hostname (a fully qualified domain name) of the remote host you want to ping.|
Here’s an example that uses PING on the Google.com domain:
Pinging google.com [22.214.171.124] with 32 bytes of data:
Reply from 126.96.36.199: bytes=32 time=43ms TTL=240
Reply from 188.8.131.52: bytes=32 time=42ms TTL=239
Reply from 184.108.40.206: bytes=32 time=43ms TTL=239
Reply from 220.127.116.11: bytes=32 time=42ms TTL=240
Ping statistics for 18.104.22.168:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),A
Approximate round trip times in milli-seconds:
Minimum = 42ms, Maximum = 43ms, Average = 42ms
Here, you see that each echo packet received a reply. If you can’t connect to the remote host, PING returns a Request timed out message for each packet.
If you can’t connect to a remote host, here are some notes on using PING to troubleshoot problems:
First, check to see whether you can use PING successfully on the loopback address:
The only reason this PING
would fail is if your computer doesn’t have the Internet Protocol
installed. However, all Windows 7 machines have IP installed, and the
option to uninstall it is disabled, so pinging the loopback address will
almost certainly work. The only reason to include it in your
troubleshooting is that if it doesn’t work, it means you have a serious
problem with your machine.
Try using PING on your computer’s IP address. (If you’re using DHCP, run the IPCONFIG
utility to get your current IP address.) If you don’t get a successful
echo, your NIC may not be inserted properly or the device drivers may
not be installed.
Now PING another computer on your network. If PING fails, check your cable or wireless connections.
The next test you should run is on your default gateway (that is, your router). If you can’t successfully PING
the router’s internal IP address, you won’t be able to access remote
Internet sites. In this case, check the IP address you entered for the
gateway, check the cable connections, and make sure the router is turned
on. You may need to power cycle the router.
If you get this far, try using PING
on the remote host you’re trying to contact. If you’re unsuccessful,
check to make sure that you’re using the correct IP address for the
host. Try power cycling your broadband modem.
Tracking Packets with the TRACERT Command
If you can’t PING a remote host, it could be that your echo packets are getting held up along the way. To find out, you can use the TRACERT (trace route) command:
tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name
|-d||Specifies not to resolve IP addresses to hostnames.|
maximum_hops||Specifies the maximum number of hops to search for the target_name. (The default is 30.)|
host-list||Specifies loose source route along the host-list.|
timeout||Waits the number of milliseconds specified by timeout for each reply.|
|target_name||Specifies the hostname of the destination computer.|
operates by sending ICMP echo packets with varying TTL values. Recall
that TTL places a limit on the number of hops that a packet can take.
Each host along the packet’s route decrements the TTL value until, when
the TTL value is 0, the packet is discarded (assuming that it hasn’t
reached its destination by then).
In TRACERT, the ICMP packets specify that whichever host decrements the echo packet to 0 should send back a response. So, the first packet has a TTL value of 1, the second has a TTL value of 2, and so on. TRACERT
keeps sending packets with incrementally higher TTL values until either
a response is received from the remote host or a packet receives no
response. Here’s an example of a TRACERT command in action:
first column is the hop number (that is, the TTL value set in the
packet). Notice that, in my case, it took 20 hops to get to Google.com.
The next three columns contain round-trip times for an attempt to reach
the destination with that TTL value. (Asterisks indicate that the
attempt timed out.) The last column contains the hostname (if it was
resolved) and the IP address of the responding system.
Tracing route to google.com [22.214.171.124]
over a maximum of 30 hops:
1 <1 ms <1 ms <1 ms 192.168.1.1
2 8 ms 8 ms 8 ms 126.96.36.199
3 6 ms 6 ms 6 ms 188.8.131.52
4 6 ms 6 ms 6 ms 184.108.40.206
5 8 ms 6 ms 7 ms 220.127.116.11
6 17 ms 17 ms 16 ms core1-chicago23-pos0-0.in.bellnexxia.net [18.104.22.168]
7 17 ms 17 ms 17 ms bx2-chicago23-pos11-0.in.bellnexxia.net [22.214.171.124]
8 17 ms 17 ms 17 ms so-4-3-3.cr1.ord2.us.above.net [126.96.36.199]
9 18 ms 17 ms 18 ms so-0-0-0.cr2.ord2.us.above.net [188.8.131.52]
10 36 ms 36 ms 36 ms so-5-2-0.cr1.dca2.us.above.net [184.108.40.206]
11 47 ms 46 ms 46 ms so-4-1-0.mpr2.atl6.us.above.net [220.127.116.11]
12 48 ms 48 ms 48 ms 18.104.22.168.google.com [22.214.171.124]
13 48 ms 48 ms 48 ms 126.96.36.199
14 49 ms 49 ms 49 ms 188.8.131.52
15 100 ms 100 ms 100 ms 184.108.40.206
16 99 ms 99 ms 99 ms 220.127.116.11
17 99 ms 99 ms 99 ms 18.104.22.168
18 99 ms 99 ms 99 ms 22.214.171.124
19 102 ms 101 ms 101 ms 126.96.36.199
20 99 ms 100 ms 99 ms 188.8.131.52
One of the reasons
your packets might not be getting to their destination is that the
default TTL value used by Windows 7 might be set too low. This is
actually very unlikely because the default is 128, which should be more
than enough. However, you can increase this value if you want. Start the Registry Editor and highlight the following key:
Select Edit, New, DWORD Value, type DefaultTTL, and press Enter. Change the value of this new setting to any decimal value between 0 and 255 (0 to FF in hexadecimal).