host 명령어 (AIX 5.3·6.1)

핵심 정리

  • 호스트 이름을 IP 주소로, IP 주소를 호스트 이름으로 풉니다. 시스템의 이름 풀이 설정(local, NIS, BIND 순서)을 그대로 따르므로 응용 프로그램이 보는 결과와 같습니다.
  • host 이름, host IP, host 이름 DNS서버로 씁니다.
  • -n(또는 hostnew 명령)을 주면 BIND(DNS)로만 풀며, -t mx, -t ns, -t soa처럼 레코드 종류를 지정할 수 있습니다.
  • 이름 풀이 순서는 /etc/netsvc.conf(예: hosts=local,bind)나 환경 변수 NSORDER로 정합니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (두 버전의 내용이 같음)
원문 IBM Commands Reference — 5.3 Volume 2, 6.1 Volume 2
파일 /usr/bin/host, /usr/bin/hostnew, /etc/hosts, /etc/netsvc.conf
관련 명령어 nslookup, dig, named, hostname

목적

호스트 이름을 IP 주소로, 또는 IP 주소를 호스트 이름으로 풉니다.

영어 원문

Resolves a host name into an Internet Protocol (IP) address or an IP address into a host name.

구문

text
host [ -n [ -a ] [ -c Class ] [ -d ] [ -r ] [ -t Type ] [ -v ] [ -w ] ] Hostname | Address [ Server ]
hostnew [ -a ] [ -c Class ] [ -d ] [ -r ] [ -t Type ] [ -v ] [ -w ] Hostname | Address [ Server ]

설명

/usr/bin/host 명령은 HostName 매개변수를 주면 호스트의 IP 주소를, Address 매개변수를 주면 호스트 이름을 돌려줍니다. 이름 풀이 서비스 구성에 따라 HostName에 연결된 별칭도 보여 줄 수 있습니다. 이름 풀이 서비스의 예로 local, nis, bind가 있습니다.

로컬 호스트가 DNS를 쓰면 로컬 /etc/hosts를 찾기 전에 로컬이나 원격 네임 서버 데이터베이스를 조회합니다.

영어 원문

The /usr/bin/host command returns the IP address of a host machine when the HostName parameter is specified and the name of the host when the Address parameter is specified. Depending on the configuration of name resolution service, the host command might also display any aliases that are associated with the HostName parameter. Examples of name resolution services include local, nis, and bind.

If the local host is using the Domain Name Protocol, the local or remote name server database is queried before it searches the local /etc/hosts file.

플래그

플래그 설명
-a -v -t *와 같습니다.
-c Class 인터넷이 아닌 데이터를 찾을 때 볼 클래스. IN(인터넷), CHAOS, HESIOD(MIT Athena Hesiod), ANY(모두).
-d 디버깅 모드를 켭니다.
-n /usr/bin/hostnew 명령을 실행하는 것과 같습니다. hostnew는 BIND 이름 풀이를 합니다.
-r 재귀 처리를 끕니다.
-t Type 조회할 레코드 종류(아래 표).
-v 자세한 모드.
-w DNS 서버의 응답을 끝없이 기다립니다.
레코드 뜻
A 호스트의 IP 주소
CNAME 별칭의 정식 이름
HINFO 호스트 프로세서와 운영 체제 종류
KEY 보안 키 레코드
MINFO 메일함이나 메일 목록 정보
MX 메일 교환기
NS 그 영역의 네임 서버
PTR 조회가 IP 주소면 호스트 이름, 아니면 다른 정보를 가리키는 포인터
SIG 서명 레코드
SOA 도메인의 권한 시작(start-of-authority) 정보
TXT 텍스트 정보
UINFO 사용자 정보
WKS 지원하는 잘 알려진 서비스
영어 원문
  • -a — Equivalent to using "-v -t *"
  • -c Class — Specifies the class to look in when it searches non-Internet data. Valid classes follow: IN Internet class CHAOS Chaos class HESIOD MIT Althena Hesiod class ANY Wildcard (any of the above)
  • -d — Turns on debugging mode.
  • -n — Equivalent to issuing the /usr/bin/hostnew command. The hostnew command performs bind resolution service.
  • -r — Disables recursive processing.
  • -t Type — Specifies the type of record to query for. Valid types follow: A Host's IP address CNAME Canonical name for an alias HINFO Host processor and operating system type KEY Security Key Record MINFO Mailbox or mail list information MX Mail exchanger NS Nameserver for the named zone PTR Host name if the query is an IP address; otherwise, the pointer to other information SIG Signature Record SOA Domain's "start-of-authority" information TXT Text information UINFO User information WKS Supported well-known services
  • -v — Verbose mode.
  • -w — Waits forever for a reply from the DNS server.

