저는 Ubuntu 14.04를 실행 중이며 최근에 일부 호스트 이름 확인 구성을 변경했습니다. 그래서 지금은 이를 최적화하려고 노력 중입니다. 이를 위해 어떤 네임서버가 내 요청의 특정 호스트 이름을 확인하는지 알아내야 합니다.
완전히 해결되었는지 확인하기 위해 호스트 이름을 핑(ping)해 볼 수 있지만 my.hostname.example.net
, 특정 호스트 이름을 해결한 이름 서버를 어떻게 알 수 있습니까?
답변1
DNS 확인을 디버깅하고 DNS 조회를 확인하는 데 사용된 경로를 표시하는 데 사용할 수 있는 몇 가지 명령이 있습니다.
- 도메인 추적기
설치하세요:
sudo apt-get install dnstracer
사용 예:
$ dnstracer www.cnn.com
Tracing to www.cnn.com[a] via 193.136.188.1, maximum of 3 retries
193.136.188.1 (193.136.188.1) Got answer [received type is cname]
|\___ ns1.fastly.net [fastly.net] (23.235.32.32)
|\___ ns4.fastly.net [fastly.net] (104.156.84.32)
|\___ ns3.fastly.net [fastly.net] (23.235.36.32)
\___ ns2.fastly.net [fastly.net] (104.156.80.32)
NAME dnstracer - trace a chain of DNS servers to the source DESCRIPTION dnstracer determines where a given Domain Name Server (DNS) gets its information from, and follows the chain of DNS servers back to the servers which know the data.
- nslookup의 디버그 모드
예:
$ nslookup
> set debug
> www.cnn.com
Server: 193.136.188.1
Address: 193.136.188.1#53
------------
QUESTIONS:
www.cnn.com, type = A, class = IN
ANSWERS:
-> www.cnn.com
canonical name = turner.map.fastly.net.
ttl = 191
-> turner.map.fastly.net
internet address = 151.101.36.73
ttl = 30
AUTHORITY RECORDS:
-> fastly.net
nameserver = ns2.fastly.net.
ttl = 13130
-> fastly.net
nameserver = ns3.fastly.net.
ttl = 13130
-> fastly.net
nameserver = ns4.fastly.net.
ttl = 13130
-> fastly.net
nameserver = ns1.fastly.net.
ttl = 13130
ADDITIONAL RECORDS:
-> ns1.fastly.net
internet address = 23.235.32.32
ttl = 13130
-> ns2.fastly.net
internet address = 104.156.80.32
ttl = 13130
-> ns3.fastly.net
internet address = 23.235.36.32
ttl = 13130
-> ns4.fastly.net
internet address = 104.156.84.32
ttl = 13130
------------
Non-authoritative answer:
www.cnn.com canonical name = turner.map.fastly.net.
Name: turner.map.fastly.net
Address: 151.101.36.73
- 굴착 추적
예:
$ dig +trace +recurse +all www.cnn.com. a
; <<>> DiG 9.8.3-P1 <<>> +trace +recurse +all www.cnn.com. a
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37660
;; flags: qr ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13
;; QUESTION SECTION:
;. IN NS
;; ANSWER SECTION:
. 456885 IN NS j.root-servers.net.
. 456885 IN NS k.root-servers.net.
. 456885 IN NS l.root-servers.net.
. 456885 IN NS m.root-servers.net.
. 456885 IN NS a.root-servers.net.
. 456885 IN NS b.root-servers.net.
. 456885 IN NS c.root-servers.net.
. 456885 IN NS d.root-servers.net.
. 456885 IN NS e.root-servers.net.
. 456885 IN NS f.root-servers.net.
. 456885 IN NS g.root-servers.net.
. 456885 IN NS h.root-servers.net.
. 456885 IN NS i.root-servers.net.
;; ADDITIONAL SECTION:
a.root-servers.net. 543296 IN A 198.41.0.4
a.root-servers.net. 111296 IN AAAA 2001:503:ba3e::2:30
b.root-servers.net. 604618 IN A 192.228.79.201
b.root-servers.net. 111296 IN AAAA 2001:500:84::b
c.root-servers.net. 604618 IN A 192.33.4.12
c.root-servers.net. 111296 IN AAAA 2001:500:2::c
d.root-servers.net. 604618 IN A 199.7.91.13
d.root-servers.net. 111296 IN AAAA 2001:500:2d::d
e.root-servers.net. 604618 IN A 192.203.230.10
f.root-servers.net. 604618 IN A 192.5.5.241
f.root-servers.net. 111296 IN AAAA 2001:500:2f::f
g.root-servers.net. 604618 IN A 192.112.36.4
h.root-servers.net. 604618 IN A 198.97.190.53
;; Query time: 22 msec
;; SERVER: 10.19.90.11#53(10.19.90.11)
;; WHEN: Mon Dec 5 18:06:06 2016
;; MSG SIZE rcvd: 496
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16113
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 14
;; QUESTION SECTION:
;www.cnn.com. IN A
;; AUTHORITY SECTION:
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS a.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
;; ADDITIONAL SECTION:
a.gtld-servers.net. 172800 IN A 192.5.6.30
b.gtld-servers.net. 172800 IN A 192.33.14.30
c.gtld-servers.net. 172800 IN A 192.26.92.30
d.gtld-servers.net. 172800 IN A 192.31.80.30
e.gtld-servers.net. 172800 IN A 192.12.94.30
f.gtld-servers.net. 172800 IN A 192.35.51.30
g.gtld-servers.net. 172800 IN A 192.42.93.30
h.gtld-servers.net. 172800 IN A 192.54.112.30
i.gtld-servers.net. 172800 IN A 192.43.172.30
j.gtld-servers.net. 172800 IN A 192.48.79.30
k.gtld-servers.net. 172800 IN A 192.52.178.30
l.gtld-servers.net. 172800 IN A 192.41.162.30
m.gtld-servers.net. 172800 IN A 192.55.83.30
a.gtld-servers.net. 172800 IN AAAA 2001:503:a83e::2:30
;; Query time: 196 msec
;; SERVER: 192.112.36.4#53(192.112.36.4)
;; WHEN: Mon Dec 5 18:06:07 2016
;; MSG SIZE rcvd: 489
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44429
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 10, ADDITIONAL: 6
;; QUESTION SECTION:
;www.cnn.com. IN A
;; AUTHORITY SECTION:
cnn.com. 172800 IN NS pdns3.ultradns.org.
cnn.com. 172800 IN NS pdns4.ultradns.org.
cnn.com. 172800 IN NS pdns1.ultradns.net.
cnn.com. 172800 IN NS pdns2.ultradns.net.
cnn.com. 172800 IN NS pdns5.ultradns.info.
cnn.com. 172800 IN NS pdns6.ultradns.co.uk.
cnn.com. 172800 IN NS ns-47.awsdns-05.com.
cnn.com. 172800 IN NS ns-576.awsdns-08.net.
cnn.com. 172800 IN NS ns-1630.awsdns-11.co.uk.
cnn.com. 172800 IN NS ns-1086.awsdns-07.org.
;; ADDITIONAL SECTION:
pdns1.ultradns.net. 172800 IN AAAA 2001:502:f3ff::1
pdns1.ultradns.net. 172800 IN A 204.74.108.1
pdns2.ultradns.net. 172800 IN A 204.74.109.1
pdns2.ultradns.net. 172800 IN AAAA 2610:a1:1014::1
ns-47.awsdns-05.com. 172800 IN A 205.251.192.47
ns-576.awsdns-08.net. 172800 IN A 205.251.194.64
;; Query time: 58 msec
;; SERVER: 192.31.80.30#53(192.31.80.30)
;; WHEN: Mon Dec 5 18:06:07 2016
;; MSG SIZE rcvd: 445
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47226
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.cnn.com. IN A
;; ANSWER SECTION:
www.cnn.com. 300 IN CNAME turner.map.fastly.net.
;; Query time: 64 msec
;; SERVER: 204.74.114.1#53(204.74.114.1)
;; WHEN: Mon Dec 5 18:06:07 2016
;; MSG SIZE rcvd: 64
답변2
특정 도메인의 호스트 이름을 확인하는 이름 서버를 알아야 합니다.
언급했듯이 dig
이것은 당신이 찾고 있는 명령입니다. 예를 들어, google.com 호스트의 이름을 누가 확인했는지 알고 싶다면 다음 명령을 실행합니다.
dig google.com ns
다음 결과를 반환합니다.
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com ns
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62331
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com. IN NS
;; ANSWER SECTION:
google.com. 152786 IN NS ns4.google.com.
google.com. 152786 IN NS ns1.google.com.
google.com. 152786 IN NS ns3.google.com.
google.com. 152786 IN NS ns2.google.com.
;; Query time: 26 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Mon Dec 05 17:35:07 CET 2016
;; MSG SIZE rcvd: 111