ping 返回的TTL数值代表什么?
1 [root@standby ~]# dig @202.106.0.20 www.iqiyi.com
2
3 ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> @202.106.0.20 www.iqiyi.com
4 ; (1 server found)
5 ;; global options: +cmd
6 ;; Got answer:
7 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22053
8 ;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0
9
10 ;; QUESTION SECTION:
11 ;www.iqiyi.com. IN A
12
13 ;; ANSWER SECTION:
14 www.iqiyi.com. 7 IN CNAME static.dns.iqiyi.com.
15 static.dns.iqiyi.com. 6 IN A 111.206.13.65
16 static.dns.iqiyi.com. 6 IN A 111.206.13.63
17 static.dns.iqiyi.com. 6 IN A 111.206.13.61
18 static.dns.iqiyi.com. 6 IN A 111.206.13.64
19 static.dns.iqiyi.com. 6 IN A 111.206.13.62
20 static.dns.iqiyi.com. 6 IN A 111.206.13.66
21
22 ;; Query time: 6 msec
23 ;; SERVER: 202.106.0.20#53(202.106.0.20)
24 ;; WHEN: Thu Sep 15 17:25:09 2016
25 ;; MSG SIZE rcvd: 152
查看一共经历几跳路由
1 [root@standby ~]# traceroute www.iqiyi.com
2 traceroute to www.iqiyi.com (111.206.13.63), 30 hops max, 60 byte packets
3 1 localhost (192.168.1.1) 2.924 ms 2.662 ms 2.429 ms
4 2 * * *
5 3 61.148.174.189 (61.148.174.189) 3.744 ms 3.555 ms 7.079 ms
6 4 124.65.58.237 (124.65.58.237) 6.910 ms 6.263 ms 6.062 ms
7 5 61.51.115.106 (61.51.115.106) 5.852 ms 5.635 ms 5.420 ms
8 6 bt-211-046.bta.net.cn (202.106.211.46) 6.722 ms 8.319 ms 8.019 ms
9 7 111.206.13.63 (111.206.13.63) 7.183 ms 3.643 ms 6.609 ms
10 [root@standby ~]#
查看返回的TTL
1 [root@standby ~]# ping www.iqiyi.com
2 PING static.dns.iqiyi.com (111.206.13.63) 56(84) bytes of data.
3 64 bytes from 111.206.13.63: icmp_seq=1 ttl=58 time=7.56 ms
4 64 bytes from 111.206.13.63: icmp_seq=2 ttl=58 time=9.46 ms
5 ^C
6 --- static.dns.iqiyi.com ping statistics ---
7 2 packets transmitted, 2 received, 0% packet loss, time 1957ms
8 rtt min/avg/max/mdev = 7.569/8.516/9.464/0.951 ms
9 [root@standby ~]#
64 - 6 = 58
已知经过6跳路由,那么我们尝试设置ttl为6进行试验:
1 [root@standby ~]# ping -c 3 -t 6 www.iqiyi.com
2 PING static.dns.iqiyi.com (111.206.13.66) 56(84) bytes of data.
3 From bt-211-046.bta.net.cn (202.106.211.46) icmp_seq=1 Time to live exceeded
4 From bt-211-046.bta.net.cn (202.106.211.46) icmp_seq=2 Time to live exceeded
5 From bt-211-046.bta.net.cn (202.106.211.46) icmp_seq=3 Time to live exceeded
6
7 --- static.dns.iqiyi.com ping statistics ---
8 3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2017ms
已知经过6跳路由,那么我们尝试设置ttl为7进行试验:
1 [root@standby ~]# ping -c 3 -t 7 www.iqiyi.com
2 PING static.dns.iqiyi.com (111.206.13.65) 56(84) bytes of data.
3 64 bytes from 111.206.13.65: icmp_seq=1 ttl=58 time=6.25 ms
4 64 bytes from 111.206.13.65: icmp_seq=2 ttl=58 time=12.1 ms
5 64 bytes from 111.206.13.65: icmp_seq=3 ttl=58 time=5.23 ms
6
7 --- static.dns.iqiyi.com ping statistics ---
8 3 packets transmitted, 3 received, 0% packet loss, time 2008ms
9 rtt min/avg/max/mdev = 5.233/7.885/12.167/3.057 ms
10 [root@standby ~]#