Route eth0 to internet traffic and eth1 to local traffic

Posted by Romain Caire on Super User See other posts from Super User or by Romain Caire
Published on 2012-12-02T08:00:26Z Indexed on 2012/12/02 11:09 UTC
Read the original article Hit count: 217

Filed under:
|
|

How can I route all my internet traffic on eth0 (everything except 192.168.1.0/24) and route my local traffic through eth1 (192.168.1.0)?

Here is my attempt :

# Flush ALL THE THINGS.
ip route flush table main

# Restore the main table.  I flushed it because OpenVPN does weird things to it.
ip route add 127.0.0.0/8 via 127.0.0.1 dev lo
ip route add 0.0.0.0/0 via 164.67.195.1
ip route add 192.168.1.0/24 via 192.168.1.1
ip route flush cache

© Super User or respective owner

Related posts about linux

Related posts about networking