Skip to content

Instantly share code, notes, and snippets.

@clyang
Created September 24, 2015 11:41
Show Gist options
  • Save clyang/423d286dea65e3feb8d1 to your computer and use it in GitHub Desktop.
Save clyang/423d286dea65e3feb8d1 to your computer and use it in GitHub Desktop.
auto eth0
iface eth0 inet static
address 198.51.100.87
netmask 255.255.255.0
gateway 198.51.100.1
post-up ip route add 198.51.100.0/24 dev eth0 table 1
post-up ip route add default via 198.51.100.1 table 1
post-up ip rule add from 198.51.100.87/32 table 1 priority 100
post-up ip route flush cache
pre-down ip rule del from 198.51.100.87/32 table 1 priority 100
pre-down ip route flush table 1
pre-down ip route flush cache
auto eth1
iface eth1 inet static
address 203.0.113.144
netmask 255.255.255.0
post-up ip route add 203.0.113.0/24 dev eth0 table 2
post-up ip route add default via 203.0.113.1 table 2
post-up ip rule add from 203.0.113.144/32 table 2 priority 110
post-up ip route flush cache
pre-down ip rule del from 203.0.113.144/32 table 2 priority 110
pre-down ip route flush table 2
pre-down ip route flush cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment