Ubuntu 17.04 正确的 DNS 后缀设置?

Ubuntu 17.04 正确的 DNS 后缀设置?

我无法让 DNS 后缀正常工作

基本上,我已经jira.mycompany.local在公司的DNS服务器映射到192.168.100.5

我希望能够使用 和 来访问jirajira.mycompany.local

我的里面有这个/etc/systemd/resolvd.conf

[Resolve]
Domains=mycompany.local devnet.mycompany.nl

重新启动网络管理器并解决:

systemctl restart NetworkManager.service
systemctl restart systemd-resolved.service 

结果如下/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

所以这一切看起来都不错。测试 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 到 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 主机名(带或不带后缀):

>ping jira
ping: jira: Name or service not known

>ping jira.mycompany.local
ping: jira.mycompany.local: Name or service not known

相关行 /etc/nsswitch.conf

hosts:          files [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname

(我删除了 avahi 线,这样它就不会干扰。)

使用挖掘测试:

dig +short jira 
(empty)

dig +short jira.mycompany.local 
192.168.100.5

[编辑]

我修改了etc/nsswitch.conf中的hosts行:

hosts:          files resolve dns

现在:

>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

有效,但是:

>ping jira
ping: jira: Temporary failure in name resolution

我该如何调试这个问题/或修复它?

答案1

尝试仅使用search您的在线功能resolv.conf

search mycompany.local devnet.mycompany.nl

dig其次,您的using only测试jira失败,这是正常行为!dig不会使用 中指定的域自动完成您的主机名resolv.conf

相关内容