We managed to connect our servers to two distinct networks and everything works fine. We use routing rules that ensure that server responds to the right network.
I followed the instructions under this link: http://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System#Configuring_the_New_Routing_Table
Now I encounter the following problem: I I restart the server, only one routing-configuration (rt3) is established. Only the second set of post-up commands seems to work automatically.
I can solve this problem easily buy then executing the first set of post-up commands (rt2) manually and everything will be working as expected.
But of course the post-up commands should be executed automatically.
This is our interfaces-file:
# 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
Once executing the commands for rt2 manually, everything is perfect and we had this configuration running for weeks without any issues.
the rt_tables file is as follows:
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
1 rt2
2 rt3
post-up sleep 10
(or some other number of seconds) before the otherpost-up
commands?gateway
option) makes one setup fail.