[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: screwed up my network starting



H.S. wrote:
> Earlier, my network card was being monitored by network manager.
> Recently due to various changes, I had the need to give my network card
> a fixed address. To do so, I took out the following line from
> /etc/network/interfaces:
> # The primary network interface
> #allow-hotplug eth0
> #NetworkManager#iface eth0 inet dhcp
> 
> And inserted the following (dhcp address is always a fixed one from the
> router):
> auto eth0
> iface eth0 inet dhcp

All good.  Or at least okay.

Instead or in addition to 'auto eth0' you would benefit from having
'allow-hotplug eth0' there as well.  That line you commented out is
good to leave uncommented.  That will allow it to work under the new
event driven system.  The 'auto eth0' configures it for the older
static driven system.  (Which is why you get the deprecated message
when you run 'service networking restart'.)  It is okay to have both
specified, I usually do.  The format and contents of the file are
documented here:

  http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_network_interface_with_the_static_ip

> ##iface eth0 inet static
> ##     address 192.168.1.139
> ##     network 192.168.1.0
> ##     netmask 255.255.255.0
> ##     broadcast 192.168.1.255
> ##     gateway 192.168.1.1

It has become my banner to wave that the netmask is sufficient and
then the tool can calculate the network and broadcast values.  It is
better than specifying them.  So if you choose to use the above then
you would be better off removing the nework and broadcast lines.

It used to be that the debian-installer would create those as
examples.  But those examples have been removed and the d-i no longer
creates those.  Recently there has been a push to clean these up so
that they are no longer distributing such examples.  Here is a
reference:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630551

> ##     nameserver 208.67.222.222 208.67.220.220

That line I do not recognize and looks bogus.  Perhaps you meant to
say something like:

	dns-search example.com
	dns-nameservers 208.67.222.222 208.67.220.220

That is consumed by 'resolvconf', if installed, and propagated.  If you
do not have resolvconf installed then the above isn't consumed and
isn't used.

> Now, at various changes, e.g. when I plugin in the Tomtom usb device
> (which appears at a network device(!) ), I lose dns information. I can
> fix that by manually specifying the nameserver in /etc/resolv.conf, but
> what I am sure is why and who erases that from the resolv.conf file.

Since you are using dhcp to configure the interface then the dhclient
will set up /etc/resolv.conf as per the information from the dhcpd
server that gave out the address.  Every time you dhcp an address the
/etc/resolv.conf will be updated.

If your usb device appears as a network device I think it may be
confusing NetworkManager.  It is possible and perhaps likely that
NetworkManager is trying to set up this newly hotplugged interface,
that is what NM is designed to do, and then updating /etc/resolv.conf.
However this being the root of the issue is pure speculation on my
part.  It seems odd to me that your device would appear as a network
device.

> The major thing that changed is that I am now using a different
> router in a shared connection

The words "in a shared connection" has no meaning to me.  Isn't all
networking shared by definition?  You can't network a single device.
It takes two to tango.

> (earlier, I was using my own router running Tomato).

A good system.  I wish Tomato would be updated in the mainstream with
a version that supported OpenVPN in the stock version.

> I can get the networking to work (at least I
> think so), using the following lines in interfaces:
>
> auto eth0
> allow-hotplug eth0
> iface eth0 inet dhcp

Looks perfect!

> Is this the right way to do so?

Yes.

> And, how do I setup the nameservers I should be using?

If you are using DHCP then the DHCP server will specify the
nameservers to use to the client.  Specify the right nameservers there
and you will be done.

> How do I tell this "auto-configuration" to ignore the dhcp
> nameservers and to use the ones I specify instead?

I haven't tried this but I would install 'resolvconf' and then specify
them with the dns-nameservers option listed above.  I think that will
override the dhcpd nameservers.  I think.

  auto eth0
  allow-hotplug eth0
  iface eth0 inet dhcp
        dns-search example.com
	dns-nameservers 208.67.222.222 208.67.220.220

Please report the results either way.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: