在 Ubuntu 18.04 上:
$ nmcli dev show | grep DNS
IP4.DNS[1]: 10.71.73.45
IP4.DNS[2]: 10.10.1.10
IP4.DNS[3]: 10.10.1.11
和
$ cat /etc/resolv.conf
# Generated by NetworkManager
search int.demarcohome.com demarcohome.com pchem.pro
nameserver 127.0.0.53
和
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 nick
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
和
$ dig @10.10.1.10 ipa1.pchem.pro
; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @10.10.1.10 ipa1.pchem.pro
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64107
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: e0b264dbb674673a875433205e64f22cacb2616d8b1969b2 (good)
;; QUESTION SECTION:
;ipa1.pchem.pro. IN A
;; ANSWER SECTION:
ipa1.pchem.pro. 1200 IN A 10.10.1.10
;; AUTHORITY SECTION:
pchem.pro. 86400 IN NS ipa1.pchem.pro.
那为什么不
$ dig ipa1.pchem.pro
; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> ipa1.pchem.pro
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 19340
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;ipa1.pchem.pro. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Sun Mar 08 09:32:08 EDT 2020
;; MSG SIZE rcvd: 43
或者
$ nslookup ipa1.pchem.pro
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find ipa1.pchem.pro: NXDOMAIN
???
有一个以太网适配器
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:40:00:53 brd ff:ff:ff:ff:ff:ff
inet 10.71.73.137/24 brd 10.71.73.255 scope global dynamic noprefixroute ens33
valid_lft 220sec preferred_lft 220sec
inet6 fe80::20c:29ff:fe40:53/64 scope link
valid_lft forever preferred_lft forever
编辑:回复@heynnema 评论(谢谢):
$ dig @10.71.73.45 ipa1.pchem.pro
; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @10.71.73.45 ipa1.pchem.pro
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 47997
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 0f8732674030db65f517a8c75e652bac26cb9fdab2bcf562 (good)
;; QUESTION SECTION:
;ipa1.pchem.pro. IN A
;; AUTHORITY SECTION:
pchem.pro. 3601 IN SOA dns1.registrar-servers.com. hostmaster.registrar-servers.com. 1582732969 43200 3600 604800 3601
;; Query time: 51 msec
;; SERVER: 10.71.73.45#53(10.71.73.45)
;; WHEN: Sun Mar 08 13:30:20 EDT 2020
;; MSG SIZE rcvd: 144
和
$ dig @10.71.73.45 ipa1.pchem.pro
; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> @10.71.73.45 ipa1.pchem.pro
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 58109
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: e0a674698cf1f2cac83202565e652bfe51d22df0b694ffca (good)
;; QUESTION SECTION:
;ipa1.pchem.pro. IN A
;; AUTHORITY SECTION:
pchem.pro. 3519 IN SOA dns1.registrar-servers.com. hostmaster.registrar-servers.com. 1582732969 43200 3600 604800 3601
;; Query time: 2 msec
;; SERVER: 10.71.73.45#53(10.71.73.45)
;; WHEN: Sun Mar 08 13:31:42 EDT 2020
;; MSG SIZE rcvd: 144
和
$ systemd-resolve --status
Global
DNS Domain: int.demarcohome.com
demarcohome.com
pchem.pro
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 2 (ens33)
Current Scopes: DNS
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 10.71.73.45
10.10.1.10
10.10.1.11
DNS Domain: ~.
int.demarcohome.com
demarcohome.com
pchem.pro