如何查看特定主机的路由

我有一个项目,要求我发送stream量的服务器上的特定端口的服务器有7个以太网端口。 我已经创build了IP规则来将数据从某个主机发送到某个端口。 我可以通过“ip rule show”高兴地查看我的规则

但是,当我创build一个路由来说“使用此网关的主机”我没有看到与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 

当我做netstat -rn的时候,我希望为这个主机指定一个特定的路由。

netstat使用过时的代码来访问路由表。 它从来没有更新过处理多个路由表。 你不应该使用netstat或者ifconfig。 他们没有得到维护,他们会骗你的系统状态。

你添加的路由被添加到一个名为confusingly eth3的ip route add 172.16.2.65 via 172.16.1.1 dev eth3 table eth3 。 netstat只会看到主表,所以这个路由不可见。

如果要查看eth3表的路由,请使用ip route show table eth3ip route show table all