IPアドレスからホスト名(FQDN)を調べる方法 (Linux)

提供:あわ自由帳

nslookupコマンド

最初はIPアドレスを調べ、その結果(IPアドレス)で再度nslookupコマンドを実行しています。

正引き

[root@host3 ~]# nslookup www.isc.org                                            
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
Name:   www.isc.org
Address: 149.20.64.69

逆引き

[root@host3 ~]# nslookup 149.20.64.69                                           
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
69.64.20.149.in-addr.arpa       name = banana.isc.org.

Authoritative answers can be found from:
64.20.149.in-addr.arpa  nameserver = ams.sns-pb.isc.org.
64.20.149.in-addr.arpa  nameserver = sfba.sns-pb.isc.org.
64.20.149.in-addr.arpa  nameserver = ord.sns-pb.isc.org.

digコマンド

最初はIPアドレスを調べ、その結果(IPアドレス)で再度nslookupコマンドを実行しています。

正引き

[root@host3 ~]# dig www.isc.org

; <<>> DiG 9.9.4-RedHat-9.9.4-14.el7 <<>> www.isc.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28253
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.isc.org.                   IN      A

;; ANSWER SECTION:
www.isc.org.            60      IN      A       149.20.64.69

;; AUTHORITY SECTION:
isc.org.                1994    IN      NS      ord.sns-pb.isc.org.
isc.org.                1994    IN      NS      ams.sns-pb.isc.org.
isc.org.                1994    IN      NS      ns.isc.afilias-nst.info.
isc.org.                1994    IN      NS      sfba.sns-pb.isc.org.

;; Query time: 26 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: 土  8月 30 11:14:32 JST 2014
;; MSG SIZE  rcvd: 155

逆引き

[root@host3 ~]# dig -x 149.20.64.69

; <<>> DiG 9.9.4-RedHat-9.9.4-14.el7 <<>> -x 149.20.64.69
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25547
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;69.64.20.149.in-addr.arpa.     IN      PTR

;; ANSWER SECTION:
69.64.20.149.in-addr.arpa. 3131 IN      PTR     banana.isc.org.

;; AUTHORITY SECTION:
64.20.149.in-addr.arpa. 3130    IN      NS      ord.sns-pb.isc.org.
64.20.149.in-addr.arpa. 3130    IN      NS      sfba.sns-pb.isc.org.
64.20.149.in-addr.arpa. 3130    IN      NS      ams.sns-pb.isc.org.

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: 土  8月 30 11:20:39 JST 2014
;; MSG SIZE  rcvd: 144