My Ubuntu machine is connected to internet via wifi, and also connected to LAN by ethernet cable. Every time I log on, I have to run these 2 commands in order to set the proper gateway (wlan0 in my case) so that I can access internet.
% sudo route del default % sudo route add default gw 192.168.3.1
To automate, I've tried several things that I've found on internet but didn't work so far. Though can't remember all of them, one of them is this:
(In /etc/network/interfaces, add the followings and reboot) up route del default up route add -net 192.168.3.0/24 gw 192.168.3.1 dev wlan0
The result of route command right after boot (before running the operation shown above, 10.0.* is LAN) shows that eth0 is still set default gw against my desire:
Destination Gateway Genmask Flags Metric Ref Use Iface 10.0.193.0 * 255.255.255.0 U 1 0 0 eth0 192.168.3.0 * 255.255.255.0 U 2 0 0 wlan0 link-local * 255.255.0.0 U 1000 0 0 eth0 default 10.0.193.1 0.0.0.0 UG 0 0 0 eth0
I use Ubuntu 11.04
Has anyone got a direct solution?
Update 10/22/11) Since I might have changed many configurations, I don't know only these changes are the ones that take effect, but here are my solution. Now the computer allows both internet (wlan0) and local (eth0) on boot.
(as the chosen answer indicates) Check both "Ignore automatically obtained routes" & "use this connection only for resources on its network"
Modify /etc/network/interfaces as follows:
auto lo iface lo inet loopback up route del default up route add -net 192.168.1.0/24 gw 192.168.1.1 dev wlan0