IP route table with additional default route

Adding  a customer routing table which also has a default route, to be used for example with an OOB connection;

Show currnet routing tables;

cat /etc/iproute2/rt_tables

Add new routing table, ID 20 called "OOB";

echo "20 OOB" >> /etc/iproute2/rt_tables

Add the rest to /etc/rc.local or similar start up script:

# Bring up our secondary interface which is connected to the OOB network
/sbin/ip link set dev eth1 up
# Add the IP address to this interface /sbin/ip addr add dev eth1
# Add a default route on this interface in this custom IP routing table /sbin/ip route add 0/0 via table OOB
ip route show table OOB
# Add a rule to route any traffic that comes from our OOB IP to be routed according # to the routes in the OOB routing table (which simply contains a default route, out via # the same OOB network) /sbin/ip rule add from table OOB

Previous page: 'iptables' - Notes
Next page: Linux Network Tuning