Skip to content

Instantly share code, notes, and snippets.

@tiernano
Created April 2, 2016 17:15
Show Gist options
  • Save tiernano/a9a642c4d029c0dcf8beb926b3588991 to your computer and use it in GitHub Desktop.
Save tiernano/a9a642c4d029c0dcf8beb926b3588991 to your computer and use it in GitHub Desktop.
# Inserting routes in the adsl1 table
ip route add 192.168.1.0/24 dev eth0 scope link table adsl1
ip route add default via 192.168.1.1 dev eth0 table adsl1
# Inserting routes in the adsl2 table
ip route add 192.168.2.0/24 dev eth0 scope link table adsl2
ip route add default via 192.168.2.1 dev eth0 table adsl2
# ip rule is the source routing magic. This will redirect
# packets coming from source "X" to table "adsl1", "adsl2" or "default".
ip rule add from 192.168.1.0/24 table adsl1
ip rule add from 192.168.2.0/24 table adsl2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment