查询服务器外网IP和根据域名查询外网IP
程序员文章站
2022-04-09 12:39:35
...
linux经常需要查询服务器的外网IP,或是通过域名来查询该服务器对应的外网IP
1、查询本地服务器外网IP
curl ipinfo.io/ip
2、通过域名查询外网IP
通过执行命令:nslookup www.baidu.com 可得到下面结果
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 14.215.177.37
Name: www.a.shifen.com
Address: 14.215.177.38
或执行:ping www.baidu.com 则得到下面一个IP
PING www.a.shifen.com (14.215.177.37) 56(84) bytes of data.
64 bytes from 14.215.177.37: icmp_seq=1 ttl=47 time=7.53 ms
64 bytes from 14.215.177.37: icmp_seq=2 ttl=47 time=7.52 ms
64 bytes from 14.215.177.37: icmp_seq=3 ttl=47 time=7.58 ms
64 bytes from 14.215.177.37: icmp_seq=4 ttl=47 time=7.58 ms
1、查询本地服务器外网IP
curl ipinfo.io/ip
2、通过域名查询外网IP
通过执行命令:nslookup www.baidu.com 可得到下面结果
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 14.215.177.37
Name: www.a.shifen.com
Address: 14.215.177.38
或执行:ping www.baidu.com 则得到下面一个IP
PING www.a.shifen.com (14.215.177.37) 56(84) bytes of data.
64 bytes from 14.215.177.37: icmp_seq=1 ttl=47 time=7.53 ms
64 bytes from 14.215.177.37: icmp_seq=2 ttl=47 time=7.52 ms
64 bytes from 14.215.177.37: icmp_seq=3 ttl=47 time=7.58 ms
64 bytes from 14.215.177.37: icmp_seq=4 ttl=47 time=7.58 ms
上一篇: ps三角形怎么制作旋转扭曲的图形?