Source policy routing - multihoming

From Skytech
Jump to navigation Jump to search

Source policy routing

If a machine has several interfaces, but only 1 default gateway - it is multihomed and unless the gw supports handling packages with 'wrong' source mask, then linux must be told to route packets via the default gw.


Problem: Host has 2 interfaces.

eth2: eth3:

eth2 is primary and reponds to ping - eth3 does not.

Create new routing table (only needs to be done once)

Naming doesn't matter, it just needs to be unique. A telling name makes sense though.

echo 1 webserver_vlan >> /etc/iproute2/rt_tables

Add a default route to this new table going out eth3

  • point to gw on that network
ip route add default via dev eth3 table webserver_vlan

Add a policy rule to use this new table for packets with source address of eth3's IP

  • Use ip of eth3 here.
ip rule add from table webserver_vlan

Lookup new rule

ip rule show