|
On This Page
|
|
|
|
|
 |
Ping and Traceroute
Ping and Traceroute are utilities that can be used to help troubleshoot
network or Internet connections. The ping utility tests responsiveness between
two hosts (computers, routers, switches, etc.). The traceroute utility will also
check responsiveness as well as trace the path a packet takes to get from one
host to the other. Some devices on a network will not respond to ping or traceroute
requests. In this case using the traceroute utility can show the location right
before the host that's not responding.
System Requirements
The ping and traceroute (tracert) utilities are basic TCP/IP tools and are included with most computer operating systems. (They are standard with Windows 98-XP, Novell 4-6, Macintosh OS X, and Linux/UNIX A third-party
program is necessary to use ping and tracert functions in Mac OS 9.x and below. Traceroute and Ping are small programs and will run with small amounts of RAM and hard drive space.
Ping
Ping is used primarily to find out if a computer is reachable. Ping accomplishes this task by sending out a special packet called the Internet Control Message Protocol (ICMP) echo request packet. ICMP packets are special IP messages that are used to send network information between two hosts (computers, routers, switches, etc.). When a machine receives an echo request, it responds with an echo reply.
For example:
C:\> ping www.apple.com
or
C:\> ping 17.254.0.91
will show:
Pinging www.apple.com [17.254.0.91] with 32 bytes of data:
Reply from 17.254.0.91: Bytes=32 time=70ms TTL=46
One ICMP echo request packet is sent every second to www.apple.com. When the ping program gets an echo reply back from the remote host (www.apple.com), it prints out the response, giving several pieces of information:
- IP address of where the Echo Reply came from (usually this should be the IP address of www.apple.com)
- Number of bytes of data sent
- Round trip time it took for a packet to go to and from the remote host
- Time-to-live (TTL) field
Every packet that gets sent out has a TTL field which is set to a relatively high number (ping packets get a TTL of 255). As the packet travels over the network, the TTL field gets decreased by one for each node, server, or router it passes through. When the TTL drops to 0, the packet is discarded by the router. The main purpose of this is so that a packet doesn't live forever on the network and will eventually die when it is deemed "lost." If the TTL field varies in successive pings, it could indicate that the successive reply packets are going via different routes. This could indicate that certain network routes may be experiencing problems. Packets are being sent along different paths (and not the same path each time) trying to find the quickest alternative route.
The time field is an indication of the round-trip time to get a packet to the remote host. The reply is measured in milliseconds. In general, it's best if round-trip times are under 200 milliseconds. The time it takes a packet to reach its destination is called latency. If there is a large variance in the round-trip times, the network may be experiencing
problems.
How to use Ping
Windows Environment
Ping can be accessed at a DOS or command prompt. An Internet connection must already be established.
- Click on Start > Programs > DOS Prompt (Windows 95-98) or Command Prompt (NT). In a Windows 2000 or XP environment, click on Start > Run. Type command into the dialog box, then click OK.
- In the resulting command line window, type ping hostname, where hostname can be a domain name, a machine name or an IP address.
- Press Enter.
For example:
C:\> ping www.more.net
Mac OS X Environment
-
Double-click on the Hard Drive icon > Applications folder > Utilities
folder > Network Utility program
-
Select the Ping tab and enter the hostname, where hostname
can be a domain name, a machine name or an IP address.
-
Press Enter.
Novell Environment
-
At the System Console screen, type load ping.nlm. The ping program
will launch.
-
Enter the required parameters, i.e., Host name, Seconds to pause
between pings, and IP packet size to send in bytes.
-
Press the Esc key.
Linux/UNIX Environment
-
Launch a command line interface (will vary depending on operating system distribution).
-
In the resulting command line window or screen, type ping hostname,
where hostname can be a domain name, a machine name or an IP address.
-
Press Enter.
For example:
[bob@linuxbox /home]# ping www.gnu.org
Back to Top
Additional Ping Commands
These extra commands will work in any environment except the Novell operating system.
-
To stop ping, type Ctrl-C.
-
To print the results of ping to a text file on a local drive, add >
textname.txt to the command:
For example:
Ping www.apple.com > ping.txt
will save the results to a ping.txt file located on the primary hard drive.
-
To append the results of more than one ping to the same text file on your local
drive add >> ping.txt to the command:
For example:
Ping www.novell.com >> ping.txt
will save the results to the same ping.txt file located on the primary hard drive.
The commands below can be entered in the same manner.
-t
Pings the specified computer until interrupted.
C:\> ping www.apple.com -t
-n count
Sends the number of echo packets specified by count. The default is 4.
C:\> ping www.apple.com -n 7
-l length
Sends Echo packets containing the amount of data specified by length. The default is 32 bytes; the maximum is 8192.
C:\> ping www.apple.com -l 1024
Sending larger packets may reveal network problems (dropped packets, slowness) that may not be apparent when smaller packets are utilized.
Traceroute
Traceroute (tracert) works by sending a packet to an open UDP
port on a destination machine. For the initial three packets, traceroute sets
the TTL (see explanation of TTL) to 1 and
releases the packet. The packet then gets transferred to the first router (completing
the first hop), and the TTL gets decremented by the router from 1 to 0. The router
then discards the packet and sends off an ICMP notification packet to the original
host with the message that the TTL expired from the router. This tells tracert
what the first hop is and how long it takes to get there. Traceroute repeats this,
gradually incrementing the TTL until a path to the remote host is traced and it
gets back an ICMP Port Unreachable message, indicating that the remote host has
been reached.
Response times may vary dramatically because the packet is crossing long distances, other times the increases come from network congestion.
For Example:
C:\> tracert www.linux.org
or
C:\> tracert 198.182.196.56
will show:
Tracing route to www.linux.org [198.182.196.56]
over a maximum of 30 hops:
1 <10 ms <10 ms <10 ms mn-bldg-rtr-vlan200-3.gw.more.net [207.160.133.254]
2 <10 ms <10 ms <10 ms co-r12-01-atm0-0-10.mo.more.net [150.199.11.1]
3 <10 ms 10 ms <10 ms kc-r12-01-atm1-0-131.mo.more.net [150.199.7.198]
4 <10 ms 10 ms <10 ms bb2-g8-0.kscymo.swbell.net [151.164.8.247]
5 <10 ms 10 ms 10 ms sl-gw9-kc-2-0.sprintlink.net [160.81.18.233]
6 * * *
7 50 ms 61 ms 60 ms 198.ATM7-0.XR2.TOR2.ALTER.NET [152.63.128.53]
8 50 ms 60 ms 60 ms 194.ATM7-0.GW1.TOR2.ALTER.NET [152.63.128.101]
9 50 ms 70 ms 60 ms att2-gw.customer.alter.net [157.130.159.82]
10 61 ms 60 ms 60 ms pos5-0-0.hcap1-ott.bb.attcanada.ca [216.191.225.2]
11 60 ms 70 ms 70 ms 216.191.132.150
12 60 ms 81 ms 70 ms router.invlogic.com [207.245.34.122]
13 70 ms 70 ms 80 ms www.linux.org [198.182.196.56]
Trace complete.
Note the asterisks on line six. This can indicate that a response wasn't
received. Some routers do not issue TTL-expired ICMP messages.
How to use Traceroute
Windows Environment
Traceroute can be accessed at a DOS or command prompt. An Internet connection must already be established.
-
Click on Start > Programs > DOS Prompt (Windows 95-98)
or Command Prompt (NT). In a Windows 2000 or XP environment, click on Start
> Run. Type command into the dialog box, then click OK.
-
In the resulting command line window, type tracert hostname,
where hostname can be a domain name, a machine name or an IP address.
-
Press Enter.
For example:
C:\> tracert www.emints.more.net
Mac OS X Environment
-
Double-click the Hard Drive icon > Applications folder > Utilities
folder > Network Utility program.
-
Select the Traceroute tab and enter the hostname, where
hostname can be a domain name, a machine name or an IP address.
-
Press Enter.
Novell Environment
-
At the System Console screen, type load iptrace hostname,
where hostname can be a domain name, a machine name or an IP address.
-
Press Enter.
Linux/UNIX Environment
-
Launch a command line interface (will vary depending on the operating system
distribution).
-
In the resulting command line window or screen, type traceroute hostname,
where hostname can be a domain name, a machine name or an IP address.
-
Press Enter.
For example:
[sygny@linuxbox /home]# traceroute www.novell.com
Back to Top
Additional Traceroute Commands
These extra commands will work in any environment except for the Novell operating system.
-
To stop traceroute, type Ctrl-C.
-
To print the results of traceroute to a text file on a local drive, add >
textname.txt to the command:
For example:
tracert www.pmail.com > tracert.txt
will save the results to a tracert.txt file located on the primary hard drive.
-
To append the results of more than one traceroute to the same text file on
your local drive add >> tracert.txt to the command:
For example:
tracert www.rpmfind.net >> tracert.txt
will save the results to the same tracert.txt file located on the primary hard
drive.
|