Linux系统中查找域名IP地址的方法
简介
在Linux系统中,可以使用以下 5 个命令查找域名IP地址:
方法一: dig
命令。
方法二: host
命令。
方法三: nslookup
命令。
方法四: ping
命令。
方法五: wget
命令。
方法一:dig
$ dig bing.com ; <<>> DiG 9.18.24-0ubuntu0.22.04.1-Ubuntu <<>> bing.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55989 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 65494 ;; QUESTION SECTION: ;bing.com. IN A ;; ANSWER SECTION: bing.com. 1643 IN A 13.107.21.200 bing.com. 1643 IN A 204.79.197.200 ;; Query time: 40 msec ;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP) ;; WHEN: Thu Jul 04 09:05:08 CST 2024 ;; MSG SIZE rcvd: 69
方法二:host
$ host bing.com bing.com has address 13.107.21.200 bing.com has address 204.79.197.200 bing.com has IPv6 address 2620:1ec:c11::200 bing.com mail is handled by 10 bing-com.mail.protection.outlook.com.
方法三:nslookup
~$ nslookup bing.com Server: 127.0.0.53 Address: 127.0.0.53#53 Non-authoritative answer: Name: bing.com Address: 13.107.21.200 Name: bing.com Address: 204.79.197.200 Name: bing.com Address: 2620:1ec:c11::200
方法四:ping
$ ping bing.com -c 1 PING bing.com (204.79.197.200) 56(84) bytes of data. 64 bytes from a-0001.a-msedge.net (204.79.197.200): icmp_seq=1 ttl=112 time=78.4 ms --- bing.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 78.368/78.368/78.368/0.000 ms
方法五:wget
$ wget --spider bing.com Spider mode enabled. Check if remote file exists. --2024-07-04 09:08:44-- http://bing.com/ Resolving bing.com (bing.com)... 204.79.197.200, 13.107.21.200, 2620:1ec:c11::200 Connecting to bing.com (bing.com)|204.79.197.200|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://cn.bing.com/ [following] Spider mode enabled. Check if remote file exists. --2024-07-04 09:08:44-- http://cn.bing.com/ Resolving cn.bing.com (cn.bing.com)... 202.89.233.101, 202.89.233.100 Connecting to cn.bing.com (cn.bing.com)|202.89.233.101|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 9243 (9.0K) [text/html] Remote file exists and could contain further links, but recursion is disabled -- not retrieving.