1*47470Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 241124Sbostic.\" 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*47470Scael.\" @(#)traceroute.8 5.4 (Berkeley) 03/16/91 1041127Sbostic.\" 11*47470Scael.Dd 12*47470Scael.Dt TRACEROUTE 8 13*47470Scael.Os BSD 4.3 14*47470Scael.Sh NAME 15*47470Scael.Nm traceroute 16*47470Scael.Nd print the route packets take to network host 17*47470Scael.Sh SYNOPSIS 18*47470Scael.Nm traceroute 19*47470Scael.Op Fl m Ar max_ttl 20*47470Scael.Op Fl n 21*47470Scael.Op Fl p Ar port 22*47470Scael.Op Fl q Ar nqueries 23*47470Scael.Op Fl r 24*47470Scael.Bk -words 25*47470Scael.Op Fl s Ar src_addr 26*47470Scael.Ek 27*47470Scael.Op Fl t Ar tos 28*47470Scael.Op Fl w Ar waittime 29*47470Scael.Ar host 30*47470Scael.Op Ar packetsize 31*47470Scael.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. 36*47470Scael.Nm Traceroute 3741124Sbosticutilizes the IP protocol `time to live' field and attempts to elicit an 38*47470Scael.Tn ICMP 39*47470Scael.Dv TIME_EXCEEDED 40*47470Scaelresponse from each gateway along the path to some 4141124Sbostichost. 42*47470Scael.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. 47*47470Scael.Pp 4841124SbosticOther options are: 49*47470Scael.Bl -tag -width Ds 50*47470Scael.It Fl m Ar max_ttl 5141124SbosticSet the max time-to-live (max number of hops) used in outgoing probe 52*47470Scaelpackets. The default is 30 hops (the same default used for 53*47470Scael.Tn TCP 5441124Sbosticconnections). 55*47470Scael.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). 59*47470Scael.It Fl p Ar port 60*47470ScaelSet the base 61*47470Scael.Tn UDP 62*47470Scael.Ar port 63*47470Scaelnumber used in probes (default is 33434). 64*47470Scael.Nm Traceroute 65*47470Scaelhopes that nothing is listening on 66*47470Scael.Tn UDP 67*47470Scaelports 68*47470Scael.Em base 6941124Sbosticto 70*47470Scael.Em base+nhops-1 71*47470Scaelat the destination host (so an 72*47470Scael.Tn ICMP 73*47470Scael.Dv PORT_UNREACHABLE 74*47470Scaelmessage 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. 78*47470Scael.It Fl q Ar nqueries 79*47470ScaelSet the number of probes per ``ttl'' to 80*47470Scael.Ar nqueries 81*47470Scael(default is three probes). 82*47470Scael.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 89*47470Scael.Xr routed 8 ) . 90*47470Scael.It Fl s Ar src_addr 91*47470ScaelUse the following IP address 92*47470Scael(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*47470Scael.It Fl t Ar tos 10041124SbosticSet the 101*47470Scael.Em type-of-service 102*47470Scaelin 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 105*47470Scaelare not running a 106*47470Scael.Bx 4.3 tahoe 107*47470Scaelor later system, this may be academic since the normal network 108*47470Scaelservices like telnet and ftp don't let you control the 109*47470Scael.Dv TOS ) . 110*47470ScaelNot all values of 111*47470Scael.Dv TOS 112*47470Scaelare legal or 11341124Sbosticmeaningful \- see the IP spec for definitions. Useful values are 114*47470Scaelprobably 115*47470Scael.Ql \-t 16 116*47470Scael(low delay) and 117*47470Scael.Ql \-t 8 118*47470Scael(high throughput). 119*47470Scael.It Fl v 120*47470ScaelVerbose output. Received 121*47470Scael.Tn ICMP 122*47470Scaelpackets other than 123*47470Scael.Dv TIME_EXCEEDED 124*47470Scaeland 125*47470Scael.Dv UNREACHABLE Ns s 126*47470Scaelare listed. 127*47470Scael.It Fl w 12841124SbosticSet the time (in seconds) to wait for a response to a probe (default 3 12941124Sbosticsec.). 130*47470Scael.El 131*47470Scael.Pp 13241124SbosticThis program attempts to trace the route an IP packet would follow to some 133*47470Scaelinternet host by launching 134*47470Scael.Tn UDP 135*47470Scaelprobe 13641124Sbosticpackets with a small ttl (time to live) then listening for an 137*47470Scael.Tn ICMP 138*47470Scael"time exceeded" reply from a gateway. We start our probes 139*47470Scaelwith a ttl of one and increase by one until we get an 140*47470Scael.Tn ICMP 141*47470Scael"port unreachable" 142*47470Scael(which means we got to "host") or hit a max (which 143*47470Scaeldefaults to 30 hops & can be changed with the 144*47470Scael.Fl m 145*47470Scaelflag). Three 146*47470Scaelprobes (changed with 147*47470Scael.Fl q 148*47470Scaelflag) 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 153*47470Scaelinterval (changed with the 154*47470Scael.Fl w 155*47470Scaelflag), a "*" is printed for that 15641124Sbosticprobe. 157*47470Scael.Pp 15841124SbosticWe don't want the destination 159*47470Scaelhost to process the 160*47470Scael.Tn UDP 161*47470Scaelprobe packets so the destination port is set to an 16241124Sbosticunlikely value (if some clod on the destination is using that 163*47470Scaelvalue, it can be changed with the 164*47470Scael.Fl p 165*47470Scaelflag). 166*47470Scael.Pp 16741124SbosticA sample use and output might be: 168*47470Scael.Bd -literal 16941124Sbostic[yak 71]% traceroute nis.nsf.net. 17041124Sbostictraceroute to nis.nsf.net (35.1.1.48), 30 hops max, 56 byte packet 171*47470Scael1 helios.ee.lbl.gov (128.3.112.1) 19 ms 19 ms 0 ms 172*47470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms 173*47470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms 174*47470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 39 ms 175*47470Scael5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 39 ms 39 ms 39 ms 176*47470Scael6 128.32.197.4 (128.32.197.4) 40 ms 59 ms 59 ms 177*47470Scael7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 59 ms 178*47470Scael8 129.140.70.13 (129.140.70.13) 99 ms 99 ms 80 ms 179*47470Scael9 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 183*47470Scael.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 187*47470Scaelof 4.3 188*47470Scael.Tn BSD ) . 189*47470ScaelNote that you have to guess what path 190*47470Scaelthe packets are taking cross-country since the 191*47470Scael.Tn NSFNet 192*47470Scael(129.140) 193*47470Scaeldoesn't supply address-to-name translations for its 194*47470Scael.Tn NSS Ns es . 195*47470Scael.Pp 19641124SbosticA more interesting example is: 197*47470Scael.Bd -literal 19841124Sbostic[yak 72]% traceroute allspice.lcs.mit.edu. 19941124Sbostictraceroute to allspice.lcs.mit.edu (18.26.0.115), 30 hops max 200*47470Scael1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms 201*47470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 19 ms 19 ms 202*47470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 19 ms 203*47470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 19 ms 39 ms 39 ms 204*47470Scael5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 20 ms 39 ms 39 ms 205*47470Scael6 128.32.197.4 (128.32.197.4) 59 ms 119 ms 39 ms 206*47470Scael7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 39 ms 207*47470Scael8 129.140.70.13 (129.140.70.13) 80 ms 79 ms 99 ms 208*47470Scael9 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 219*47470Scael.Ed 22041124SbosticNote that the gateways 12, 14, 15, 16 & 17 hops away 221*47470Scaeleither don't send 222*47470Scael.Tn ICMP 223*47470Scael"time exceeded" messages or send them 22441124Sbosticwith a ttl too small to reach us. 14 \- 17 are running the 225*47470Scael.Tn MIT 226*47470ScaelC Gateway code that doesn't send "time exceeded"s. God 22741124Sbosticonly knows what's going on with 12. 228*47470Scael.Pp 22941124SbosticThe silent gateway 12 in the above may be the result of a bug in 230*47470Scaelthe 4.[23] 231*47470Scael.Tn BSD 232*47470Scaelnetwork 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 235*47470Scaelzero, the 236*47470Scael.Tn ICMP 237*47470Scael"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: 240*47470Scael.Bd -literal 241*47470Scael1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms 242*47470Scael2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 39 ms 243*47470Scael3 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 39 ms 19 ms 244*47470Scael4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 19 ms 245*47470Scael5 ccn-nerif35.Berkeley.EDU (128.32.168.35) 39 ms 39 ms 39 ms 246*47470Scael6 csgw.Berkeley.EDU (128.32.133.254) 39 ms 59 ms 39 ms 247*47470Scael7 * * * 248*47470Scael8 * * * 249*47470Scael9 * * * 25041124Sbostic10 * * * 25141124Sbostic11 * * * 25241124Sbostic12 * * * 25341124Sbostic13 rip.Berkeley.EDU (128.32.131.22) 59 ms ! 39 ms ! 39 ms ! 25441124Sbostic 255*47470Scael.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 260*47470Scael.Tn ICMP 261*47470Scaelreply. So, the reply will time out on the return path 262*47470Scael(with no notice sent to anyone since 263*47470Scael.Tn ICMP's 264*47470Scaelaren't sent for 265*47470Scael.Tn ICMP's ) 266*47470Scaeluntil 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. 269*47470Scael.Nm Traceroute 270*47470Scaelprints a "!" after the time if the ttl is <= 1. 271*47470ScaelSince vendors ship a lot of obsolete 272*47470Scael.Pf ( Tn DEC Ns \'s 273*47470ScaelUltrix, Sun 3.x) or 274*47470Scaelnon-standard 275*47470Scael.Pq Tn HPUX 276*47470Scaelsoftware, expect to see this problem 27741124Sbosticfrequently and/or take care picking the target host of your 27841124Sbosticprobes. 27941124SbosticOther possible annotations after the time are 280*47470Scael.Sy !H , 281*47470Scael.Sy !N , 282*47470Scael.Sy !P 28341124Sbostic(got a host, network or protocol unreachable, respectively), 284*47470Scael.Sy !S 28541124Sbosticor 286*47470Scael.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 289*47470Scaelalmost all the probes result in some kind of unreachable, 290*47470Scael.Nm traceroute 29141124Sbosticwill give up and exit. 292*47470Scael.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 297*47470Scael.Nm traceroute 29841124Sbosticduring normal operations or from automated scripts. 299*47470Scael.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. 303*47470Scael.Sh SEE ALSO 304*47470Scael.Xr netstat 1 , 305*47470Scael.Xr ping 8 306*47470Scael.Sh HISTORY 307*47470ScaelThe 308*47470Scael.Nm 309*47470Scaelcommand 310*47470Scael.Bt 311