Sysadmin > LinuX > PolicyBasedRouting

Policy based routing

  1. echo 200 custom >> /etc/iproute2/rt_tables
  2. edit /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback

# Management Interface
auto eth0
iface eth0 inet static
        address 10.135.169.27
        netmask 255.255.255.240
        network 10.135.169.16
        broadcast 10.135.169.31
        post-up ip route add 10.135.169.16/28 dev eth0 src 10.135.169.27 table mgmt
        post-up ip route add default via 10.135.169.17 dev eth0 table mgmt
        post-up ip rule add from 10.135.169.27/32 table mgmt
        post-up ip rule add to   10.135.169.27/32 table mgmt

# Produktives Interface
auto eth1
iface eth1 inet static
        address 10.135.169.11
        netmask 255.255.255.240
        network 10.135.169.0
        broadcast 10.135.169.15
        gateway 10.135.169.1

dns-nameservers 10.131.41.12 10.135.169.10