我们设法将我们的服务器连接到两个不同的networking,一切正常。 我们使用路由规则来确保服务器响应正确的networking。
我按照此链接下的说明: http : //www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System#Configuring_the_New_Routing_Table
现在我遇到以下问题:II重启服务器,只有一个路由configuration(rt3)build立。 只有第二套后续命令似乎自动工作。
我可以很容易地解决这个问题,然后手动执行第一套后续命令(rt2),一切都将按预期工作。
当然,后续命令应该自动执行。
这是我们的接口文件:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 allow-hotplug eth0 iface eth0 inet static address xxx.xxx.xxx.xxx netmask 255.255.255.0 broadcast xxx.xxx.xxx.xxx gateway xxx.xxx.xxx.xxx dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx 4.2.2.2 8.8.4.4 post-up ip route add xxx.xxx.xxx.xxx/24 dev eth0 src xxx.xxx.xxx.xxx table rt2 post-up ip route add default via xxx.xxx.xxx.xxx dev eth0 table rt2 post-up ip rule add from xxx.xxx.xxx.xxx/32 table rt2 post-up ip rule add to xxx.xxx.xxx.xxx/32 table rt2 # The secondary network interface auto eth1 allow-hotplug eth1 iface eth1 inet static address xxx.xxx.xxx.xxx netmask 255.255.255.0 broadcast xxx.xxx.xxx.xxx gateway xxx.xxx.xxx.xxx dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx 4.2.2.2 8.8.4.4 post-up ip route add xxx.xxx.xxx.xxx/24 dev eth1 src xxx.xxx.xxx.xxx table rt3 post-up ip route add default via xxx.xxx.xxx.xxx dev eth1 table rt3 post-up ip rule add from xxx.xxx.xxx.xxx/32 table rt3 post-up ip rule add to xxx.xxx.xxx.xxx/32 table rt3
一旦手动执行rt2的命令,一切都是完美的,我们有这个configuration运行几个星期没有任何问题。
rt_tables文件如下:
# # reserved values # 255 local 254 main 253 default 0 unspec # # local # #1 inr.ruhep 1 rt2 2 rt3