Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Ubuntu 12.10 box has two network cards, Ethernet card (Eth0) is connected to internal network ( without any internet access, Wireless card (Wlan0) is connected to intranet (, which has internet access. When I try to access internet, I have to disable Ethernet card (Eth0). Is there any way to config ip route from Ubuntu, something like Wlan0, so I can access internet without disable Ethernet 0 card. Thanks for your help.


share|improve this question
up vote 0 down vote accepted

First use the route command to find out what your current routing table looks like. It will probably look somewhat like this:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    0      0        0 eth0    *        U     1      0        0 eth0     *        U     1      0        0 wlan0

Now you will want to replace the default gateway by a gateway on the 10.124.64/24 net. You can find out its IP by running route when eth0 is disabled or unplugged. Assuming it is the .1, you would then execute:

route del default
route add default gw

If you want to automate this, you could add these commands to an up statement in the appropriate stanza in /etc/network/interfaces (see man interfaces).

DISCLAIMER: route is considered old fashioned and I ought to be doing this using the ip route command; the effect however is identical. Also, adding an up statement to /etc/network/interfaces may be perceived by some as pre-historic. I'll be happy to upgrade my knowledge.

share|improve this answer

Your Answer


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.