'nslookup'에 해당되는 글 1건

  1. 2008.09.02 nslookup CMD
2008. 9. 2. 18:42

nslookup CMD

 

 

 

                  nslookup CMD

 

 

 

 

 

 

1. nslookup CMD

_____________________

 

query name servers interactively

 

     Nslookup is a program to query Internet domain name servers.

     Nslookup has two modes: interactive and non-interactive.

     Interactive mode allows the user to query name servers for

     information about various hosts and domains or to print a

     list of hosts in a domain. Non-interactive mode is used to

     print just the name and requested information for a host or

     domain.

 

     Interactive mode is entered in the following cases:

 

     1. when no arguments are given (the default name server will

        be used)

 

     2. when the first argument is a hyphen (-) and the second

        argument is the host name or Internet address of a name

        server.

 

     Non-interactive mode is used when the name or Internet

     address of the host to be looked up is given as the first

     argument. The optional second argument specifies the host

     name or address of a name server.

 

     Options can also be specified on the command line if they

     precede the arguments and are prefixed with a hyphen. For

     example, to change the default query type to host

     information, and the initial timeout to 10 seconds, type:

 

 

 

 

 

2. Name Service Lookup CMD(s)

__________________________________

 

- dig

- host

- nslookup

 

 

 

(1). dig CMD

 

     dig (domain information groper) is a flexible tool for

     interrogating DNS name servers. It performs DNS lookups and

     displays the answers that are returned from the name

     server(s) that were queried. Most DNS administrators use dig

     to troubleshoot DNS problems because of its flexibility,

     ease of use and clarity of output. Other lookup tools tend

     to have less functionality than dig.

 

     Although dig is normally used with command-line arguments,

     it also has a batch mode of operation for reading lookup

     requests from a file. A brief summary of its command-line

     arguments and options is printed when the -h option is

     given. Unlike earlier versions, the BIND9 implementation of

     dig allows multiple lookups to be issued from the command

     line.

 

     Unless it is told to query a specific name server, dig will

     try each of the servers listed in /etc/resolv.conf.

 

     When no command line arguments or options are given, will

     perform an NS query for "." (the root).

 

     It is possible to set per-user defaults for dig via

     ${HOME}/.digrc. This file is read and any options in it are

     applied before the command line arguments.

 

 

# dig www.daum.net

 

; <<>> DiG 8.3 <<>> www.daum.net

;; res options: init recurs defnam dnsrch

;; got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2

;; flags: qr rd ra; QUERY: 1, ANSWER: 9, AUTHORITY: 9, ADDITIONAL: 9

;; QUERY SECTION:

;;      www.daum.net, type = A, class = IN

 

;; ANSWER SECTION:

www.daum.net.           3h47m46s IN CNAME  daumtop.daum.akadns.net.

daumtop.daum.akadns.net.  2m58s IN A  211.115.77.211

daumtop.daum.akadns.net.  2m58s IN A  211.115.77.212

daumtop.daum.akadns.net.  2m58s IN A  211.115.77.214

daumtop.daum.akadns.net.  2m58s IN A  211.32.117.30

daumtop.daum.akadns.net.  2m58s IN A  211.115.77.213

daumtop.daum.akadns.net.  2m58s IN A  222.231.51.40

daumtop.daum.akadns.net.  2m58s IN A  211.115.115.211

daumtop.daum.akadns.net.  2m58s IN A  222.231.51.78

 

;; AUTHORITY SECTION:

akadns.net.             21h47m45s IN NS  eur1.akadns.net.

akadns.net.             21h47m45s IN NS  za.akadns.org.

akadns.net.             21h47m45s IN NS  zd.akadns.org.

akadns.net.             21h47m45s IN NS  use4.akadns.net.

akadns.net.             21h47m45s IN NS  zc.akadns.org.

akadns.net.             21h47m45s IN NS  usw2.akadns.net.

akadns.net.             21h47m45s IN NS  asia9.akadns.net.

akadns.net.             21h47m45s IN NS  use3.akadns.net.

akadns.net.             21h47m45s IN NS  zb.akadns.org.

 

;; ADDITIONAL SECTION:

asia9.akadns.net.       1d23h48m18s IN A  220.73.220.4

eur1.akadns.net.        1d23h57m54s IN A  213.254.204.197

use3.akadns.net.        1d23h34m19s IN A  204.2.178.133

use4.akadns.net.        1h42m11s    IN A  208.44.108.137

usw2.akadns.net.        1d49m46s    IN A  63.209.3.132

za.akadns.org.          21h47m45s   IN A  195.219.3.169

zb.akadns.org.          21h47m45s   IN A  206.132.100.105

zc.akadns.org.          21h47m45s   IN A  124.211.40.4

zd.akadns.org.          21h47m45s   IN A  63.209.3.132

 

;; Total query time: 14 msec

;; FROM: solaris254 to SERVER: default -- 168.126.63.1

;; WHEN: Wed Mar  5 13:43:52 2008

;; MSG SIZE  sent: 30  rcvd: 510

 

[참고] /root/SERVER/DNS/Reference/dig_활용방법_가이드.pdf

 

 

 

 

 

 

