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

提供:あわ自由帳

nslookupコマンド

www.yahoo.co.jpのIPアドレスを調べてみます。

正引き

[root@host3 ~]# nslookup www.yahoo.co.jp                                        
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
www.yahoo.co.jp canonical name = www.g.yahoo.co.jp.
Name:   www.g.yahoo.co.jp
Address: 183.79.139.228

digコマンド

www.google.co.jpのIPアドレスを調べてみます。

正引き

[root@host3 ~]# dig www.google.co.jp

; <<>> DiG 9.9.4-RedHat-9.9.4-14.el7 <<>> www.google.co.jp
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43422
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 7, ADDITIONAL: 14

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.google.co.jp.              IN      A

;; ANSWER SECTION:
www.google.co.jp.       299     IN      A       173.194.126.239
www.google.co.jp.       299     IN      A       173.194.126.247
www.google.co.jp.       299     IN      A       173.194.126.248
www.google.co.jp.       299     IN      A       173.194.126.255

;; AUTHORITY SECTION:
jp.                     14383   IN      NS      b.dns.jp.
jp.                     14383   IN      NS      f.dns.jp.
jp.                     14383   IN      NS      a.dns.jp.
jp.                     14383   IN      NS      g.dns.jp.
jp.                     14383   IN      NS      d.dns.jp.
jp.                     14383   IN      NS      e.dns.jp.
jp.                     14383   IN      NS      c.dns.jp.

;; ADDITIONAL SECTION:
a.dns.jp.               164020  IN      A       203.119.1.1
a.dns.jp.               164020  IN      AAAA    2001:dc4::1
b.dns.jp.               164020  IN      A       202.12.30.131
b.dns.jp.               164020  IN      AAAA    2001:dc2::1
c.dns.jp.               164020  IN      A       156.154.100.5
c.dns.jp.               164020  IN      AAAA    2001:502:ad09::5
d.dns.jp.               164020  IN      A       210.138.175.244
d.dns.jp.               164020  IN      AAAA    2001:240::53
e.dns.jp.               164020  IN      A       192.50.43.53
e.dns.jp.               164020  IN      AAAA    2001:200:c000::35
f.dns.jp.               164020  IN      A       150.100.6.8
f.dns.jp.               164020  IN      AAAA    2001:2f8:0:100::153
g.dns.jp.               164020  IN      A       203.119.40.1

;; Query time: 43 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: 土  8月 30 11:34:00 JST 2014
;; MSG SIZE  rcvd: 505