我有一个项目,要求我在服务器上发送一个特定的端口,服务器有7个以太网端口。我已经创建了IP规则来将数据从某个主机发送到某个端口。我可以很高兴地通过"ip规则显示“查看我的规则。
但是,当我创建一个路由来表示“使用此网关用于此主机”时,我看不到Netstat的特定主机路由。
ip route add 172.16.2.65 via 172.16.1.1 dev eth3 table eth3当我执行netstat -rn时,我希望为这个主机提供一个特定的路由。这是正确的吗?我看不出这条具体的主机路线。Netstat -rn是正确的命令吗?任何想法。谢谢。
[18:29:20] shock:/home/debug # netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth3
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth4
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth5
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth6
0.0.0.0 172.16.1.1 0.0.0.0 UG 0 0 0 eth0发布于 2015-02-04 23:41:25
当我执行netstat -rn时,我希望为这个主机提供一个特定的路由。
netstat使用过时的代码访问路由表。它从未被更新以处理多个路由表。您不应该使用netstat或ifconfig。他们没有被维护,他们会对你们的系统的状态撒谎。
您添加的路由被添加到一个名为eth3 ip route add 172.16.2.65 via 172.16.1.1 dev eth3 table eth3的备用表中。netstat只会看到主表,因此这个路由是不可见的。
如果要查看eth3表的路由,请使用ip route show table eth3或ip route show table all。
https://serverfault.com/questions/665103
复制相似问题