Skip to content

Instantly share code, notes, and snippets.

@jriguera
Created February 3, 2016 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jriguera/e2029a760f7a6db6820c to your computer and use it in GitHub Desktop.
Save jriguera/e2029a760f7a6db6820c to your computer and use it in GitHub Desktop.
Debian/Ubuntu interfaces with routing tables
auto bond0.502
# Static interface with an address, will be brought up directly on boot.
iface bond0.502 inet static
address 10.10.11.10
netmask 255.255.248.0
#gateway 10.10.8.1
vlan-raw-device bond0
post-up grep -q " live" /etc/iproute2/rt_tables || echo "202 live" >> /etc/iproute2/rt_tables
post-up ip rule add from 10.10.11.10 table live
post-up ip route add table live default via 10.10.8.1
post-up ip route add table live 10.10.8.1 via 10.10.11.10 dev bond0.502
post-down ip rule delete from 10.10.11.10 table live
post-down ip route flush table live
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment