Jump to content

Problems persuading resolvconf to use local bind


javalatte

Recommended Posts

I have set up a server on a nanopi-r2s running Armbian version 5.15.25-rockchip64. It all works fine apart from one thing: while other devices can successfully use BIND on the server, the server itself cannot find the local BIND.

 

If I type in this command host device.localdomain 127.0.0.1 it returns the following:

 

device.localdomain has address 192.168.0.20

 

192.168.0.20 is the correct address for device.localdomain from the local BIND. If I omit the 127.0.0.1  from the command, it does not find the correct address.:

 

device.localdomain has address 36.86.63.182
device.localdomain has address 36.86.63.182
Host device.localdomain not found: 3(NXDOMAIN)

 

The problem seems to be that resolvconf is not adding 127.0.0.1 to resolv.conf. Here is resolv.conf:

 

# Generated by NetworkManager
nameserver 2001:4489:500:102::2
nameserver 2001:4489:506:102::2
nameserver 2001:4488:0:1::76

 

if, just for test purposes, I manually edit /run/resolvconf/resolv.conf to add 127.0.0.1, the host command works without 127.0.0.1. Clearly, the problem is that resolvconf isn't adding the localhost address to resolv.conf. I have tried several different ways to add 127.0.0.1 to resolv.conf. This includes:

 

  • editing /etc/systemd/resolved.conf to add DNS=127.0.0.1
  • editing /etc/default/named to add RESOLVCONF=yes
  • editing /etc/network/interfaces to add dns-nameservers=127.0.0.1

 

None of these methods makes any difference to what appears in resolv.conf.

 

Here are the files:

 

[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
# Google:     8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844
# Quad9:      9.9.9.9 2620:fe::fe
DNS= "127.0.0.1"
#FallbackDNS=
#Domains=

The example I found showed the ip address in quotes, as above: I tried without the quotes as well, and that didn't work either.

 

 

#
# run resolvconf?
RESOLVCONF=yes

# startup options for the server
OPTIONS="-u bind"

 

 

# armbian-config created
source /etc/network/interfaces.d/*

# Local loopback
auto lo
iface lo inet loopback
        dns-nameservers 127.0.0.1

# Interface eth0
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.100.10
        netmask 255.255.255.0
        gateway 192.168.100.1

# Interface lan0
auto lan0
allow-hotplug lan0
iface lan0 inet static
        address 192.168.0.15
        netmask 255.255.255.0

 

Link to comment
Share on other sites

I found the solution. in /etc/network/interfaces, the dns-nameservers line has to be on interface lan0 (the internal network).

In addition, lan0 must be defined before eth0 (the external network), otherwise resolvconf will add three ipv6 nameservers and no ipv4 nameservers.

 

# armbian-config created
source /etc/network/interfaces.d/*

# Local loopback
auto lo
iface lo inet loopback
        dns-nameservers 127.0.0.1

# Interface lan0 -must be before eth0, because eth0 generates too many dns-nameservers
auto lan0
allow-hotplug lan0
iface lan0 inet static
        address 192.168.0.15
        netmask 255.255.255.0
        dns-nameservers 127.0.0.1

# Interface eth0
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.100.10
        netmask 255.255.255.0
        gateway 192.168.100.1

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines