I have 2 connections: wlan0 (gw: 192.168.1.1) and eth0 (gw: 192.168.2.1).
My default connection is wlan0, but I wanted some websites load through my eth0, so I set up routing for those websites/IPs like this:
Code:
route add -net 31.135.208.0/21 gw 192.168.2.1 dev eth0
This works, however is not permanent (disappears after reboot). I tried to put this code in /etc/network/interfaces like this:
Code:
up route add -net 31.135.208.0/21 gw 192.168.2.1 dev eth0
but when I restart Ubuntu, it starts without networking (it crashes). I also put these lines into that file:
Code:
auto eth0
address 192.168.2.125
gateway 192.168.2.1
netmask 255.255.255.0
but still system boots without networking.
Currently I have put route command into /etc/rc.local, it works, but it is not permanent, because when I restart/re-connect my eth0 (for some reason), routing disappears.
Some notes:
I have long list of IPs to route.
My router, which I connected eth0 is set to DHCP.
I tried to connect eth0 both static and DHCP way.
So, how do I set permanent routing?
Thanks for you help!
Bookmarks