1*61891Sbostic.\" Copyright (c) 1990, 1991, 1993 2*61891Sbostic.\" The Regents of the University of California. All rights reserved. 341124Sbostic.\" 441127Sbostic.\" This code is derived from software contributed to Berkeley by 541127Sbostic.\" Van Jacobson. 641124Sbostic.\" 741127Sbostic.\" %sccs.include.redist.man% 841124Sbostic.\" 9*61891Sbostic.\" @(#)traceroute.8 8.1 (Berkeley) 06/06/93 1041127Sbostic.\" 1147470Scael.Dd 1247470Scael.Dt TRACEROUTE 8 1347470Scael.Os BSD 4.3 1447470Scael.Sh NAME 1547470Scael.Nm traceroute 1647470Scael.Nd print the route packets take to network host 1747470Scael.Sh SYNOPSIS 1847470Scael.Nm traceroute 1947470Scael.Op Fl m Ar max_ttl 2047470Scael.Op Fl n 2147470Scael.Op Fl p Ar port 2247470Scael.Op Fl q Ar nqueries 2347470Scael.Op Fl r 2447470Scael.Bk -words 2547470Scael.Op Fl s Ar src_addr 2647470Scael.Ek 2747470Scael.Op Fl t Ar tos 2847470Scael.Op Fl w Ar waittime 2947470Scael.Ar host 3047470Scael.Op Ar packetsize 3147470Scael.Sh DESCRIPTION 3241124SbosticThe Internet is a large and complex aggregation of 3341124Sbosticnetwork hardware, connected together by gateways. 3441124SbosticTracking the route one's packets follow (or finding the miscreant 3541124Sbosticgateway that's discarding your packets) can be difficult. 3647470Scael.Nm Traceroute 3741124Sbosticutilizes the IP protocol `time to live' field and attempts to elicit an 3847470Scael.Tn ICMP 3947470Scael.Dv TIME_EXCEEDED 4047470Scaelresponse from each gateway along the path to some 4141124Sbostichost. 4247470Scael.Pp 4341124SbosticThe only mandatory parameter is the destination host name or IP number. 4441124SbosticThe default probe datagram length is 38 bytes, but this may be increased 4541124Sbosticby specifying a packet size (in bytes) after the destination host 4641124Sbosticname. 4747470Scael.Pp 4841124SbosticOther options are: 4947470Scael.Bl -tag -width Ds 5047470Scael.It Fl m Ar max_ttl 5141124SbosticSet the max time-to-live (max number of hops) used in outgoing probe 5247470Scaelpackets. The default is 30 hops (the same default used for 5347470Scael.Tn TCP 5441124Sbosticconnections). 5547470Scael.It Fl n 5641124SbosticPrint hop addresses numerically rather than symbolically and numerically 5741124Sbostic(saves a nameserver address-to-name lookup for each gateway found on the 5841124Sbosticpath). 5947470Scael.It Fl p Ar port 6047470ScaelSet the base 6147470Scael.Tn UDP 6247470Scael.Ar port 6347470Scaelnumber used in probes (default is 33434). 6447470Scael.Nm Traceroute 6547470Scaelhopes that nothing is listening on 6647470Scael.Tn UDP 6747470Scaelports 6847470Scael.Em base 6941124Sbosticto 7047470Scael.Em base+nhops-1 7147470Scaelat the destination host (so an 7247470Scael.Tn ICMP 7347470Scael.Dv PORT_UNREACHABLE 7447470Scaelmessage will 7541124Sbosticbe returned to terminate the route tracing). If something is 7641124Sbosticlistening on a port in the default range, this option can be used 7741124Sbosticto pick an unused port range. 7847470Scael.It Fl q Ar nqueries 7947470ScaelSet the number of probes per ``ttl'' to 8047470Scael.Ar nqueries 8147470Scael(default is three probes). 8247470Scael.It Fl r 8341124SbosticBypass the normal routing tables and send directly to a host on an attached 8441124Sbosticnetwork. 8541124SbosticIf the host is not on a directly-attached network, 8641124Sbostican error is returned. 8741124SbosticThis option can be used to ping a local host through an interface 8841124Sbosticthat has no route through it (e.g., after the interface was dropped by 8947470Scael.Xr routed 8 ) . 9047470Scael.It Fl s Ar src_addr 9147470ScaelUse the following IP address 9247470Scael(which must be given as an IP number, not 9341124Sbostica hostname) as the source address in outgoing probe packets. On 9441124Sbostichosts with more than one IP address, this option can be used to 9541124Sbosticforce the source address to be something other than the IP address 9641124Sbosticof the interface the probe packet is sent on. If the IP address 9741124Sbosticis not one of this machine's interface addresses, an error is 9841124Sbosticreturned and nothing is sent. 9947470Scael.It Fl t Ar tos 10041124SbosticSet the 10147470Scael.Em type-of-service 10247470Scaelin probe packets to the following value (default zero). The value must be 10341124Sbostica decimal integer in the range 0 to 255. This option can be used to 10441124Sbosticsee if different types-of-service result in different paths. (If you 10547470Scaelare not running a 10647470Scael.Bx 4.3 tahoe 10747470Scaelor later system, this may be academic since the normal network 10847470Scaelservices like telnet and ftp don't let you control the 10947470Scael.Dv TOS ) . 11047470ScaelNot all values of 11147470Scael.Dv TOS 11247470Scaelare legal or 11341124Sbosticmeaningful \- see the IP spec for definitions. Useful values are 11447470Scaelprobably 11547470Scael.Ql \-t 16 11647470Scael(low delay) and 11747470Scael.Ql \-t 8 11847470Scael(high throughput). 11947470Scael.It Fl v 12047470ScaelVerbose output. Received 12147470Scael.Tn ICMP 12247470Scaelpackets other than 12347470Scael.Dv TIME_EXCEEDED 12447470Scaeland 12547470Scael.Dv UNREACHABLE Ns s 12647470Scaelare listed. 12747470Scael.It Fl w 12841124SbosticSet the time (in seconds) to wait for a response to a probe (default 3 12941124Sbosticsec.). 13047470Scael.El 13147470Scael.Pp 13241124SbosticThis program attempts to trace the route an IP packet would follow to some 13347470Scaelinternet host by launching 13447470Scael.Tn UDP 13547470Scaelprobe 13641124Sbosticpackets with a small ttl (time to live) then listening for an 13747470Scael.Tn ICMP 13847470Scael"time exceeded" reply from a gateway. We start our probes 13947470Scaelwith a ttl of one and increase by one until we get an 14047470Scael.Tn ICMP 14147470Scael"port unreachable" 14247470Scael(which means we got to "host") or hit a max (which 14347470Scaeldefaults to 30 hops & can be changed with the 14447470Scael.Fl m 14547470Scaelflag). Three 14647470Scaelprobes (changed with 14747470Scael.Fl q 14847470Scaelflag) are sent at each ttl setting and a 14941124Sbosticline is printed showing the ttl, address of the gateway and 15041124Sbosticround trip time of each probe. If the probe answers come from 15141124Sbosticdifferent gateways, the address of each responding system will 15241124Sbosticbe printed. If there is no response within a 3 sec. timeout 15347470Scaelinterval (changed with the 15447470Scael.Fl w 15547470Scaelflag), a "*" is printed for that 15641124Sbosticprobe. 15747470Scael.Pp 15841124SbosticWe don't want the destination 15947470Scaelhost to process the 16047470Scael.Tn UDP 16147470Scaelprobe packets so the destination port is set to an 16241124Sbosticunlikely value (if some clod on the destination is using that 16347470Scaelvalue, it can be changed with the 16447470Scael.Fl p 16547470Scaelflag). 16647470Scael.Pp 16741124SbosticA sample use and output might be: 16847470Scael.Bd -literal 16941124Sbostic[yak 71]% traceroute nis.nsf.net. 17041124Sbostictraceroute to nis.nsf.net (35.1.1.48), 30 hops max, 56 byte packet 17147470Scael1 helios.ee.lbl.gov (128.3.112.1) 19 ms 19 ms 0 ms 17247470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms 17347470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms 17447470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 39 ms 17547470Scael5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 39 ms 39 ms 39 ms 17647470Scael6 128.32.197.4 (128.32.197.4) 40 ms 59 ms 59 ms 17747470Scael7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 59 ms 17847470Scael8 129.140.70.13 (129.140.70.13) 99 ms 99 ms 80 ms 17947470Scael9 129.140.71.6 (129.140.71.6) 139 ms 239 ms 319 ms 18041124Sbostic10 129.140.81.7 (129.140.81.7) 220 ms 199 ms 199 ms 18141124Sbostic11 nic.merit.edu (35.1.1.48) 239 ms 239 ms 239 ms 18241124Sbostic 18347470Scael.Ed 18441124SbosticNote that lines 2 & 3 are the same. This is due to a buggy 18541124Sbostickernel on the 2nd hop system \- lbl-csam.arpa \- that forwards 18641124Sbosticpackets with a zero ttl (a bug in the distributed version 18747470Scaelof 4.3 18847470Scael.Tn BSD ) . 18947470ScaelNote that you have to guess what path 19047470Scaelthe packets are taking cross-country since the 19147470Scael.Tn NSFNet 19247470Scael(129.140) 19347470Scaeldoesn't supply address-to-name translations for its 19447470Scael.Tn NSS Ns es . 19547470Scael.Pp 19641124SbosticA more interesting example is: 19747470Scael.Bd -literal 19841124Sbostic[yak 72]% traceroute allspice.lcs.mit.edu. 19941124Sbostictraceroute to allspice.lcs.mit.edu (18.26.0.115), 30 hops max 20047470Scael1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms 20147470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 19 ms 19 ms 20247470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 19 ms 20347470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 19 ms 39 ms 39 ms 20447470Scael5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 20 ms 39 ms 39 ms 20547470Scael6 128.32.197.4 (128.32.197.4) 59 ms 119 ms 39 ms 20647470Scael7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 39 ms 20747470Scael8 129.140.70.13 (129.140.70.13) 80 ms 79 ms 99 ms 20847470Scael9 129.140.71.6 (129.140.71.6) 139 ms 139 ms 159 ms 20941124Sbostic10 129.140.81.7 (129.140.81.7) 199 ms 180 ms 300 ms 21041124Sbostic11 129.140.72.17 (129.140.72.17) 300 ms 239 ms 239 ms 21141124Sbostic12 * * * 21241124Sbostic13 128.121.54.72 (128.121.54.72) 259 ms 499 ms 279 ms 21341124Sbostic14 * * * 21441124Sbostic15 * * * 21541124Sbostic16 * * * 21641124Sbostic17 * * * 21741124Sbostic18 ALLSPICE.LCS.MIT.EDU (18.26.0.115) 339 ms 279 ms 279 ms 21841124Sbostic 21947470Scael.Ed 22041124SbosticNote that the gateways 12, 14, 15, 16 & 17 hops away 22147470Scaeleither don't send 22247470Scael.Tn ICMP 22347470Scael"time exceeded" messages or send them 22441124Sbosticwith a ttl too small to reach us. 14 \- 17 are running the 22547470Scael.Tn MIT 22647470ScaelC Gateway code that doesn't send "time exceeded"s. God 22741124Sbosticonly knows what's going on with 12. 22847470Scael.Pp 22941124SbosticThe silent gateway 12 in the above may be the result of a bug in 23047470Scaelthe 4.[23] 23147470Scael.Tn BSD 23247470Scaelnetwork code (and its derivatives): 4.x (x <= 3) 23341124Sbosticsends an unreachable message using whatever ttl remains in the 23441124Sbosticoriginal datagram. Since, for gateways, the remaining ttl is 23547470Scaelzero, the 23647470Scael.Tn ICMP 23747470Scael"time exceeded" is guaranteed to not make it back 23841124Sbosticto us. The behavior of this bug is slightly more interesting 23941124Sbosticwhen it appears on the destination system: 24047470Scael.Bd -literal 24147470Scael1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms 24247470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 39 ms 24347470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 39 ms 19 ms 24447470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 19 ms 24547470Scael5 ccn-nerif35.Berkeley.EDU (128.32.168.35) 39 ms 39 ms 39 ms 24647470Scael6 csgw.Berkeley.EDU (128.32.133.254) 39 ms 59 ms 39 ms 24747470Scael7 * * * 24847470Scael8 * * * 24947470Scael9 * * * 25041124Sbostic10 * * * 25141124Sbostic11 * * * 25241124Sbostic12 * * * 25341124Sbostic13 rip.Berkeley.EDU (128.32.131.22) 59 ms ! 39 ms ! 39 ms ! 25441124Sbostic 25547470Scael.Ed 25641124SbosticNotice that there are 12 "gateways" (13 is the final 25741124Sbosticdestination) and exactly the last half of them are "missing". 25841124SbosticWhat's really happening is that rip (a Sun-3 running Sun OS3.5) 25941124Sbosticis using the ttl from our arriving datagram as the ttl in its 26047470Scael.Tn ICMP 26147470Scaelreply. So, the reply will time out on the return path 26247470Scael(with no notice sent to anyone since 26347470Scael.Tn ICMP's 26447470Scaelaren't sent for 26547470Scael.Tn ICMP's ) 26647470Scaeluntil we probe with a ttl that's at least twice the path 26741124Sbosticlength. I.e., rip is really only 7 hops away. A reply that 26841124Sbosticreturns with a ttl of 1 is a clue this problem exists. 26947470Scael.Nm Traceroute 27047470Scaelprints a "!" after the time if the ttl is <= 1. 27147470ScaelSince vendors ship a lot of obsolete 27247470Scael.Pf ( Tn DEC Ns \'s 27347470ScaelUltrix, Sun 3.x) or 27447470Scaelnon-standard 27547470Scael.Pq Tn HPUX 27647470Scaelsoftware, expect to see this problem 27741124Sbosticfrequently and/or take care picking the target host of your 27841124Sbosticprobes. 27941124SbosticOther possible annotations after the time are 28047470Scael.Sy !H , 28147470Scael.Sy !N , 28247470Scael.Sy !P 28341124Sbostic(got a host, network or protocol unreachable, respectively), 28447470Scael.Sy !S 28541124Sbosticor 28647470Scael.Sy !F 28741124Sbostic(source route failed or fragmentation needed \- neither of these should 28841124Sbosticever occur and the associated gateway is busted if you see one). If 28947470Scaelalmost all the probes result in some kind of unreachable, 29047470Scael.Nm traceroute 29141124Sbosticwill give up and exit. 29247470Scael.Pp 29341124SbosticThis program is intended for use in network testing, measurement 29441124Sbosticand management. 29541124SbosticIt should be used primarily for manual fault isolation. 29641124SbosticBecause of the load it could impose on the network, it is unwise to use 29747470Scael.Nm traceroute 29841124Sbosticduring normal operations or from automated scripts. 29947470Scael.Sh AUTHOR 30041124SbosticImplemented by Van Jacobson from a suggestion by Steve Deering. Debugged 30141124Sbosticby a cast of thousands with particularly cogent suggestions or fixes from 30241124SbosticC. Philip Wood, Tim Seaver and Ken Adelman. 30347470Scael.Sh SEE ALSO 30447470Scael.Xr netstat 1 , 30547470Scael.Xr ping 8 30647470Scael.Sh HISTORY 30747470ScaelThe 30847470Scael.Nm 30947470Scaelcommand 31047470Scael.Bt 311