리눅스 dig

(/usr/bin/dig에서 넘어옴)
  다른 뜻에 대해서는 영어 dig 문서를 참조하십시오.

1 개요[ | ]

dig
/usr/bin/dig
  • 리눅스용 DNS 조회 도구

2 실행예시 1[ | ]

  • 파라미터 없이 그냥 실행하면 /etc/resolv.conf에 등록된 네임서버를 이용하여 루트 서버를 조회한다.
[root@zetawiki ~]# dig
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11774
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13

;; QUESTION SECTION:
;.				IN	NS

;; ANSWER SECTION:
.			5	IN	NS	g.root-servers.net.
.			5	IN	NS	b.root-servers.net.
.			5	IN	NS	f.root-servers.net.
.			5	IN	NS	d.root-servers.net.
.			5	IN	NS	i.root-servers.net.
.			5	IN	NS	k.root-servers.net.
.			5	IN	NS	c.root-servers.net.
.			5	IN	NS	h.root-servers.net.
.			5	IN	NS	m.root-servers.net.
.			5	IN	NS	j.root-servers.net.
.			5	IN	NS	a.root-servers.net.
.			5	IN	NS	l.root-servers.net.
.			5	IN	NS	e.root-servers.net.

;; ADDITIONAL SECTION:
a.root-servers.net.	5	IN	A	198.41.0.4
a.root-servers.net.	5	IN	AAAA	2001:503:ba3e::2:30
b.root-servers.net.	5	IN	A	192.228.79.201
b.root-servers.net.	5	IN	AAAA	2001:500:84::b
c.root-servers.net.	5	IN	A	192.33.4.12
c.root-servers.net.	5	IN	AAAA	2001:500:2::c
d.root-servers.net.	5	IN	A	199.7.91.13
d.root-servers.net.	5	IN	AAAA	2001:500:2d::d
e.root-servers.net.	5	IN	A	192.203.230.10
f.root-servers.net.	5	IN	A	192.5.5.241
f.root-servers.net.	5	IN	AAAA	2001:500:2f::f
g.root-servers.net.	5	IN	A	192.112.36.4
h.root-servers.net.	5	IN	A	128.63.2.53

;; Query time: 35 msec
;; SERVER: 192.168.245.2#53(192.168.245.2)
;; WHEN: Mon Sep 21 03:48:01 2015
;; MSG SIZE  rcvd: 496

3 실행예시 2: 도메인 조회[ | ]

  • 도메인을 입력하면 /etc/resolv.conf에 등록된 네임서버를 이용하여 해당 도메인을 조회한다.
명령어
dig 도메인
실행예시
[root@zetawiki ~]# dig gmail.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> gmail.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35467
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;gmail.com.			IN	A

;; ANSWER SECTION:
gmail.com.		5	IN	A	216.58.221.133

;; AUTHORITY SECTION:
gmail.com.		5	IN	NS	ns3.google.com.
gmail.com.		5	IN	NS	ns1.google.com.
gmail.com.		5	IN	NS	ns4.google.com.
gmail.com.		5	IN	NS	ns2.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.		5	IN	A	216.239.32.10
ns2.google.com.		5	IN	A	216.239.34.10
ns3.google.com.		5	IN	A	216.239.36.10
ns4.google.com.		5	IN	A	216.239.38.10

;; Query time: 73 msec
;; SERVER: 192.168.245.2#53(192.168.245.2)
;; WHEN: Mon Sep 21 03:49:24 2015
;; MSG SIZE  rcvd: 186

4 실행예시 3: 특정 DNS로 조회[ | ]

  • @DNS주소를 넣으면 그 DNS를 이용하여 도메인을 조회한다.
명령어
dig @DNS주소 도메인
실행예시
[root@zetawiki ~]# dig @8.8.8.8 gmail.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> @8.8.8.8 gmail.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14099
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;gmail.com.			IN	A

;; ANSWER SECTION:
gmail.com.		299	IN	A	216.58.221.37

;; Query time: 215 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Sep 21 03:49:58 2015
;; MSG SIZE  rcvd: 43

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}