Help with content of /etc/network/interfaces file

Nils Kassube kassube at gmx.net
Mon Feb 22 07:45:20 UTC 2010


Jay Ridgley wrote:
> Nils Kassube wrote:
> > Jay Ridgley wrote:
> >> > When I enter an ifconfig it shows the three nics, however, eth2
> >> > does not have an IP address. If I remove the comment flag(#)
> >> > from the iface line and the auto line my network fails to come
> >> > up. Any examples I have found seem to avoid this type of
> >> > arrangement (two nics doing DHCP one a client (for the internet)
> >> > and one a server (for the Access Point).
> >
> > If I understand it correctly, you have eth0 connected to the
> > internet and you get your configuration via DHCP from your
> > provider. On your eth1 you have a first LAN where your DHCP server
> > should hand out configuration to other machines and on eth2 you
> > have a second LAN via that AP where your DHCP server should also
> > hand out configuration data to other machines.
> 
> Not quite, eth0 is the DHCP client to the provider and provides my
>  connection to the INTERNET.
> 
> eth1 is a second nic on the same machine and eth2 is a third nic.
>  eth1 is a WIRED subnet with STATIC addresses (4 machines here
>  including this one).
> 
> eth2 is for a WIRELESS subnet that is WIRED to the WIRELESS Access
>  Point.

OK, that's more or less what I wrote (or meant to write) but your 
description is much better worded and with some more details.

> > Now, if you uncomment the eth2 entries, there are two interfaces
> > with DHCP entries (eth0 + eth2). These entries mean that the ports
> > should act as DHCP clients. I suppose that's why your network fails
> > to come up.
> 
> eth2 is for a DHCP SERVER not a CLIENT.

Yepp, that is the problem. If you enable the eth2 lines in the 
interfaces file, you try to set it up as dhcp CLIENT. And as there are 
two such dhcp CLIENT entries, it fails.

> >> > iface eth1 inet static
> >> > address 192.168.139.2
> >> > netmask 255.255.255.240
> >> > gateway 192.168.139.2
> >> > broadcast 192.168.139.15
> >
> > Are you sure that the gateway should be the same as the interface
> > itself? That doesn't look right to me. IMHO the gateway should be
> > the address of the internet port, i.e. the address received for
> > eth0.
> 
> 192.168.139.2 is the address of the machine which has the eth1 nic,
>  it is also my gateway, hence the duplication. This part is OK, it
>  has NOT changed.

OK, I understand this, but your entry is for this particular interface, 
not for the entire machine. The gateway for your machine is the 
interface which connects to the internet, i.e. eth0. However your 
gateway entry defines the default route to be via eth1. I suppose it 
works because the dhcp negotiation on eth0 resets the default route 
later on, but IMHO the gateway line should be taken out.

> The problem seems to revolve around the iface eth2 entries in the
>  interfaces file(contained in my original post).

And these lines were this:

| #iface eth2 inet dhcp
| #auto eth2

IMHO you should use a static entry for eth2, something like this:

iface eth1 inet static
 address 192.168.139.33
 netmask 255.255.255.240
 broadcast 192.168.139.47

auto eth2

Sorry, I originally wanted to add this to the previous mail but instead 
of saving it as draft, I sent it away unfinished.

> >> > dhcpd.conf:
> >> >
> >> > #DHCP subnet a wireless Access Point for eth2
> >> >
> >> > subnet 192.168.139.32 netmask 255.255.255.240 {
> >> >      range 192.168.139.35 192.168.139.39;
> >> >          option routers 192.168.139.2;
> >
> > 192.168.139.2 is not in this subnet - I don't think this entry can
> > work.
> 
> 192.168.139.2 is the GATEWAY for my network. What other IP should be
>  used here? Should the option routers be option gateway instead???

Your machine IS the router for your network. Therefore the option name 
"routers" is OK (and according to the dhcpd-options man page there is no 
option gateway). I never played with dhcpd, so I may be wrong, but to my 
understanding "option routers 192.168.139.2;" means that dhcpd tells the 
client that 192.168.139.2 is their router, i.e. their default route, 
where everything is sent which is not in the same subnet as defined by 
the interface configuration. This is OK for your subnet 192.168.139.0/28 
where 192.168.139.2 is inside this subnet. But for 192.168.139.32/28 the 
client's gateway should be the address of your eth2, i.e. 192.168.139.33 
in my example above.


Nils




More information about the ubuntu-users mailing list