1

I'm trying to setup a multi-homed Debian system so that there is a default route per interface, not just a default route for the system. Its a well known setup, but I can't seem to get it to work and I'm not sure how best to troubleshoot with my limited networking knowledge.

for reference, these have been the primary sources of information I've followed http://www.thegeekstuff.com/2014/08/add-route-ip-command/#comments https://ubuntuforums.org/showthread.php?t=2044148 http://lartc.org/lartc.html#LARTC.RPDB.MULTIPLE-LINKS https://unix.stackexchange.com/questions/4420/reply-on-same-interface-as-incoming

I've tried two approaches

  • change IP route after the interfaces have come up (DHCP/manual)
  • edit the /etc/network/interfaces file to use post-up / post-down (static)

But I only ever end up with one default route.

Here's my routing table after boot up. enter image description here

I've added new IP tables to /etc/iproute2/rt_tables

enter image description here

Then I apply the change manually, but end up with the same ip route output

enter image description here

Here's an example of the latest version of my interfaces file, same result.

enter image description here

I'd like to learn how to troubleshoot this, but also open to a solution.

Thanks

300baud
  • 111
  • 2

1 Answers1

0

Normally, there only is one default route. On a multi-homed device set the default route on the interface that routes to the Internet. In /etc/network/interfaces include a default setting only for that interface. Other interfaces may need additional routes if they have access to routes that aren't local. Try to limit the number of these routes.

It looks like you are trying to do split path routing. Leave off both the default and gateway specifications in the configuration and used the post-up commands to configure the routing. You should need only a few lines per interface such as:

post-up ip route add 192.168.30.0/24 dev eth1 src 192.168.30.100 table T2
post-up ip route add default via 192.168.30.1 table T2
post-up ip route add 192.168.30.0/24 dev eth1 src 192.168.30.100
post-up ip rule add from 192.168.30.100 table T2

You may need to use the command ip rule show to show your routing rule tables.

This will still leave you without a default default route for locally originating traffic. NAT and masquerading add additional complexities.

Using a firewall tool like shorewall may simplify things, especially if you want to track and balance traffic.

BillThor
  • 27,354
  • 3
  • 35
  • 69
  • Hi Bill - thanks for above; will give it a try. Might help to explain my operational scenario. Both interfaces will "go to the internet" via a Ubiquity router. The separation is for different types of traffic. .30 is for IoT only and .10 is Home/Internal (different VLANS upstream). I have a web service that needs to listen to both networks and provides different functionality depending on source. – 300baud Mar 27 '17 at 04:55
  • is the 3rd line in your example required? Lines 1,2,4 relate to the table? – 300baud Mar 27 '17 at 07:08
  • @300baud The 3rd line configures the standard route that would have been installed by the gateway line. It may be possible to leave the gateway line in and remove the 3rd line. Unless you are connecting to the IOT devices, you likely don't need the third line for that interface. If you have split routing requirements for outbound traffic it gets complicated. – BillThor Mar 27 '17 at 22:46