매개변수

매개변수 설명
Address 호스트 이름을 풀 때 쓸 호스트의 IP 주소(점 10진수).
HostName IP 주소를 풀 때 쓸 호스트 이름. 고유한 이름이나 nameserver, printserver, timeserver 같은 잘 알려진 이름(있다면)을 씁니다.
Server 조회할 네임 서버.
영어 원문
  • Address — Specifies the IP address of the host machine to use in resolving the host name. The Address parameter must be a valid IP address in dotted decimal format.
  • HostName — Specifies the name of the host machine to use in resolving the IP address. The HostName parameter can be either a unique host name or a well-known host name (such as nameserver, printserver, or timeserver, if these names exist).
  • Server — Specifies the nameserver to query.

예제

명령 출력 예
host mephisto mephisto is 192.100.13.5, Aliases: engr, sarah
host 192.100.13.1 mercutio is 192.100.13.1

도메인 test.ibm.com의 MX 레코드를 봅니다. 두 명령은 같습니다.

bash
host -n -t mx test.ibm.com
hostnew -t mx test.ibm.com
text
test.ibm.com mail is handled (pri=10) by test1.tt.ibm.com
test.ibm.com mail is handled (pri=10) by test2.aix.ibm.com

자주 쓰는 형태:

bash
host aixhost01                    # 시스템 이름 풀이 순서대로
host aixhost01 10.1.1.53          # 특정 DNS 서버에 물음
NSORDER=bind host aixhost01       # DNS로만 풀어 봄
NSORDER=local host aixhost01      # /etc/hosts로만 풀어 봄
grep hosts /etc/netsvc.conf       # 이름 풀이 순서 설정
영어 원문
  1. To display the address of a host machine named mephisto, enter the following command:
host mephisto

The output is similar to the following information:

mephisto is 192.100.13.5, Aliases: engr, sarah
  1. To display the host whose address is 192.100.13.1, enter the following command:
host 192.100.13.1

The output is similar to the following information:

mercutio is 192.100.13.1
  1. To display the MX records for the domain named test.ibm.com, enter:
host -n -t mx test.ibm.com

or

hostnew -t mx test.ibm.com

The output is similar to the following information:

test.ibm.com mail is handled (pri=10) by test1.tt.ibm.com
test.ibm.com mail is handled (pri=10) by test2.aix.ibm.com

파일

파일 설명
/etc/hosts 로컬 네트워크 호스트의 IP 이름과 주소
영어 원문
  • /etc/hosts — Contains the Internet Protocol (IP) name and addresses of hosts on the local network.

Related reference:

  • hostname Command

Related information:

  • named command
  • Communications and networks

리눅스(GNU)와 다른 점

리눅스의 host(BIND 도구)는 DNS만 조회하며 /etc/hosts는 보지 않습니다. 시스템 이름 풀이 순서(/etc/nsswitch.conf)를 따르는 조회는 getent hosts 이름으로 하며, 이것이 AIX host(옵션 없이)에 가깝습니다. AIX host -n·hostnew는 리눅스 host, dig에 해당하고, 레코드 종류는 host -t mx 도메인처럼 똑같이 줍니다.