What exactly does traceroute do?
I'm reading an instructional Linux book and I came across a command named 'traceroute'. From what the book says it seems that it might be the same command as ping. Is it? Or does it do something different?
traceroute does a lot more than ping. traceroute attempts to elicit a response from each of the routers in the path to a destination. It does this by sending packets with a limited TTL (Time To Live), starting with a limit of 1 (by default -- can be overridden) and then successively larger by an increment of 1. Each router in the path decrements the TTL by 1 and returns an ICMP type 11 ("TTL equals zero") error if the result is zero. The source IP address of each of the returned ICMP packets reveals the addresses of the routers involved.
You don't always get a response from every router in the path. Constructing and returning those ICMP TTL limit messages is often made a low-priority job, so you might not get a response if the router is busy, or the router might be configured to rate-limit such responses, or not to send them at all. Even if a given router does not send a response itself, you can still get responses from routers further down the path.
ping simply checks to see if it can reach the given IP and get an ICMP packet returned.
traceroute tries to show you all the intermediate hops that were taken to get to the IP (or alternatively the last hop it got to if it can NOT get to the IP. It is often used for debugging connections that are broken. (That is if you can't ping it then doing a traceroute might help identify where in the chain it is stopping.)
So for example:
$ ping linuxquestions.com
PING linuxquestions.com (18.104.22.168): 56 data bytes
64 bytes from 22.214.171.124: icmp_seq=0 ttl=241 time=78.808 ms
64 bytes from 126.96.36.199: icmp_seq=1 ttl=241 time=79.752 ms
----linuxquestions.com PING Statistics----
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 78.808/79.280/79.752/0.668 ms
$ traceroute linuxquestions.com
traceroute to linuxquestions.com (188.8.131.52), 64 hops max, 52 byte packets
1 vl160-d2.acc.sea2.hopone.net (184.108.40.206) 0.362 ms 0.367 ms 0.250 ms
2 ge4-2.core2.sea2.hopone.net (220.127.116.11) 0.215 ms 0.242 ms 0.249 ms
3 ge4-3.core1.sea1.hopone.net (18.104.22.168) 0.950 ms 1.124 ms 0.996 ms
4 ae0-2.sea20.ip4.tinet.net (22.214.171.124) 0.632 ms 0.667 ms 0.686 ms
5 xe-1-0-0.nyc32.ip4.tinet.net (126.96.36.199) 79.378 ms xe-0-1-0.nyc32.ip4.tinet.net (188.8.131.52) 78.704 ms xe-0-0-1.nyc32.ip4.tinet.net (184.108.40.206) 79.482 ms
6 internap-gw.ip4.tinet.net (220.127.116.11) 78.648 ms 78.148 ms 78.081 ms
7 border4.po1-20g-bbnet1.nym008.pnap.net (18.104.22.168) 78.389 ms 79.030 ms 78.312 ms
8 mpr1.te2-0-0.phi-nym008.phi.pnap.net (22.214.171.124) 80.240 ms 80.335 ms 80.329 ms
9 mpr2-bbnet2.phi.pnap.net (126.96.36.199) 79.727 ms 79.785 ms 80.660 ms
10 voicestar-1.mpr2.phi.pnap.net (188.8.131.52) 80.439 ms 77.527 ms 77.619 ms
11 mdnh-seg36.phl.marchex.com (184.108.40.206) 78.462 ms 78.908 ms 79.022 ms
Both end up showing 220.127.116.11 as the IP for linuxquestions.com (even though they don't resolve to that name in the end) but with traceroute you can see every device it went through to get there.
On UNIX/Linux you can find manual pages for most commands so if you type "man traceroute" you can get more detail for it and "man ping" will give you more detail for it. Additionally on Linux there are info pages that may give even more information.
Wow, great explanations, thanks!
|All times are GMT -5. The time now is 04:11 PM.|