nslookup으로 도메인 정보 조회하는 방법은 무엇인가요?
💡 요약 정리
- nslookup은 도메인의 IP와 DNS 레코드를 조회하는 명령어입니다.
- Windows(cmd, 명령 프롬프트)와 Linux에서 모두 사용 가능합니다.
- 특정 네임서버를 지정하여 조회할 수 있습니다.
- MX(메일서버), TXT(SPF), NS(네임서버) 등 다양한 레코드 타입을 조회할 수 있습니다.
- 대화형 프롬프트 모드로 여 러 도메인을 연속 조회할 수 있습니다.
개요
nslookup은 PC에 기본 설정된 네임서버를 통해서 원하는 도메인의 IP를 찾아주는 명령어입니다.
지원 운영체제
- Windows: cmd 실행 또는 보조 프로그램의 명령 프롬프트에서 사용
- Linux: 터미널에서 직접 사용
주요 용도
- 도메인 IP 주소 확인
- 메일서버(MX 레코드) 조회
- SPF 레코드(TXT) 확인
- 네임서버 정보 확인
- DNS 설정 검증 및 문제 해결
1. 도메인 IP 확인
기본 사용법
nslookup [도메인명]
원하는 도메인의 IP 정보가 출력됩니다.
예제
메인 도메인 조회:
C:\Users\780-32bit> nslookup simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
이름: simplexi.com
Address: 222.122.xxx.6
www 서브도메인 조회:
C:\Users\780-32bit> nslookup www.simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
이름: www.simplexi.com
Address: 222.122.xxx.6
메일 서브도메인 조회:
C:\Users\780-32bit> nslookup mail.simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
이름: mail.simplexi.com
Address: 203.231.xxx.10
2. 특정 네임서버를 통해서 IP 정보 확인
사용법
nslookup [도메인명] [네임서버명(또는 IP)]
입 력한 네임서버를 통해서 원하는 도메인의 IP를 조회하게 됩니다.
예제
LG 데이콤 네임서버로 조회:
C:\Users\780-32bit> nslookup simplexi.com ns.dacom.co.kr
서버: ns.lgdacom.net
Address: 164.124.101.2
권한 없는 응답:
이름: simplexi.com
Address: 222.122.xxx.6
KT 코넷 네임서버로 조회:
C:\Users\780-32bit> nslookup mail.simplexi.com kns.kornet.net
서버: kns.kornet.net
Address: 168.126.63.1
권한 없는 응답:
이름: mail.simplexi.com
Address: 203.231.xxx.10
"권한 없는 응답"의 의미
- Authoritative (권한 있는 응답): 해당 도메인의 공식 네임서버로부터 받은 응답
- Non-authoritative (권한 없는 응답): 캐시된 정보 또는 다른 네임서버로부터 받은 간접 응답
3. 특정 레코드 타입 조회
사용법
nslookup -type=[레코드타입] [도메인명]
-type 옵션을 추가하여 원하는 레코드를 조회할 수 있습니다.
3.1 메일서버 (MX 레코드) 조회
도메인의 메일 서버 IP 확인:
C:\Users\780-32bit> nslookup -type=mx simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
권한 없는 응답:
simplexi.com MX preference = 10, mail exchanger = mail.simplexi.com
mail.simplexi.com internet address = 203.231.xxx.10
결과 분석:
- MX preference = 10: MX 레코드 우선순위 (낮을수록 우선)
- mail exchanger: 메일을 처리하는 서버 호스트명
- internet address: 메일 서버의 실제 IP 주소
3.2 SPF/화이트도메인 (TXT 레코드) 조회
TXT 레코드를 확인해서 SPF 설정 및 화이트도메인 등록 여부 확인:
C:\Users\780-32bit> nslookup -type=txt simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
권한 없는 응답:
simplexi.com text =
"v=spf1 ip4:203.231.xxx.10 ip4:222.122.xxx.192 ip4:116.126.xxx.110 ~all"
SPF 레코드 의미:
- v=spf1: SPF 버전 1
- ip4:xxx.xxx.xxx.xxx: 메일 발송이 허용된 IP 주소
- ~all: 나열되지 않은 IP에서의 발송은 softfail 처리
4. nslookup 대화형 프롬프트 사용
프롬프트 진입
C:\Users\780-32bit> nslookup
기본 서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
>
nslookup 명령어만 입력하면 대화형 프롬프트로 이동하며, 여러 가지 질의를 연속으로 수행할 수 있습니다.
4.1 도메인 질의
PC에 기본 설정된 네임서버를 통해 도메인 조회:
C:\Users\780-32bit> nslookup
기본 서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
> simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
이름: simplexi.com
Address: 222.122.xxx.6
> www.cafe24.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
권한 없는 응답:
이름: www.cafe24.com
Address: 222.122.xxx.172
>
4.2 네임서 버 변경 후 질의
server 명령으로 디폴트 네임서버를 변경:
C:\Users\780-32bit> nslookup
기본 서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
> server ns.dacom.co.kr
기본 서버: ns.dacom.co.kr
Address: 164.124.101.2
> mail.cafe24.com
서버: ns.dacom.co.kr
Address: 164.124.101.2
권한 없는 응답:
이름: mail.cafe24.com
Address: 203.231.xxx.10
> www.simplexi.com
서버: ns.dacom.co.kr
Address: 164.124.101.2
권한 없는 응답:
이름: www.simplexi.com
Address: 222.122.xxx.6
>
4.3 MX 레코드 조회 (프롬프트 모드)
set type=mx 명령으로 레코드 타입 지정:
C:\Users\780-32bit> nslookup
기본 서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
> set type=mx
> simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
권한 없는 응답:
simplexi.com MX preference = 10, mail exchanger = mail.simplexi.com
mail.simplexi.com internet address = 203.231.xxx.10
>
4.4 TXT 레코드 조회 (프롬프트 모드)
SPF/화이트도메인 등록 여부 확인:
C:\Users\780-32bit> nslookup
기본 서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
> set type=txt
> simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
권한 없는 응답:
simplexi.com text =
"v=spf1 ip4:203.231.xxx.10 ip4:222.122.xxx.192 ip4:116.126.xxx.110 ~all"
>
4.5 모든 레코드 조회 (Zone 파일 전체)
set type=all로 도메인의 전체 DNS 레코드 확인:
C:\Users\780-32bit> nslookup
기본 서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
> set type=all
> simplexi.com
서버: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
simplexi.com
primary name server = simplexi.com
responsible mail addr = domain.simplexi.com
serial = 3733696240
refresh = 21600 (6 hours)
retry = 1800 (30 mins)
expire = 1209600 (14 days)
default TTL = 3600 (1 hour)
simplexi.com MX preference = 10, mail exchanger = mail.simplexi.com
simplexi.com text =
"v=spf1 ip4:203.231.xxx.10 ip4:222.122.xxx.192 ip4:116.126.xxx.110 ~all"
simplexi.com internet address = 222.122.xxx.6
simplexi.com nameserver = ns.simplexi.com
simplexi.com nameserver = ns2.simplexi.com
mail.simplexi.com internet address = 203.231.xxx.10
ns.simplexi.com internet address = 220.73.xxx.36
ns2.simplexi.com internet address = 211.34.xxx.125
ns2.simplexi.com internet address = 220.73.xxx.70
>
> exit
C:\Users\780-32bit>
출력 정보 설명:
| 항목 | 설명 |
|---|---|
| primary name server | 주 네임서버 |
| responsible mail addr | DNS 관리자 메일 주소 |
| serial | Zone 파일 버전 번호 |
| refresh | 보조 네임서버가 주 네임서버를 확인하는 주기 |
| retry | refresh 실패 시 재시도 주기 |
| expire | 주 네임서버 응답 없을 때 zone 데이터 유지 기간 |
| default TTL | 기본 캐시 유지 시간 |
4.6 프롬프트 종료
> exit
또는 Ctrl + C로 종료할 수 있습니다.
5. DNS 레코드 타입 종류
nslookup으로 조회 가능한 주요 레코드 타입:
| 레코드 타입 | 설명 | 사용 예 |
|---|---|---|
| NS | Name Server | 도메인 네임서버 지정 |
| MX | Mail Exchanger | 도메인의 메일 서버 지정 |
| A | Address | 호스트의 IPv4 주소 지정 |
| AAAA | IPv6 Address | 호스트의 IPv6 주소 지정 |
| CNAME | Canonical Name | 기존 호스트의 별칭 지정 |
| SOA | Start of Authority | 도메인의 권한 시작점 정보 기록 |
| HINFO | Host Information | 호스트의 CPU 및 OS 정보 |
| MINFO | Mailbox Information | 메일박스와 메일 리스트 정보 |
| PTR | Pointer | IP 주소에 대한 호스트명 (역방향 DNS) |
| TXT | Text | 임의의 텍스트 (SPF, DKIM, DMARC, 도메인 인증) |
| UINFO | User Information | 사용자 정보 기록 |
| ANY/ALL | All Records | 호스트 관련 모든 레코드 정보 |
6. 레코드 타입별 조회 예제
NS 레코드 조회
nslookup -type=ns cafe24.com
결과:
cafe24.com nameserver = ns1.cafe24.com
cafe24.com nameserver = ns2.cafe24.com
A 레코드 조회
nslookup -type=a www.cafe24.com
결과:
www.cafe24.com internet address = 222.122.xxx.172
CNAME 레코드 조회
nslookup -type=cname blog.example.com
결과:
blog.example.com canonical name = example.com
PTR 레코드 조회 (역방향 DNS)
nslookup -type=ptr 203.231.xxx.10
결과:
10.xxx.231.203.in-addr.arpa name = mail.simplexi.com
7. 실전 활용 예제
7.1 메일 발송 문제 진단
단계 1: MX 레코드 확인
nslookup -type=mx customer-domain.com
메일 서버가 올바르게 설정되었는지 확인합니다.
단계 2: 메일 서버 IP 확인
nslookup mail.customer-domain.com
메일 서버가 정상적으로 IP에 연결되어 있는지 확인합니다.
단계 3: SPF 레코드 확인
nslookup -type=txt customer-domain.com
SPF 설정이 올바른지 확인합니다.
7.2 도메인 이전 후 전파 확인
여러 네임서버에서 조회하여 DNS 전파 상태 확인:
# KT 네임서버로 조회
nslookup newdomain.com kns.kornet.net
# LG 네임서버로 조회
nslookup newdomain.com ns.dacom.co.kr
# Google Public DNS로 조회
nslookup newdomain.com 8.8.8.8
# Cloudflare DNS로 조회
nslookup newdomain.com 1.1.1.1
모든 네임서버에서 같은 IP를 반환하면 DNS 전파가 완료된 것입니다.
7.3 서브도메인 설정 검증
서브도메인이 올바르게 설정되었는지 확인:
nslookup www.example.com
nslookup blog.example.com
nslookup shop.example.com
nslookup api.example.com
각 서브도메인이 의도한 IP로 연결되는지 확인합니다.
7.4 웹사이트 접속 문제 해결
도메인이 정상적으로 IP로 변환되는지 확인:
# 1. 도메인 IP 확인
nslookup www.mysite.com
# 2. IP 직접 접속 테스트 (브라우저에서)
# http://xxx.xxx.xxx.xxx
# 3. 다른 네임서버로도 확인
nslookup www.mysite.com 8.8.8.8
8. 명령어 옵션
자주 사용하는 옵션
# 간단한 출력 (간결한 정보만 표시)
nslookup -query=a example.com
# 디버그 모드 (상세 정보 표시)
nslookup -debug example.com
# 타임아웃 설 정 (초 단위)
nslookup -timeout=5 example.com
# 재시도 횟수 설정
nslookup -retry=3 example.com
9. 대화형 프롬프트 명령어
주요 명령어
| 명령어 | 설명 | 예제 |
|---|---|---|
server [네임서버] | 디폴트 네임서버 변경 | server 8.8.8.8 |
lserver [네임서버] | 로컬 네임서버로 변경 | lserver ns1.example.com |
set type=[타입] | 레코드 타입 지정 | set type=mx |
set all | 현재 설정 확인 | set all |
set debug | 디버그 모드 활성화 | set debug |
set nodebug | 디버그 모드 비활성화 | set nodebug |
set timeout=[초] | 타임아웃 설정 | set timeout=10 |
exit | 프롬프트 종료 | exit |
설정 확인
> set all
Default Server: ad-pdc.intra.simplexi.com
Address: 192.168.xx.90
Set options:
nodebug
defname
search
recurse
nod2
novc
noignoretc
port=53
type=A
class=IN
timeout=2
retry=1
10. 문제 해결
"서버를 찾을 수 없음" 오류
원인:
- 네트워크 연결 끊김
- DNS 서버가 응답하지 않음
- 방화벽이 DNS 포트(53) 차단
해결 방법:
# 1. 네트워크 연결 확인
ping 8.8.8.8
# 2. Google Public DNS로 시도
nslookup example.com 8.8.8.8
# 3. DNS 서버 설정 확인 (Windows)
ipconfig /all
# 4. DNS 캐시 초기화
ipconfig /flushdns
"시간 초과" 오류
원인:
- 네임서버 응답 지연
- 방화벽 차단
- 잘못된 네임서버 주소
해결 방법:
# 타임아웃 시간을 늘려서 재시도
nslookup -timeout=10 example.com
# 또는 대화형 모드에서
> set timeout=10
> example.com
"권한 없는 응답" 의미
Non-authoritative answer는 오류가 아닙니다:
- 해당 도메인의 공식 네임서버가 아닌 다른 네임서버(중간 캐시 서버)에서 응답한 것
- 대부분의 경우 정상적인 응답이며, 결과는 신뢰할 수 있음
- 최신 정보가 필요하면 도메인의 공식 네임서버로 직접 조회
공식 네임서버로 조회:
# 1. NS 레코드로 공식 네임서버 확인
nslookup -type=ns example.com
# 2. 공식 네임서버로 직접 조회
nslookup example.com ns1.example.com
"서버 실패" 오류
원인:
- 네임서버 문제
- DNS 설정 오류
- Zone 파일 손상
해결 방법:
# 다른 공개 DNS 서버로 조회
nslookup example.com 8.8.8.8
nslookup example.com 1.1.1.1
# 여러 네임서버에서 같은 오류 발생 시 → 도메인 DNS 설정 문제
# 호스팅 업체 또는 도메인 등록 대행사에 문의
11. 공개 DNS 서버 목록
신뢰할 수 있는 공개 DNS 서버:
| 제공업체 | Primary DNS | Secondary DNS |
|---|---|---|
| Google Public DNS | 8.8.8.8 | 8.8.4.4 |
| Cloudflare | 1.1.1.1 | 1.0.0.1 |
| OpenDNS | 208.67.222.222 | 208.67.220.220 |
| Quad9 | 9.9.9.9 | 149.112.112.112 |
| KT | 168.126.63.1 | 168.126.63.2 |
| LG U+ | 164.124.101.2 | 203.248.252.2 |
사용 예제
nslookup example.com 8.8.8.8
nslookup example.com 1.1.1.1
12. 모범 사례
DNS 문제 진단 체크리스트
1단계: 로컬 DNS 서버로 조회
nslookup example.com
2단계: Google Public DNS로 조회
nslookup example.com 8.8.8.8
3단계: 공식 네임서버로 조회
# NS 레코드 확인
nslookup -type=ns example.com
# 공식 NS로 조회
nslookup example.com ns1.example.com
4단계: 레코드 타입별 확인
nslookup -type=a example.com
nslookup -type=mx example.com
nslookup -type=txt example.com
5단계: 모든 레코드 확인
nslookup -type=all example.com
DNS 변경 후 전파 확인
도메인 IP 변경 또는 네임서버 변경 후:
# 여러 공개 DNS로 확인
nslookup newdomain.com 8.8.8.8
nslookup newdomain.com 1.1.1.1
nslookup newdomain.com 168.126.63.1
nslookup newdomain.com 164.124.101.2
전파 완료 확인:
- 모 든 네임서버에서 동일한 IP 반환
- 일반적으로 수 분 ~ 48시간 소요 (TTL 설정에 따라 다름)
13. 관련 명령어
dig (Domain Information Groper)
nslookup보다 더 상세한 정보 제공 (Linux/Mac):
dig example.com
dig @8.8.8.8 example.com MX
dig example.com ANY
host
간단한 DNS 조회 (Linux/Mac):
host example.com
host -t mx example.com
host -a example.com
ping
도메인 IP 확인 및 연결 테스트:
ping example.com
참고사항
- nslookup은 DNS 조회 전용 도구이며, 실제 연결 테스트는 ping이나 telnet을 사용하세요.
- "권한 없는 응답"은 대부분 정상이며, 캐시된 정보를 의미합니다.
- DNS 전파는 최대 48시간이 걸릴 수 있으니 변경 후 시간을 두고 확인하세요.
- 메일 발송 문제 시 MX 레코드와 SPF 레코드를 함께 확인하세요.
- 프롬프트 모드는 여러 도메인을 연속으로 조회할 때 효율적입니다.
- Windows에서
ipconfig /flushdns로 DNS 캐시를 초기화할 수 있습니다.