路由问题

luobinshan 2012-08-02 06:01:02
抓包时碰到的问题.
希望数据方向 192.168.0.151 -> 192.168.0.149 -> 192.168.0.1
实际上发现跳过了中间的IP, 这个和哪个优化有关? 怎么能不跳过中间的IP?

linux上的ip设置
ip 192.168.0.151
gw 192.168.0.149
执行traceroute的结果

$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 40 byte packets
1 192.168.0.149 (192.168.0.149) 7.982 ms 0.465 ms 0.337 ms
2 192.168.0.1 (192.168.0.1) 5.953 ms 0.850 ms 218.17.60.1 (218.17.60.1) 29.275 ms
3 113.106.38.157 (113.106.38.157) 36.267 ms 27.925 ms 36.640 ms
4 119.145.220.82 (119.145.220.82) 27.672 ms 47.763 ms 48.450 ms

$ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 40 byte packets
****这里少了一行****
1 192.168.0.1 (192.168.0.1) 1.203 ms 0.865 ms 0.792 ms
2 218.17.60.1 (218.17.60.1) 42.499 ms 29.138 ms 27.112 ms
3 113.106.38.157 (113.106.38.157) 31.566 ms 28.078 ms 28.685 ms


...全文
73 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
luobinshan 2012-08-03
  • 打赏
  • 举报
回复
已经解决, 用sysctl设置以下参数, 每次都会经过中间的IP
net.ipv4.conf.lo.accept_source_route=0
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.eth0.accept_source_route=0
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.lo.accept_redirects=0
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.eth0.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.lo.secure_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.eth0.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.lo.send_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.eth0.send_redirects=0
net.ipv4.conf.default.send_redirects=0
Linux-Torvalds 2012-08-02
  • 打赏
  • 举报
回复
192.168.0.151 -> 192.168.0.149 -> 192.168.0.1

这是同一个网段的。一般来说是不会经过中间那个的。

route -n看看走的是什么路线。

19,613

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