LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-30-2012, 12:13 PM   #1
linuxvstheworld
LQ Newbie
 
Registered: Aug 2012
Distribution: Ubuntu
Posts: 3

Rep: Reputation: 0
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?
 
Old 08-30-2012, 01:11 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
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.
 
Old 08-30-2012, 01:19 PM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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 (174.137.125.65): 56 data bytes
64 bytes from 174.137.125.65: icmp_seq=0 ttl=241 time=78.808 ms
64 bytes from 174.137.125.65: icmp_seq=1 ttl=241 time=79.752 ms
^C
----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 (174.137.125.65), 64 hops max, 52 byte packets
1 vl160-d2.acc.sea2.hopone.net (192.94.73.3) 0.362 ms 0.367 ms 0.250 ms
2 ge4-2.core2.sea2.hopone.net (209.160.60.221) 0.215 ms 0.242 ms 0.249 ms
3 ge4-3.core1.sea1.hopone.net (66.36.224.26) 0.950 ms 1.124 ms 0.996 ms
4 ae0-2.sea20.ip4.tinet.net (77.67.68.81) 0.632 ms 0.667 ms 0.686 ms
5 xe-1-0-0.nyc32.ip4.tinet.net (89.149.184.186) 79.378 ms xe-0-1-0.nyc32.ip4.tinet.net (89.149.181.114) 78.704 ms xe-0-0-1.nyc32.ip4.tinet.net (89.149.184.194) 79.482 ms
6 internap-gw.ip4.tinet.net (216.221.159.206) 78.648 ms 78.148 ms 78.081 ms
7 border4.po1-20g-bbnet1.nym008.pnap.net (216.52.95.5) 78.389 ms 79.030 ms 78.312 ms
8 mpr1.te2-0-0.phi-nym008.phi.pnap.net (216.52.93.94) 80.240 ms 80.335 ms 80.329 ms
9 mpr2-bbnet2.phi.pnap.net (216.52.64.66) 79.727 ms 79.785 ms 80.660 ms
10 voicestar-1.mpr2.phi.pnap.net (216.52.66.122) 80.439 ms 77.527 ms 77.619 ms
11 mdnh-seg36.phl.marchex.com (174.137.125.65) 78.462 ms 78.908 ms 79.022 ms

Both end up showing 174.137.125.65 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.

P.S.
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.

Last edited by MensaWater; 08-31-2012 at 08:32 AM.
 
Old 08-30-2012, 07:50 PM   #4
linuxvstheworld
LQ Newbie
 
Registered: Aug 2012
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: 0
Wow, great explanations, thanks!
 
  


Reply

Tags
linux, ping, terminal, traceroute



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
traceroute? prodigius Linux - Networking 12 02-01-2015 02:52 PM
[SOLVED] What exactly does traceroute do? linuxvstheworld Linux - Networking 2 08-30-2012 01:08 PM
traceroute kaviazzz Linux - Networking 8 09-21-2008 10:05 PM
traceroute - help? ocset Linux - Networking 6 10-15-2004 03:34 PM
traceroute mint567 Linux - Networking 3 11-23-2003 02:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration