6

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
5
  • Just out of curiosity, what happens if you put a post-up sleep 10 (or some other number of seconds) before the other post-up commands?
    – Gene
    Oct 19, 2014 at 8:59
  • No change - same behaviour
    – ChrisZZ
    May 12, 2015 at 17:13
  • Got the same problem > Did you ever solved it?
    – Michel
    Jan 13, 2019 at 13:34
  • It's difficult to distinguish xxx.xxx.xxx.xxx from xxx.xxx.xxx.xxx or xxx.xxx.xxx.xxx in this question... this would certainly help solve it.
    – A.B
    Oct 9, 2021 at 18:57
  • My guess: defining two default routes in the main table (through the gateway option) makes one setup fail.
    – A.B
    Apr 18 at 14:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.