(2). host

 

     host is a simple utility for performing DNS lookups. It is

     normally used to convert names to IP addresses and vice

     versa. When no arguments or options are given, host prints a

     short summary of its command line arguments and options.

 

     name is the domain name that is to be looked up. It can also

     be a dotted-decimal IPv4 address or a colon-delimited IPv6

     address, in which case host will by default perform a

     reverse lookup for that address.  server is an optional

     argument which is either the name or IP address of the name

     server that host should query instead of the server or

     servers listed in /etc/resolv.conf.

 

 

# host www.daum.net

 

 

 

(3). nslookup

 

자세한 내용은 "4. nslookup 사용법"를 참고한다.

 

# nslookup www.daum.net

 

 

 

 

 

3. Debugging for DNS

______________________

 

DNS 서버 설정이 이상이 있는 경우 디버깅하는 방법은 (a)nslookup 명령어를 사용하는 방

법, (b) /var/adm/messages 파일을 활용하는 방법, (c)signal을 사용하는 방법등이 있다.

 

■ nslookup 명령어를 사용하는 경우

■ /var/adm/messages & SIGHUP 사용하는 경우

■ 시그널 (SIGINT, SIGUSR1) 사용하는 경우

 

 

 

[EX1] nslookup 명령어를 사용하는 방법

# nslookup

> server 172.16.8.XXX            (자신의 DNS 서버 지정)

 

> set q=NS

> solarisXXX.example.com         (자신의 도메인 지정)

 

> set q=MX

> solarisXXX.example.com         (자신의 메일 서버 도메인 지정)

 

> set q=A

> www.solarisXXX.example.com     (자신의 웹서버 도메인 지정)

 

 

[EX2] /var/adm/messages 파일과 signal(SIGHUP) 사용하는 경우

<TERM1> 관리자 윈도우 1

# tail -f /var/adm/messages (# mlog)

..... (중략) .....

Jul  1 16:26:37 solaris254 named[189]: [ID 295310 daemon.notice] reloading nameserver

Jul  1 16:26:37 solaris254 named[189]: [ID 295310 daemon.notice] Ready to answer queries.

 

<TERM2> 관리자 윈도우 2

# pkill -HUP in.named

 

 

[EX3] 다른 시그널을 사용하는 경우

# pkill -INT in.named

# cat /var/named/named_dump.db

.... (내용 생략).....

 

# pkill -USR1 in.named (Debug Mode ON)

# cat /var/named/named.run

-----------------------------------------------------------------------

Debug level 1

Version = in.named BIND 8.3.3 Thu Jun 16 08:11:42 PDT 2005

        Generic Patch-5.9-June 2005

conffile = /etc/named.conf

datagram from [172.16.8.203].32967, fd 23, len 17

req: nlookup() id 11692 type=2 class=1

req: missed '' as '' (cname=0)

ns_req: answer -> [172.16.8.203].32967 fd=23 id=11692 size=60 rc=0

prime_cache: priming = 0, root = 0

-----------------------------------------------------------------------

 

# pkill -USR2 in.named (Debug Mode OFF)

 

 

 

 

4. nslookup 사용법

____________________

 

(1). How to using the nslookup CMDs

 

- Non-interractive Mode( 대화형 모드 실행)

- Interractive Mode(대화형 모드 실행)

 

EX) Interractive/Non-interractive Mode

# nslookup  www.daum.net

# nslookup

> www.daum.net

 

 

 

(2). nslookup CMD EXAMPLE

 

(2-1). 대화형 모드(Non-interractive Mode) 실행

# nslookup -query=NS solarisXXX.example.com

# nslookup -q=A ns.solarisXXX.example.com

# nslookup -q=MX solarisXXX.example.com

# nslookup -q=PTR 172.16.8.XXX

 

 

 

(2-2). 대화형 모드(Interractive Mode) 실행

 

# nslookup

> test.solarisXXX.example.com

> 172.16.8.XXX

> ls solarisXXX.example.com

 

(1st Style)

> ls -a www.solarisXXX.example.com  (a: alias)

> ls -d solarisXXX.example.com      (d: detail)

 

> ls -t MX solarisXXX.example.com

> ls -t A www.solarisXXX.example.com

> ls -t PTR 172.16.8.XXX

> ls -t NS solarisXXX.example.com

 

(2nd Style)

> set type=MX

> solaris254.example.com

> set type=A

> www.solaris254.example.com

> set type=PTR

> 172.16.8.254

> set type=NS

> solaris254.example.com

 

(3rd Style)

> set q=NS        (Name Server)

> solarisXXX.example.com

 

> set q=MX        (Mail Exchange)

> solarisXXX.example.com

 

> set q=A         (Address)

> www.solarisXXX.example.com

 

> set q=PTR       (Address Pointer)

> 172.16.8.XXX

 

> server 168.126.63.1

 

> set q=NS

> kornet.net      //도메인 네임

 

> set q=MX 

> kornet.net      //도에인 네임

 

> set q=A   //adress

> www.kornet.net

 

> set q=PTR

> 211.216.50.150

 

> exit