Programming4us
         
 
 
Windows

Windows7: Troubleshooting Networking from the Command Line (part 2)

1/5/2011 2:41:50 PM

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

-tPings the specified target_name until you interrupt the command.
-n countSends the number of echo packets specified by count. The default is 4.
target_nameSpecifies 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:

C:\Users\Paul>ping google.com


Pinging google.com [64.233.187.99] with 32 bytes of data:

Reply from 64.233.187.99: bytes=32 time=43ms TTL=240
Reply from 64.233.187.99: bytes=32 time=42ms TTL=239
Reply from 64.233.187.99: bytes=32 time=43ms TTL=239
Reply from 64.233.187.99: bytes=32 time=42ms TTL=240

Ping statistics for 64.233.187.99:
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:

    ping 127.0.0.1.

    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

-dSpecifies not to resolve IP addresses to hostnames.
-h maximum_hopsSpecifies the maximum number of hops to search for the target_name. (The default is 30.)
-j host-listSpecifies loose source route along the host-list.
-w timeoutWaits the number of milliseconds specified by timeout for each reply.
target_nameSpecifies the hostname of the destination computer.

TRACERT 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:

C:\>tracert google.com


Tracing route to google.com [216.239.57.99]
over a maximum of 30 hops:

1 <1 ms <1 ms <1 ms 192.168.1.1
2 8 ms 8 ms 8 ms 64.230.197.178
3 6 ms 6 ms 6 ms 64.230.221.201
4 6 ms 6 ms 6 ms 64.230.234.249
5 8 ms 6 ms 7 ms 64.230.233.93
6 17 ms 17 ms 16 ms core1-chicago23-pos0-0.in.bellnexxia.net [206.108.103.130]
7 17 ms 17 ms 17 ms bx2-chicago23-pos11-0.in.bellnexxia.net [206.108.103.138]
8 17 ms 17 ms 17 ms so-4-3-3.cr1.ord2.us.above.net [208.184.233.185]
9 18 ms 17 ms 18 ms so-0-0-0.cr2.ord2.us.above.net [64.125.29.186]
10 36 ms 36 ms 36 ms so-5-2-0.cr1.dca2.us.above.net [64.125.30.225]
11 47 ms 46 ms 46 ms so-4-1-0.mpr2.atl6.us.above.net [64.125.29.41]
12 48 ms 48 ms 48 ms 64.124.229.173.google.com [64.124.229.173]
13 48 ms 48 ms 48 ms 216.239.48.23
14 49 ms 49 ms 49 ms 216.239.46.44
15 100 ms 100 ms 100 ms 216.239.47.129
16 99 ms 99 ms 99 ms 216.239.49.250
17 99 ms 99 ms 99 ms 66.249.95.65
18 99 ms 99 ms 99 ms 66.249.94.27
19 102 ms 101 ms 101 ms 216.239.49.97
20 99 ms 100 ms 99 ms 216.239.57.99

Trace complete.

The 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.

Changing the Default TTL Value

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:

HKLM\System\CurrentControlSet\Services\Tcpip\Parameters

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).

Other -----------------
- Windows7: General Solutions to Network Problems (part 2) - Updating the Router Firmware
- Windows7: General Solutions to Network Problems (part 1) - Turning On Network Discovery
- Windows 7: Troubleshooting Networking - Checking the Connection Status
- Windows 7: Troubleshooting Networking - Repairing a Network Connection
- Windows 7: Troubleshooting Startup Using the System Configuration Utility
- Windows 7: Troubleshooting Startup - Recovering Using the System Recovery Options
- Windows 7: Troubleshooting Startup - When to Use the Various Advanced Startup Options
- Windows Vista: Windows Firewall Settings - Advanced Configuration
- Windows Vista: Windows Firewall Settings - Basic Configuration
- Windows 7: Troubleshooting Device Problems (part 3)
- Windows 7: Troubleshooting Device Problems (part 2) - Displaying a List of Nonworking Devices
- Windows 7: Troubleshooting Device Problems (part 1) - Troubleshooting with Device Manager
- Windows 7: Working with Device Security Policies
- Windows Vista : Configuring Network Security - Windows Defender
- Windows 7: Managing Your Hardware with Device Manager (part 4) - Writing a Complete List of Device Drivers to a Text File
- Windows 7: Managing Your Hardware with Device Manager (part 3) - Configuring Windows to Ignore Unsigned Device Drivers
- Windows 7: Managing Your Hardware with Device Manager (part 2) - Working with Device Drivers
- Windows 7: Managing Your Hardware with Device Manager (part 1)
- SOA with .NET and Windows Azure: WCF Extensions - WCF Transactions (part 2)
- SOA with .NET and Windows Azure: WCF Extensions - WCF Transactions (part 1)
 
 
Most View
- Windows 7 : Customizing the Places Bar
- Exchange Server 2010 : Planning Cross-site Failovers (part 1)
- Visual Studio Team System 2008 : Web test editor (part 3) - Toolbar properties
- Windows Phone 7 : Finding Text on a Web Page
- Context and Interception : Custom Component Services (part 2) - The Logbook Service
- Windows Server 2003 : The Terminal Services Gateway (part 2)
- SharePoint 2010 : Making Enterprise Content Management Work - Document Management (part 3) - Document IDs, Managed Metadata
- SQL Server 2008 : Setting Up Database Mail
- Central Management Servers (part 3) - Configuring Multi-Server Query Options
- Active Directory Domain Services 2008 : Identify Operations Master Role Holders
Top 10
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 3) - Configuring Recipient Filtering
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 2)
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 1)
- Implementing Edge Services for an Exchange Server 2007 Environment : Installing and Configuring the Edge Transport Server Components
- What's New in SharePoint 2013 (part 7) - BCS
- What's New in SharePoint 2013 (part 6) - SEARCH
- What's New in SharePoint 2013 (part 6) - WEB CONTENT MANAGEMENT
- What's New in SharePoint 2013 (part 5) - ENTERPRISE CONTENT MANAGEMENT
- What's New in SharePoint 2013 (part 4) - WORKFLOWS
- What's New in SharePoint 2013 (part 3) - REMOTE EVENTS