0

I have one box (Rasberry Pi, running rasberian) with a static IP. It's running in a network with a domainname, and I have several DNS-server set up.

However, I can not get FQDN name to work on this box:

sitron@pi:~ $ domainname (none) sitron@pi:~ $ dnsdomainname sitron@pi:~ $ hostname -f pi 

I believe I have set up DNS correctly:

sitron@pi:~ $ hostname -I 192.168.10.9 2001:db8:abba::9 sitron@pi:~ $ cat /etc/resolv.conf domain example.org search example.org nameserver 2001:db8:abba::5 nameserver 192.168.10.5 sitron@pi:~ $ dig +short -x 192.168.10.9 @2001:db8:abba::5 pi.example.org. sitron@pi:~ $ dig +short -x 2001:db8:abba::9 @2001:db8:abba::5 pi.example.org. sitron@pi:~ $ dig +short -x 2001:db8:abba::9 @192.168.10.5 pi.example.org. sitron@pi:~ $ dig +short -x 192.168.10.9 @192.168.10.5 pi.example.org. 

My nsswitch.conf:

# /etc/nsswitch.conf # # Example configuration of GNU Name Service Switch functionality. # If you have the `glibc-doc-reference' and `info' packages installed, try: # `info libc "Name Service Switch"' for information about this file. passwd: compat group: compat shadow: compat gshadow: files hosts: files mdns4_minimal dns networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis 

And /etc/hosts:

127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.1.1 pi 

What is the missing link?

4
  • try to add options single-request-reopen into your /etc/resolve.conf file. this should fix any mistake happens when you are using both ipv4 and ipv6 into your resove.conf "The resolver uses the same socket for the A and AAAA requests. Some hardware mistakenly sends back only one reply. When that happens the client system will sit and wait for the second reply. Turning this option on changes this behavior so that if two requests from the same port are not handled correctly it will close the socket and open a new one before sending the second request." Commented Jul 14, 2019 at 9:42
  • Can you try changing the first line in /etc/hosts like this: 127.0.0.1 pi.example.com pi localhost? Commented Jul 14, 2019 at 10:34
  • @AhmadAbuhasna: I tried, but it did not work :-/ Commented Jul 16, 2019 at 10:33
  • @FedonKadifeli: That will work, but that will break the hostname "localhost" pointing at 127.0.0.1, which both I and the system relay on. Commented Jul 16, 2019 at 10:36

1 Answer 1

1

I figured it out, and there is two solutions. I have tested both, on several different boxes.

Solution A

Verify that your resolv.conf contains the "domain"-keyword, like this:

# Generated by resolvconf domain example.org nameserver 127.0.0.1 

If you are using dhcpcd.conf to set a static IP like me, you have to specify this undocumented option:

static domain_name=example.org 

Finally, you need to remove the line in /etc/hosts containing 127.0.1.1 <hostname>. That means my /etc/hosts now contains:

127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 

Solution B

Add your FQDN to the 127.0.1.1 line in /etc/hosts, like this:

127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.1.1 pi.example.org pi 

However, this means I am overriding the DNS-server, something that is not ideal. That's why I prefer, and assume Solution A is better.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.