这是我的ifconfig文件: http : //pastebin.com/5ZUGYbnB
auto eth0 iface eth0 inet static address 180.xxx.xx.68 netmask 255.255.255.248 network 180.xxx.xx.64 broadcast 180.xxx.xx.71 gateway 180.xxx.xx.65 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 180.xxx.xx.65 8.8.8.8 auto eth1 iface eth1 inet static address 10.96.92.23 netmask 255.255.255.0 network 10.96.92.0 broadcast 10.96.92.255 gateway 10.96.92.1 dns-nameservers 10.96.92.11 up route add -net 10.86.82.0 netmask 255.255.255.0 gw 10.96.92.1 down route del -net 10.86.82.0 netmask 255.255.255.0 gw 10.96.92.1
这是我的路由表http://pastebin.com/VVwCe7ZF
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 180.xxx.xx.64 0.0.0.0 255.255.255.248 U 0 0 0 eth0 10.86.82.0 10.96.92.1 255.255.255.0 UG 0 0 0 eth1 10.96.92.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0.0.0.0 180.xxx.xx.65 0.0.0.0 UG 100 0 0 eth0 0.0.0.0 10.96.92.1 0.0.0.0 UG 100 0 0 eth1
但不会将任何数据包转发到其他networking。 我的路由表有问题吗?
首先,你有两条默认路由。 在某些情况下可能会有这种情况,但这不太可能是你想要的。
通常会使用一个默认的路由,对于你我猜你想要使用180.xnetworking上的默认网关。
从eth1定义中删除网关线路。
另一件要检查的是/ proc / sys / net / ipv4 / ip_forward被启用:
'cat / proc / sys / net / ipv4 / ip_forward',检查你得到1,而不是0。
如果你不这样做,你需要启用它,最好的方法是编辑/etc/sysctl.conf并设置net.ipv4.ip_forward = 1
这将得到转发的工作,但如果它仍然没有在这一点上工作(很难说你的要求是没有一个更好的描述你想要实现),你可能需要看看netfilter SNAT或MASQ使用iptables 。
别忘了:
iptables -P FORWARD ACCEPT