[size
=medium] linux经常需要查询服务器的外网IP
,或是通过域名来查询该服务器对应的外网IP
1、查询本地服务器外网IP
curl ipinfo.io/ip
2、通过域名查询外网IP
通过执行命令
:nslookup www.baidu.com 可得到下面结果
Non-authoritative answer:
www.baidu.com cano
nical 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
本文地址:http://sjzytwl.xhstdz.com/quote/60699.html
物流园资讯网 http://sjzytwl.xhstdz.com/ , 查看更多