nslookup 명령어 (AIX 5.3·6.1)

핵심 정리

  • DNS 서버에 질의합니다. 인수 없이 실행하면 대화형, nslookup 이름 [서버]처럼 주면 비대화형으로 한 번 묻고 끝납니다.
  • 비대화형 예: nslookup aixhost01, nslookup 10.1.1.10(역방향), nslookup -type=mx example.com 10.1.1.53.
  • 대화형에서는 server 서버(기본 서버 바꾸기), set type=mx(레코드 종류), set debug, exit를 씁니다.
  • /etc/hosts는 보지 않고 DNS만 묻습니다. 시스템 이름 풀이 순서까지 확인하려면 host를 씁니다.
  • 기본 서버와 도메인은 /etc/resolv.conf에서 읽습니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1 문서는 BIND 9 nslookup 기준으로 새로 쓰여 짧아졌고, 5.3의 ls·finger·view·root 하위 명령과 예, 오류 메시지 설명이 빠짐. 영어 원문은 6.1)
원문 IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4
파일 /usr/bin/nslookup, /etc/resolv.conf, $HOME/.nslookuprc(5.3)
관련 명령어 host, dig, named, traceroute

목적

인터넷 도메인 네임 서버에 대화형으로 질의합니다.

영어 원문

Queries internet domain name servers interactively.

구문

6.1:

text
nslookup [ -option ] [ name | - ] [ server ]

5.3:

text
nslookup [ -Option ... ] [ Host ] [ -NameServer ]

설명

nslookup 명령은 두 모드로 인터넷 도메인 네임 서버에 질의합니다. 대화형 모드에서는 여러 호스트와 도메인의 정보를 묻거나 도메인의 호스트 목록을 출력할 수 있고, 비대화형 모드에서는 지정한 호스트나 도메인의 이름과 요청한 정보를 출력합니다.

인수가 없거나, 첫 인수가 -이고 둘째 인수가 네임 서버의 호스트 이름이나 인터넷 주소면 대화형 모드로 들어갑니다. 인수가 없으면 기본 네임 서버에 묻습니다. 첫 인수로 찾을 호스트의 이름이나 인터넷 주소를 주면 비대화형 모드가 됩니다. 선택인 둘째 인수는 네임 서버의 호스트 이름이나 주소입니다. 인수 앞에 하이픈을 붙여 옵션을 줄 수 있습니다. 예를 들어 기본 질의 종류를 호스트 정보로, 처음 타임아웃을 10초로 하려면 다음처럼 입력합니다.

bash
nslookup -query=hinfo -timeout=10

대화형 명령

명령 설명
host [server] 현재 기본 서버(또는 지정한 server)로 host의 정보를 찾습니다. host가 인터넷 주소이고 질의 종류가 A나 PTR이면 호스트 이름을 돌려줍니다. 이름 끝에 마침표가 없으면 검색 목록으로 이름을 채웁니다. 현재 도메인에 없는 호스트는 이름 끝에 마침표를 붙입니다.
server Domain, lserver Domain 기본 서버를 Domain으로 바꿉니다. lserver는 처음 서버로, server는 현재 기본 서버로 그 도메인 정보를 찾습니다. 권한 있는 답을 찾지 못하면 답을 가졌을 만한 다른 서버 이름을 돌려줍니다.
exit 끝냅니다.
set Keyword[=Value] 조회에 영향을 주는 상태를 바꿉니다(아래 표).

set 키워드:

키워드 설명
all 자주 쓰는 set 옵션의 현재 값과 현재 기본 서버·호스트 정보를 출력합니다.
class=value 질의 클래스(정보의 프로토콜 그룹). IN(기본, 인터넷), CH(Chaos), HESIOD, ANY(모두).
[no]debug 디버깅 모드. 기본 nodebug.
[no]d2 아주 자세한 디버깅. 기본 nod2.
domain=name 기본 도메인 이름을 바꿉니다.
[no]search 요청에 끝이 아닌 마침표가 있으면 답을 받을 때까지 검색 목록의 도메인을 붙여 봅니다. 기본 search.
port=value 네임 서버의 TCP/UDP 포트. 기본 53.
querytype=value, type=value 질의할 정보 종류. 기본 A.
[no]recurse 네임 서버에 정보가 없으면 다른 서버에 물어보게 합니다. 기본 recurse.
retry=number 재시도 횟수.
timeout=number 응답을 기다리는 처음 타임아웃(초).
[no]vc 서버에 요청할 때 늘 가상 회선(TCP)을 씁니다. 기본 novc.
[no]fail 네임 서버가 SERVFAIL이나 위임(referral)으로 답하면 다음 네임 서버를 시도할지(nofail), 질의를 끝낼지(fail). 기본 nofail.

5.3 문서에만 있는 내용

