161891Sbostic.\" Copyright (c) 1990, 1991, 1993 261891Sbostic.\" 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*67334Sah.\" @(#)traceroute.8 8.2 (Berkeley) 06/01/94 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. 99*67334Sah.ne 1i 10047470Scael.It Fl t Ar tos 10141124SbosticSet the 10247470Scael.Em type-of-service 10347470Scaelin probe packets to the following value (default zero). The value must be 10441124Sbostica decimal integer in the range 0 to 255. This option can be used to 10541124Sbosticsee if different types-of-service result in different paths. (If you 10647470Scaelare not running a 10747470Scael.Bx 4.3 tahoe 10847470Scaelor later system, this may be academic since the normal network 10947470Scaelservices like telnet and ftp don't let you control the 11047470Scael.Dv TOS ) . 11147470ScaelNot all values of 11247470Scael.Dv TOS 11347470Scaelare legal or 11441124Sbosticmeaningful \- see the IP spec for definitions. Useful values are 11547470Scaelprobably 11647470Scael.Ql \-t 16 11747470Scael(low delay) and 11847470Scael.Ql \-t 8 11947470Scael(high throughput). 12047470Scael.It Fl v 12147470ScaelVerbose output. Received 12247470Scael.Tn ICMP 12347470Scaelpackets other than 12447470Scael.Dv TIME_EXCEEDED 12547470Scaeland 12647470Scael.Dv UNREACHABLE Ns s 12747470Scaelare listed. 12847470Scael.It Fl w 12941124SbosticSet the time (in seconds) to wait for a response to a probe (default 3 13041124Sbosticsec.). 13147470Scael.El 13247470Scael.Pp 13341124SbosticThis program attempts to trace the route an IP packet would follow to some 13447470Scaelinternet host by launching 13547470Scael.Tn UDP 13647470Scaelprobe 13741124Sbosticpackets with a small ttl (time to live) then listening for an 13847470Scael.Tn ICMP 13947470Scael"time exceeded" reply from a gateway. We start our probes 14047470Scaelwith a ttl of one and increase by one until we get an 14147470Scael.Tn ICMP 14247470Scael"port unreachable" 14347470Scael(which means we got to "host") or hit a max (which 14447470Scaeldefaults to 30 hops & can be changed with the 14547470Scael.Fl m 14647470Scaelflag). Three 14747470Scaelprobes (changed with 14847470Scael.Fl q 14947470Scaelflag) are sent at each ttl setting and a 15041124Sbosticline is printed showing the ttl, address of the gateway and 15141124Sbosticround trip time of each probe. If the probe answers come from 15241124Sbosticdifferent gateways, the address of each responding system will 15341124Sbosticbe printed. If there is no response within a 3 sec. timeout 15447470Scaelinterval (changed with the 15547470Scael.Fl w 15647470Scaelflag), a "*" is printed for that 15741124Sbosticprobe. 15847470Scael.Pp 15941124SbosticWe don't want the destination 16047470Scaelhost to process the 16147470Scael.Tn UDP 16247470Scaelprobe packets so the destination port is set to an 16341124Sbosticunlikely value (if some clod on the destination is using that 16447470Scaelvalue, it can be changed with the 16547470Scael.Fl p 16647470Scaelflag). 16747470Scael.Pp 16841124SbosticA sample use and output might be: 16947470Scael.Bd -literal 17041124Sbostic[yak 71]% traceroute nis.nsf.net. 17141124Sbostictraceroute to nis.nsf.net (35.1.1.48), 30 hops max, 56 byte packet 17247470Scael1 helios.ee.lbl.gov (128.3.112.1) 19 ms 19 ms 0 ms 17347470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms 17447470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms 17547470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 39 ms 17647470Scael5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 39 ms 39 ms 39 ms 17747470Scael6 128.32.197.4 (128.32.197.4) 40 ms 59 ms 59 ms 17847470Scael7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 59 ms 17947470Scael8 129.140.70.13 (129.140.70.13) 99 ms 99 ms 80 ms 18047470Scael9 129.140.71.6 (129.140.71.6) 139 ms 239 ms 319 ms 18141124Sbostic10 129.140.81.7 (129.140.81.7) 220 ms 199 ms 199 ms 18241124Sbostic11 nic.merit.edu (35.1.1.48) 239 ms 239 ms 239 ms 18341124Sbostic 18447470Scael.Ed 18541124SbosticNote that lines 2 & 3 are the same. This is due to a buggy 18641124Sbostickernel on the 2nd hop system \- lbl-csam.arpa \- that forwards 18741124Sbosticpackets with a zero ttl (a bug in the distributed version 18847470Scaelof 4.3 18947470Scael.Tn BSD ) . 19047470ScaelNote that you have to guess what path 19147470Scaelthe packets are taking cross-country since the 19247470Scael.Tn NSFNet 19347470Scael(129.140) 19447470Scaeldoesn't supply address-to-name translations for its 19547470Scael.Tn NSS Ns es . 19647470Scael.Pp 19741124SbosticA more interesting example is: 19847470Scael.Bd -literal 19941124Sbostic[yak 72]% traceroute allspice.lcs.mit.edu. 20041124Sbostictraceroute to allspice.lcs.mit.edu (18.26.0.115), 30 hops max 20147470Scael1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms 20247470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 19 ms 19 ms 20347470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 19 ms 20447470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 19 ms 39 ms 39 ms 20547470Scael5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 20 ms 39 ms 39 ms 20647470Scael6 128.32.197.4 (128.32.197.4) 59 ms 119 ms 39 ms 20747470Scael7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 39 ms 20847470Scael8 129.140.70.13 (129.140.70.13) 80 ms 79 ms 99 ms 20947470Scael9 129.140.71.6 (129.140.71.6) 139 ms 139 ms 159 ms 21041124Sbostic10 129.140.81.7 (129.140.81.7) 199 ms 180 ms 300 ms 21141124Sbostic11 129.140.72.17 (129.140.72.17) 300 ms 239 ms 239 ms 21241124Sbostic12 * * * 21341124Sbostic13 128.121.54.72 (128.121.54.72) 259 ms 499 ms 279 ms 21441124Sbostic14 * * * 21541124Sbostic15 * * * 21641124Sbostic16 * * * 21741124Sbostic17 * * * 21841124Sbostic18 ALLSPICE.LCS.MIT.EDU (18.26.0.115) 339 ms 279 ms 279 ms 21941124Sbostic 22047470Scael.Ed 22141124SbosticNote that the gateways 12, 14, 15, 16 & 17 hops away 22247470Scaeleither don't send 22347470Scael.Tn ICMP 22447470Scael"time exceeded" messages or send them 22541124Sbosticwith a ttl too small to reach us. 14 \- 17 are running the 22647470Scael.Tn MIT 22747470ScaelC Gateway code that doesn't send "time exceeded"s. God 22841124Sbosticonly knows what's going on with 12. 22947470Scael.Pp 23041124SbosticThe silent gateway 12 in the above may be the result of a bug in 23147470Scaelthe 4.[23] 23247470Scael.Tn BSD 23347470Scaelnetwork code (and its derivatives): 4.x (x <= 3) 23441124Sbosticsends an unreachable message using whatever ttl remains in the 23541124Sbosticoriginal datagram. Since, for gateways, the remaining ttl is 23647470Scaelzero, the 23747470Scael.Tn ICMP 23847470Scael"time exceeded" is guaranteed to not make it back 23941124Sbosticto us. The behavior of this bug is slightly more interesting 24041124Sbosticwhen it appears on the destination system: 24147470Scael.Bd -literal 24247470Scael1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms 24347470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 39 ms 24447470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 39 ms 19 ms 24547470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 19 ms 24647470Scael5 ccn-nerif35.Berkeley.EDU (128.32.168.35) 39 ms 39 ms 39 ms 24747470Scael6 csgw.Berkeley.EDU (128.32.133.254) 39 ms 59 ms 39 ms 24847470Scael7 * * * 24947470Scael8 * * * 25047470Scael9 * * * 25141124Sbostic10 * * * 25241124Sbostic11 * * * 25341124Sbostic12 * * * 25441124Sbostic13 rip.Berkeley.EDU (128.32.131.22) 59 ms ! 39 ms ! 39 ms ! 25541124Sbostic 25647470Scael.Ed 25741124SbosticNotice that there are 12 "gateways" (13 is the final 25841124Sbosticdestination) and exactly the last half of them are "missing". 25941124SbosticWhat's really happening is that rip (a Sun-3 running Sun OS3.5) 26041124Sbosticis using the ttl from our arriving datagram as the ttl in its 26147470Scael.Tn ICMP 26247470Scaelreply. So, the reply will time out on the return path 26347470Scael(with no notice sent to anyone since 26447470Scael.Tn ICMP's 26547470Scaelaren't sent for 26647470Scael.Tn ICMP's ) 26747470Scaeluntil we probe with a ttl that's at least twice the path 26841124Sbosticlength. I.e., rip is really only 7 hops away. A reply that 26941124Sbosticreturns with a ttl of 1 is a clue this problem exists. 27047470Scael.Nm Traceroute 27147470Scaelprints a "!" after the time if the ttl is <= 1. 27247470ScaelSince vendors ship a lot of obsolete 27347470Scael.Pf ( Tn DEC Ns \'s 27447470ScaelUltrix, Sun 3.x) or 27547470Scaelnon-standard 27647470Scael.Pq Tn HPUX 27747470Scaelsoftware, expect to see this problem 27841124Sbosticfrequently and/or take care picking the target host of your 27941124Sbosticprobes. 28041124SbosticOther possible annotations after the time are 28147470Scael.Sy !H , 28247470Scael.Sy !N , 28347470Scael.Sy !P 28441124Sbostic(got a host, network or protocol unreachable, respectively), 28547470Scael.Sy !S 28641124Sbosticor 28747470Scael.Sy !F 28841124Sbostic(source route failed or fragmentation needed \- neither of these should 28941124Sbosticever occur and the associated gateway is busted if you see one). If 29047470Scaelalmost all the probes result in some kind of unreachable, 29147470Scael.Nm traceroute 29241124Sbosticwill give up and exit. 29347470Scael.Pp 29441124SbosticThis program is intended for use in network testing, measurement 29541124Sbosticand management. 29641124SbosticIt should be used primarily for manual fault isolation. 29741124SbosticBecause of the load it could impose on the network, it is unwise to use 29847470Scael.Nm traceroute 29941124Sbosticduring normal operations or from automated scripts. 30047470Scael.Sh AUTHOR 30141124SbosticImplemented by Van Jacobson from a suggestion by Steve Deering. Debugged 30241124Sbosticby a cast of thousands with particularly cogent suggestions or fixes from 30341124SbosticC. Philip Wood, Tim Seaver and Ken Adelman. 30447470Scael.Sh SEE ALSO 30547470Scael.Xr netstat 1 , 30647470Scael.Xr ping 8 30747470Scael.Sh HISTORY 30847470ScaelThe 30947470Scael.Nm 31047470Scaelcommand 31147470Scael.Bt 312