Linux Command – traceroute ใช้ในการแสดงเส้นทางการทำงาน network
traceroute <IP/Domain name>
$ traceroute google.com traceroute to google.com (184.108.40.206), 30 hops max, 60 byte packets 1 10.10.1.1 (10.10.1.1) 0.174 ms 0.170 ms 0.185 ms 2 10.253.224.1 (10.253.224.1) 38.580 ms 38.592 ms 38.600 ms 3 10.87.247.177 (10.87.247.177) 38.640 ms 38.669 ms 38.697 ms 4 58-97-83-137.static.asianet.co.th (220.127.116.11) 38.710 ms 58-97-83-129.static.asianet.co.th (18.104.22.168) 38.655 ms 58-97-83-137.static.asianet.co.th (22.214.171.124) 38.716 ms 5 58-97-82-118.static.asianet.co.th (126.96.36.199) 38.671 ms 210-86-142-48.static.asianet.co.th (188.8.131.52) 38.797 ms 58-97-82-124.static.asianet.co.th (184.108.40.206) 38.696 ms 6 ppp-171-102-254-97.revip18.asianet.co.th (220.127.116.11) 38.709 ms ppp-171-102-254-65.revip18.asianet.co.th (18.104.22.168) 8.504 ms ppp-171-102-254-97.revip18.asianet.co.th (22.214.171.124) 13.218 ms 7 ppp-171-102-254-228.revip18.asianet.co.th (126.96.36.199) 22.129 ms 12.999 ms 13.288 ms 8 210-86-143-72.static.asianet.co.th (188.8.131.52) 14.239 ms 14.371 ms 14.388 ms 9 TIG-Net242-34.trueintergateway.com (184.108.40.206) 20.143 ms TIG-Net242-32.trueintergateway.com (220.127.116.11) 17.507 ms 17.526 ms 10 18.104.22.168 (22.214.171.124) 76.027 ms 76.049 ms 76.069 ms 11 126.96.36.199 (188.8.131.52) 43.801 ms 43.822 ms 30.704 ms 12 184.108.40.206 (220.127.116.11) 34.940 ms 35.393 ms 32.426 ms 13 kul06s17-in-f238.1e100.net (18.104.22.168) 33.239 ms 37.668 ms 37.328 ms
traceroute [-46dFITUnreAV] [-f first_ttl] [-g gate,...] [-i device] [-m max_ttl] [-p port] [-s src_addr] [-q nqueries] [-N squeries] [-t tos] [-l flow_label] [-w waittime] [-z sendwait] [-UL] [-D] [-P proto] [--sport=port] [-M method] [-O mod_options] [--mtu] [--back] host [packet_len] traceroute6 [options] tcptraceroute [options] lft [options]
เป็นคำสั่งที่ใช้ในการแสดงเส้นทางการทำงาน network หรือ routing มากสุดที่ 30 hop
--help Print help info and exit. -4, -6 Explicitly force IPv4 or IPv6 tracerouting. By default, the program will try to resolve the name given, and choose the appropriate protocol automatically. If resolving a host name returns both IPv4 and IPv6 addresses, traceroute will use IPv4. -I, --icmp Use ICMP ECHO for probes -T, --tcp Use TCP SYN for probes -d, --debug Enable socket level debugging (when the Linux kernel supports it) -F, --dont-fragment Do not fragment probe packets. (For IPv4 it also sets DF bit, which tells intermediate routers not to fragment remotely as well). Varying the size of the probing packet by the packet_len command line parameter, you can manually obtain information about the MTU of individual network hops. The --mtu option (see below) tries to do this automatically. Note, that non-fragmented features (like -F or --mtu) work properly since the Linux kernel 2.6.22 only. Before that version, IPv6 was always fragmented, IPv4 could use the once the discovered final mtu only (from the route cache), which can be less than the actual mtu of a device. -f first_ttl, --first=first_ttl Specifies with what TTL to start. Defaults to 1. -g gateway, --gateway=gateway Tells traceroute to add an IP source routing option to the outgoing packet that tells the network to route the packet through the specified gateway (most routers have dis‐ abled source routing for security reasons). In general, several gateway's is allowed (comma separated). For IPv6, the form of num,addr,addr... is allowed, where num is a route header type (default is type 2). Note the type 0 route header is now deprecated (rfc5095). -i interface, --interface=interface Specifies the interface through which traceroute should send packets. By default, the interface is selected according to the routing table. -m max_ttl, --max-hops=max_ttl Specifies the maximum number of hops (max time-to-live value) traceroute will probe. The default is 30. -N squeries, --sim-queries=squeries Specifies the number of probe packets sent out simultaneously. Sending several probes concurrently can speed up traceroute considerably. The default value is 16. Note that some routers and hosts can use ICMP rate throttling. In such a situation specifying too large number can lead to loss of some responses. -n Do not try to map IP addresses to host names when displaying them. -p port, --port=port For UDP tracing, specifies the destination port base traceroute will use (the destination port number will be incremented by each probe). For ICMP tracing, specifies the initial ICMP sequence value (incremented by each probe too). For TCP and others specifies just the (constant) destination port to connect. When using the tcptraceroute wrapper, -p specifies the source port. -t tos, --tos=tos For IPv4, set the Type of Service (TOS) and Precedence value. Useful values are 16 (low delay) and 8 (high throughput). Note that in order to use some TOS precedence values, you have to be super user. For IPv6, set the Traffic Control value. -l flow_label, --flowlabel=flow_label Use specified flow_label for IPv6 packets. -w waittime, --wait=waittime Set the time (in seconds) to wait for a response to a probe (default 5.0 sec). -q nqueries, --queries=nqueries Sets the number of probe packets per hop. The default is 3. -r Bypass the normal routing tables and send directly to a host on an attached network. If the host is not on a directly-attached network, an error is returned. This option can be used to ping a local host through an interface that has no route through it. -s source_addr, --source=source_addr Chooses an alternative source address. Note that you must select the address of one of the interfaces. By default, the address of the outgoing interface is used. -z sendwait, --sendwait=sendwait Minimal time interval between probes (default 0). If the value is more than 10, then it specifies a number in milliseconds, else it is a number of seconds (float point val‐ ues allowed too). Useful when some routers use rate-limit for ICMP messages. -e, --extensions Show ICMP extensions (rfc4884). The general form is CLASS/TYPE: followed by a hexadecimal dump. The MPLS (rfc4950) is shown parsed, in a form: MPLS:L=label,E=exp_use,S=stack_bottom,T=TTL (more objects separated by / ). -A, --as-path-lookups Perform AS path lookups in routing registries and print results directly after the corresponding addresses. -V, --version Print the version and exit. There are additional options intended for advanced usage (such as alternate trace methods etc.): --sport=port Chooses the source port to use. Implies -N 1. Normally source ports (if applicable) are chosen by the system. --fwmark=mark Set the firewall mark for outgoing packets (since the Linux kernel 2.6.25). -M method, --module=name Use specified method for traceroute operations. Default traditional udp method has name default, icmp (-I) and tcp (-T) have names icmp and tcp respectively. Method-specific options can be passed by -O . Most methods have their simple shortcuts, (-I means -M icmp, etc). -O option, --options=options Specifies some method-specific option. Several options are separated by comma (or use several -O on cmdline). Each method may have its own specific options, or many not have them at all. To print information about available options, use -O help. -U, --udp Use UDP to particular destination port for tracerouting (instead of increasing the port per each probe). Default port is 53 (dns). -UL Use UDPLITE for tracerouting (default port is 53). -D, --dccp Use DCCP Requests for probes. -P protocol, --protocol=protocol Use raw packet of specified protocol for tracerouting. Default protocol is 253 (rfc3692). --mtu Discover MTU along the path being traced. Implies -F -N 1. New mtu is printed once in a form of F=NUM at the first probe of a hop which requires such mtu to be reached. (Actually, the correspond "frag needed" icmp message normally is sent by the previous hop). Note, that some routers might cache once the seen information on a fragmentation. Thus you can receive the final mtu from a closer hop. Try to specify an unusual tos by -t , this can help for one attempt (then it can be cached there as well). See -F option for more info. --back Print the number of backward hops when it seems different with the forward direction. This number is guessed in assumption that remote hops send reply packets with initial ttl set to either 64, or 128 or 255 (which seems a common practice). It is printed as a negate value in a form of '-NUM' .
ping(8), ping6(8), tcpdump(8), netstat(8)
Author: Suphakit Annoppornchai