Two interfaces on DHCP assign two default gateways

Asked by Martin A. Rubio

Hi,

I have a Ubuntu box that has two networking interfaces (eth0 and wlan0). They are both configured for DHCP in /etc/network/interfaces, but they both assign a default gateway:

-- /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
wireless-essid test
--

-- Result of 'route -n'
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.16.1.1 0.0.0.0 UG 100 0 0 wlan0
0.0.0.0 10.0.0.1 0.0.0.0 UG 100 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
--

How can I set up /etc/network/interfaces to have only one default gateway, on the interface I want ?

Worst case scenario, how can I at least control which one gets on top on the 'route -n' command, each boot?

NOTE 1: This box will travel a lot, and will be connected to different networks, so I don´t know in advance the IP addresses/ranges it will have.

NOTE 2: Sometimes the default gw interface will be eth0. Sometimes it will be wlan0 ... So, this needs to be kind of automatic ...

Hope someone can help me out ;)

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu dhcp Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

why are you not using network manager to manage your interfaces?

Revision history for this message
Martin A. Rubio (martinalbertorubio) said :
#2

This is a Ubuntu Server 9.04 running on an ARM processor. It doesn´t have a GUI, it is all command-line ...

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Jaunty is no longer supported in any way. I suggest you upgrade to Precise using a clean install. Not only is it LTS but is also the latest stable release.

Revision history for this message
Martin A. Rubio (martinalbertorubio) said :
#4

This is running on a special hardware, and Ubuntu as not been able to provide a kernel for this above 9.04 ... This is the latest version we can run on this hardware (in fact, we are debating on moving next version to Debian, which allows newer kernels and better support for our hardware) ...

I am NOT reporting a bug on an old release, I am trying to solve a problem that also presents itself on Ubuntu 11.10 and 12.04 (as tested on i686 boxes) ...

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Its still not supported. Go ask Microsoft for Windows 95 support. Its the same thing

Revision history for this message
Martin A. Rubio (martinalbertorubio) said :
#6

I am telling you the problem has been reproduced on latest Ubuntu ... It is basic networking question that anyone who has worked with two DHCP interfaces at the same time before encountered, and probably solved ... If you have not seen it before, and/or don´t know how to fix it, simply leave it for others to answer please ....

Your metaphore of Win95 does not apply here. It is like saying "Buy a brand new Ford Mustang" to your dad, when he tells you that his classic 1965 Ford Mustang has a little noise ... ;)

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#7

Jaunty is EOL and not supported

Can you help with this problem?

Provide an answer of your own, or ask Martin A. Rubio for more information if necessary.

To post a message you must log in.