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

Re: unable to get /etc/resolv.conf and /etc/network/interfaces configured properly in wheezy



On Sun, Aug 18, 2013 at 9:29 PM, Bob Proulx <bob@proulx.com> wrote:
> Mark Copper wrote:
>> With resolvconf package installed and configured for dynamic
>> generation of /etc/resolv.conf, I was *unable* to get any non-local
>> nameservers written into /etc/resolv.conf.
>
> Works for me.  What version of Debian are you using?  Stable Wheezy 7?
> Other?  There have been recent changes and the problem may be version
> specific.

wheezy (sorry not to include in text)


>> and I tried nameserver lines in the "base" resolvconf config file.
>
> Not the expected way to go.

True, but it's a documented alternative.  and the fact it doesn't work
might be a pointer to the root cause of the problem.

>
>> Neither worked after a networking reload/restart.
>
> Just to clarify.  You are on the system console.  You are not working
> over the network to the machine, right?  You can restart networking as
> you need?

the machine is remote.  remote hands are available to me (but
communication can be a problem since I don't have a remote console
available).

>
>> Documentation shown when going through dpkg-reconfigure for resolvconf
>> says that a reboot is necessary to make sure all components work
>> together as they should.
>
> The documentation does say that.  Mostly because there are so many
> different possibilities that it is impractical to document it.  And if
> it were documented most humans would be too impatient to read it.
> Saying to reboot the system is just easier and definitely covers the
> task.

well put.

>> Previously, my file followed this format for multiple IP addresses on
>> a single nic like this (cf
>> https://wiki.debian.org/NetworkConfiguration):
>>
>> auto eth0 eth0:1
>>
>> iface eth0 inet static
>>     address 192.168.1.42
>>     netmask 255.255.255.0
>>     gateway 192.168.1.1
>>     dns-nameservers 8.8.8.8
>>
>> auto eth0:1
>>     allow-hotplug eth0:0
>>     iface eth0:1 inet static
>>     address 192.168.1.43
>>     netmask 255.255.255.0
>
> The indention in the above is confusing.  The indention does not
> matter to the programs.  But it is bad indention for humans reading
> it.  Always put the "auto", "allow-hotplug", "iface" lines at the same
> left indention.  Then for humans it is nice to indent additional lines
> associated with the "iface" line.  And you have "auto eth0:1" set
> twice.  And you have eth0:1 set to allow-hotplug but you don't have
> eth0 set to allow-hotplug.

sorry---these stanzas were just cut and pasted from the wiki and
intended only to show the original grammar used.


>> but both /etc/init.d/networking reload and restart had separate
>> problems besides not solving my resolv.conf problem.
>
> Problems such as?

"restart" always generates the warning contained in
/etc/init.d/networking.  I've never actually had a problem with it,
but I did not want to disallow one here.  "reload" warned that
"eth0:1" was not brought up though apparently it was.  "ifconfig"
indicated it was up but the entry was truncated---and the interface
show no functional impairment.

>> So I tried the newer format at the bottom of the same
>> wiki.debian.org page like this:
>
> That wiki section was updated just the other day to reflect
> improvements in the ifupdown handling of multiple IP addresses.  The
> new version will require some newish level of ifupdown that I don't
> recall off the top of my head.  But the update came from the ifupdown
> maintainer himself and so the information there should be authoritative.

thanks for that.  the wiki actually says "nowadays".  heh, heh.

>
>> auto eth0
>> allow-hotplug eth0
>> iface eth0 inet static
>>     address 192.168.1.42
>>     netmask 255.255.255.0
>>     gateway 192.168.1.1
>>     dns-nameservers 8.8.8.8
>
> All okay.  Should start upon hotplugging.  Should start at boot.
>
>> iface eth0 inet static
>>     address 192.168.1.43
>>     netmask 255.255.255.0
>
> This is missing "allow-hotplug eth0:1", "auto eth0:1", or both of those.
> You will want to add one or both of those.

That's exactly what makes the new grammar different!

>> Networking seemed OK reloading and restarting, but, sadly, not so when
>> rebooting, apparently.
>

> Suggestion 1:
>
> Remove resolvconf.  Where resolvconf rocks is on mobile devices with
> dynamic IP addresses.  Since you are setting up a static IP address
> there isn't much benefit from having resolvconf installed.  It is
> simpler without.

also, dpkg-reconfigure gives the option of disabling dynamic
re-writing of resolv.conf without removing the package.

>
> Suggestion 2:
>
> I suggest to simplify things in the interfaces file.  Simplify by
> removing or commenting out the second IP address.  That leaves things
> with a single IP address on the interface.  Then get everything
> working as you like that way.  Then add back in the setting up of the
> second IP address.  Spliting the problem up into smaller chunks and
> debugging each separately is best.
>
>   auto lo
>   iface lo inet loopback
>
>   auto eth0
>   allow-hotplug eth0
>   iface eth0 inet static
>       address 192.168.1.42
>       netmask 255.255.255.0
>       gateway 192.168.1.1
>       dns-nameservers 8.8.8.8

good point

>
> Suggestion 3:
>
> Set up a local caching nameserver.  This has many advantages.  Every
> libc program that needs to resolve names reads the /etc/resolv.conf
> file.  Usually they read it once only and don't check to see if it is
> updated.  That is why the reboot is suggested in the documentation.
> Because long running daemons and other long running programs won't
> usually get any updates to it until they are restarted.  A reboot
> guarentees that all get the restart.
>
> But if you have a local caching nameserver then the nameserver line
> will be pointing to 127.0.0.1 and never change.  Since it never
> changes long running programs never need to re-read that file.  Then
> for reconfiguration it is configuration of the local caching
> nameserver.  If you need to restart the nameserver after a
> reconfiguration then restart it and every other program immediately
> has the new configuration too because they are using the local
> nameserver.  Make sense?


bind is running.  is that be the reason why only 127.0.0.1 was in
resolv.conf?  but syslog contained entries recording inability to
resolve domain names.

> For bind9 that is it.  But for resolvconf we need one edit.  See the
> resolvconf /usr/share/doc/resolvconf/README.gz file for details.
>
> Change the /etc/bind/named.conf file from this:
>   include "/etc/bind/named.conf.options";
> To this:
>   include "/var/run/bind/named.options";
>
> Then if you want to add forwarders edit the
> /etc/bind/named.conf.options file and edit the forwarders template
> provided there and set up whatever forwarders you want.  Then restart
> bind.  Restarting bind is a lot less intrusive then rebooting!

I don't understand this yet.  will read docs.

>
> Suggestion 4:
>
> Pretty much do all of the above.  Don't worry about resolvconf if you
> are setting up a static system.  Simplify by setting up one IP address
> first and then worry about adding a second IP address after you have
> everything else the way you like it.  Install a local caching
> nameserver and set up all of your forwarders using it.
>
> Bob

thank you for the extensive help.  more than i could have asked for.

Mark


Reply to: