码迷,mamicode.com
首页 > 系统相关 > 详细

修改Linux服务器的ttl值

时间:2017-02-09 11:28:53      阅读:329      评论:0      收藏:0      [点我收藏+]

标签:服务器   off   网卡   tcp   nbsp   capture   详细信息   avg   apt   

[root@test_android_client_download ~]# cat /etc/sysctl.conf |grep net.ipv4.ip_default_ttl
net.ipv4.ip_default_ttl = 28
[root@test_android_client_download ~]# sysctl -p

 

[root@test_android_client_download ~]# ping 127.0.0.1 -c 1

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=28 time=0.044 ms

--- 127.0.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.044/0.044/0.044/0.000 ms

#抓包  -i 指定网卡 -t 指定协议 -nv 显示详细信息

[root@test_android_client_download ~]# tcpdump -i eth1 -n -v -t icmp
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
IP (tos 0x0, ttl 28, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
    112.124.111.141 > 180.149.132.47: ICMP echo request, id 62590, seq 1, length 64
IP (tos 0x14, ttl 53, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
    180.149.132.47 > 112.124.111.141: ICMP echo reply, id 62590, seq 1, length 64
IP (tos 0x0, ttl 28, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
    112.124.111.141 > 180.149.132.47: ICMP echo request, id 62590, seq 2, length 64
IP (tos 0x14, ttl 53, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
    180.149.132.47 > 112.124.111.141: ICMP echo reply, id 62590, seq 2, length 64

如果把net.ipv4.ip_default_ttl = 1 服务器会上不去网,不能远程连接服务器,可以用内网连接,修改参数,恢复上网

修改Linux服务器的ttl值

标签:服务器   off   网卡   tcp   nbsp   capture   详细信息   avg   apt   

原文地址:http://www.cnblogs.com/liuyoushui/p/6381192.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!