Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".(Japanese Version)

Find IP address from hostname

Find IP address from hostname

Looking up an IP address from a host name is called "forward DNS lookup".
This process can be done by making a query to the name server (DNS) to receive IP address information.

●Use the dig command to find out the IP address.

Try to find the IP address of the Yahoo hostname "https://www.yahoo.co.jp/".
Check the ANSWER SECTION of the execution result, and you will see the IP address of "https://www.yahoo.co.jp/".

[root@Lion ~]# dig www.yahoo.co.jp

; <<>> DiG 9.9.4-RedHat-9.9.4-72.el7 <<>> yahoo.co.jp
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57625
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;yahoo.co.jp. IN A

;; ANSWER SECTION:
yahoo.co.jp. 297 IN A 182.22.25.252
yahoo.co.jp. 297 IN A 183.79.219.252
yahoo.co.jp. 297 IN A 183.79.250.123
yahoo.co.jp. 297 IN A 182.22.16.251
yahoo.co.jp. 297 IN A 183.79.250.251
yahoo.co.jp. 297 IN A 183.79.217.124
yahoo.co.jp. 297 IN A 182.22.25.124
yahoo.co.jp. 297 IN A 182.22.28.252

;; Query time: 4 msec
;; SERVER: 192.168.11.1#53(192.168.11.1)
;; WHEN: Sun 11 30 11:40:32 JST 2021
;; MSG SIZE rcvd: 168

Note that the ";; SERVER: 192.168.11.1#53(192.168.11.1)" part in the above result is the IP address of the cache DNS server specified in
IP address of the cache DNS server specified in /etc/resolv.conf.

●Simplified view.(+short option)

ヤフーのhttps://www.yahoo.co.jp/というホスト名のIPアドレスを求めてみます。

[root@Lion ~]# dig www.yahoo.co.jp +short

82.22.25.252
183.79.250.251
182.22.25.124
182.22.16.251
183.79.250.123
183.79.217.124
182.22.28.252
183.79.219.252

Copied title and URL