5.3 문서는 예전 nslookup을 기준으로 하며 다음이 더 있습니다.

  • - 뒤의 옵션은 set 하위 명령의 키워드로, 명령줄 인수 앞에 둡니다. set 옵션은 홈 디렉터리의 .nslookuprc에 둘 수도 있으며, 그 안의 domain, srchlist, defname, search는 비대화형 명령에도 영향을 줍니다.
  • 하위 명령은 Ctrl+C로 언제든 멈추고, Ctrl+D나 exit로 끝냅니다. 내장 명령 이름을 호스트 이름으로 쓰려면 앞에 \를 붙이며, 알 수 없는 명령은 호스트 이름으로 봅니다.
  • 하위 명령 finger [Name] [> 파일](현재 호스트의 finger 데몬에 연결), root(루트 서버를 기본 서버로, 기본 ns.nic.ddn.mil), ls [Option] Domain [> 파일](도메인의 정보 나열. -t 종류, -a(CNAME), -d(ANY), -h(HINFO), -s(WKS)), view 파일(앞의 ls 출력을 정렬해 more로), help·?(도움말).
  • set 키워드 srchlist=Name1/Name2/...(기본 도메인과 검색 목록, 1024자까지), [no]defname(마침표 없는 이름에 기본 도메인을 붙임, 기본 defname), root=Host, [no]ignoretc(잘림 오류 무시). retry 기본값은 4, timeout 기본값은 5초이며 응답이 없으면 타임아웃을 두 배로 늘려 다시 보냅니다.
  • 오류 메시지: Timed Out(재시도 후에도 응답 없음), No Response from Server(서버에 네임 서버가 돌고 있지 않음), No Records(호스트는 있지만 그 종류의 레코드가 없음), Non-Existent Domain(호스트나 도메인이 없음), Connection Refused·Network Is Unreachable(네임·finger 서버에 연결할 수 없음, 주로 ls·finger), Server Failure(서버 내부 불일치), Refused(서버가 요청을 거절), Format Error(요청 패킷 형식이 틀림).
  • 파일: $HOME/.nslookuprc(사용자 초기 옵션), HOSTALIASES(호스트 별칭), LOCALDOMAIN(기본 도메인 덮어쓰기).

5.3 문서의 예:

명령 하는 일
nslookup -query=hinfo -timeout=10 기본 질의 종류를 HINFO로, 처음 타임아웃을 10초로
nslookup -set srchlist=lcs.MIT.EDU/ai.MIT.EDU/MIT.EDU 도메인과 검색 목록을 세 이름으로
nslookup -querytype=ANY austin.ibm.com 이름이 호스트인지 도메인인지 확인. SOA, 네임 서버, 메일 교환기, 주소를 모두 보여 줌
nslookup opus 호스트 opus를 비대화형으로 조회. Name: opus.austin.ibm.com, Address: 129.35.129.223처럼 나옴

자주 쓰는 형태:

bash
nslookup aixhost01                        # 정방향
nslookup 10.1.1.10                        # 역방향(PTR)
nslookup -type=mx example.com 10.1.1.53   # 특정 서버에 MX 레코드
nslookup -debug aixhost01                 # 질의·응답 자세히
영어 원문

The nslookup command queries internet domain name servers in two modes. Interactive mode allows you to query name servers for information about various hosts and domains, or to print a list of the hosts in a domain. In noninteractive mode, the names and requested information are printed for a specified host or domain.

The nslookup command enters interactive mode when no arguments are given, or when the first argument is a - (minus sign) and the second argument is the host name or internet address of a name server. When no arguments are given, the command queries the default name server. The nslookup command enters non-interactive mode when you give the name or internet address of the host to be looked up as the first argument. The optional second argument specifies the host name or address of a name server. You can specify options 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, enter the following command: nslookup -query=hinfo -timeout=10

Interactive commands

  • host [server] — Looks up information for the host using the current default server or using server, if specified. If the host is an Internet address and the query type is A or PTR, the nslookup command returns the name of the host. If the host is a name and does not have a trailing period, the search list is used to qualify the name. To look up a host not in the current domain, append a period to the name.
  • server Domain lserver Domain — Changes the default server to the value specified by the Domain parameter. The lserver subcommand uses the initial server to look up information about the domain. The server subcommand uses the current default server. If an authoritative answer cannot be found, the names of any additional servers that might have the answer are returned.
  • exit — Exits the program.
  • set Keyword[=Value] — Changes state information that affects lookups. You can specify the following keywords: all Prints the current values of the frequently used options to set. Information about the current default server and host is also printed. class=value Changes the query class to one of the following value. The class specifies the protocol group of the information. The default is IN. IN The Internet class. CH The Chaos class. HESIOD The Hesiod class. ANY Wildcard (any of the above). [no]debug Turns debugging mode on. The default is nodebug. [no]d2 Turns comprehensive debugging on. The default is nod2. domain=name Changes the default domain name to the name specified by the name parameter. [no]search Appends the domain names in the domain search list to the request until an answer is received, if the lookup request contains a period other than a trailing period. The default is search. port=value Changes the default TCP/UDP name server port to the number specified by the value parameter. The default value is 53. querytype=valuetype=value Changes the type of the information query to the type specified by the value parameter. The default value is A. [no]recurse Tells the name server to query other servers if it does not have the information. The default is recurse. retry=number Sets the number of retries to the number specified by the number parameter. timeout=number Changes the initial timeout interval for waiting for a reply to the seconds specified by the number parameter. [no]vc Always uses a virtual circuit when sending requests to the server. The default is novc. [no]fail Tries the next name server if a name server responds with SERVFAIL or a referral (nofail) or terminate query (fail) on such a response. The default is nofail.

파일

파일 설명
/etc/resolv.conf 처음 도메인 이름과 네임 서버 주소
영어 원문
  • /etc/resolv.conf — Contains the initial domain name and nameserver addresses.

Related reference:

  • named-checkconf Command
  • named9 Daemon
  • rndc-confgen Command

Related information:

  • host9 command
  • dnssec-keygen command
  • dnssec-signzone command

리눅스(GNU)와 다른 점

리눅스에도 같은 BIND 도구의 nslookup이 있어 사용법이 6.1과 같습니다. 더 자세히 볼 때는 dig 이름 [type] [@서버](예: dig example.com mx @10.1.1.53, 역방향은 dig -x 10.1.1.10)를 주로 씁니다. 시스템 이름 풀이 순서까지 보려면 getent hosts 이름을 씁니다. /etc/resolv.conf가 systemd-resolved 스텁(127.0.0.53)을 가리키면 resolvectl query 이름도 씁니다.