Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
    
have you tried altering settings in edit wireless/wired connections after ubuntu starts? –  BlackDivine Sep 12 '11 at 14:18
    
@IsaacS is this a client or server that you are having an issue with? If a client - I presume you are asking how to configure Network Manager via its GUI? –  fossfreedom Sep 12 '11 at 14:44
    
@BlackDivine thx, but I guess I don't know what "edit wireless/wired connections" you mentioned means.. –  IsaacS Sep 12 '11 at 15:01
    
@fossfreedom thx, I think I should respond as "client". This is what I use as desktop computer with GUI. I don't mind the solution is either via commandline or GUI. –  IsaacS Sep 12 '11 at 15:03
add comment

migrated from stackoverflow.com Sep 12 '11 at 14:27

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 1 down vote accepted
  1. Click your network icon
  2. Edit connections.
  3. Select the first wired connection (eth0)
  4. Edit
  5. In the IPv4 settings, click Routes.
  6. Check the bottom box.

I think that should do it, but I haven't actually tried it myself, so it would be nice with a comfirmation.

share|improve this answer
    
Thanks. If the "bottom box" in the step 6 is "Use this connection only for resources on its network", then unfortunately checking it (and reboot) didn't change the situation as I tried just now. –  IsaacS Sep 12 '11 at 15:10
    
I don't use English, so I don't recall exactly what it says. :) Perhaps you can also ignore automatically discovered routes? I seem to remember having done something like that once. –  Jo-Erlend Schinstad Sep 12 '11 at 16:03
    
Thanks again. I checked both checkboxes and rebooted OS but no good. –  IsaacS Sep 16 '11 at 0:50
    
as I updated my original question, I somehow solved the issue, based upon your hints. Thanks! –  IsaacS Oct 23 '11 at 4:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.