I have trouble getting DNS suffix to work properly
Basically, I have jira.mycompany.local
in the company DNS server mapped to 192.168.100.5
I want to be able to access it using both jira
and jira.mycompany.local
.
I have this in my /etc/systemd/resolvd.conf
[Resolve]
Domains=mycompany.local devnet.mycompany.nl
Restarting the Network manager & resolved:
systemctl restart NetworkManager.service
systemctl restart systemd-resolved.service
Results in this /etc/resolv.conf
:
nameserver 192.168.10.1
nameserver 192.168.10.2
nameserver 127.0.0.53
search mycompany.local
search devnet.mycompany.nl
So this all looks good. Testing the DNS:
nslookup jira.mycompany.local
Server: 192.168.10.1
Address: 192.168.10.1#53
Name: jira.mycompany.local
Address: 192.168.100.5
Ping to IP:
>ping 192.168.100.5
PING 192.168.100.5 (192.168.100.5) 56(84) bytes of data.
64 bytes from 192.168.100.5: icmp_seq=1 ttl=63 time=7.04 ms
Ping To hostname (with and without suffix):
>ping jira
ping: jira: Name or service not known
>ping jira.mycompany.local
ping: jira.mycompany.local: Name or service not known
Relevant line of /etc/nsswitch.conf
:
hosts: files [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname
(I removed the avahi line so it won't interfere.)
Test using dig:
dig +short jira
(empty)
dig +short jira.mycompany.local
192.168.100.5
[EDIT]
I modified the hosts line in the etc/nsswitch.conf:
hosts: files resolve dns
Now:
>ping jira.mycompany.local
PING jira.mycompany.local (192.168.100.5) 56(84) bytes of data.
64 bytes from 192.168.100.5: icmp_seq=1 ttl=63 time=7.04 ms
Works, but:
>ping jira
ping: jira: Temporary failure in name resolution
How can I debug this issue / or fix it?
Best Answer
Try using only on
search
line in youresolv.conf
Secondly, your test with
dig
using onlyjira
fails and that is a normal behavior!dig
won't auto-complete your hostname with the domains specified inresolv.conf
.