D'oh!

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed Dec 12 14:57:40 UTC 2007


On Wed, Dec 12, 2007 at 08:37:33AM -0500, Tyler Aviss wrote:
> Could you clarify what the issues might be with this config? I've had
> it working for years this way without any issues thus far.

Certainly in the past I have seen that dhcp clients refuse to work on an
interface that already has an IP, or in other cases they will delete the
other interfaces and then get a dhcp address.

It is also normal to use dhcp for dynamic clients (although you can also
map them by mac address which I actually tend to do), and certainly only
for clients needing a single IP.  Servers needing multiple IPs on one
network for some reason (like web servers with multiple https addresses)
tend to be entirely static IPs.

> On Dec 11, 2007 11:03 AM, Lennart Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org> wrote:
> >
> > On Tue, Dec 11, 2007 at 10:11:24AM -0500, Chris Aitken wrote:
> > > Chris Aitken wrote:
> > >
> > > <snip>
> > >
> > > This is getting worse. I found a site that advises how to set a static
> > > ip. Unfortunately I couldn't find instructions how to set up static (for
> > > local network) AND dhcp-assigned (for Internet). I should have printed
> > > out my /etc/network/interfaces file but didn't - so now I don't have the
> > > default to reset it to to at least get my Internet back. So, here's the
> > > butchered /etc/network/interfaces file (maybe you can see what I am
> > > trying to do):
> > >
> > > #primary network interface
> > > auto eth0:1
> > > iface eth0:1 inet static
> > > address 192.168.0.2
> > > netmask 255.255.255.0
> > > network 192.168.0.0
> > > broadcast 192.168.0.255
> > > gateway 192.168.0.1
> > >
> > > #iface eth0 inet dhcp
> > > address 192.168.0.225
> > > netmask 255.255.255.0
> > > gateway 192.168.0.1

Of course on closer inspection I see that only eth0:1 is set to start
(the auto line), while the other is actually commented out, although I
wonder if blank lines break sections, or if iface lines break sections.
After all if blank lines don't break sections, the above actuall has two
address lines for eth0:1 telling it first to be .2 then to be .225, and
only one of them can win.  Hopefully blank lines do break sections.  The
documentation seems to simply say options follow on subsequent lines,
which I guess could be read to mean blank lines end a section since it
would no longer be subsequent.  If that is the case, the last 3 lines
above simply do nothing as they are not valid.  Of course then it would
make more sense to delete the last 4 lines entirely, and change eth0:1
to eth0 everywhere else since it is already the only interface enabled.
The only thing left to do would be to make sure there is a name-server
listed in /etc/resolv.conf, which dhcp often takes care of, but for
static IPs you have to do it manually.  If it is using resolvconf to
manage /etc/resolv.conf then it has to be added using the command:

echo name-server 192.168.0.1 | resolvconf -a eth0

Assuming 192.168.0.1 is in fact the nameserver.  If resolvconf is not in
use then one just adds the name-server line to /etc/resolv.conf
manually.

--
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list