LInux获取IP地址

Linux获取公网出口IP或者私网IP地址

得到本机的公网IP(出口IP)的方法:


国内首选
curl cip.cc
curl myip.ipip.net

获取ipv6地址:
curl https://ipv6.hkzww.com


国外
curl http://members.3322.org/dyndns/getip
curl ifconfig.me
curl ipinfo.io
curl -4/-6 icanhazip.com
curl ipinfo.io/ip
curl api.ipify.org
curl checkip.dyndns.org
dig +short myip.opendns.com @resolver1.opendns.com
host myip.opendns.com resolver1.opendns.com
curl ident.me
curl bot.whatismyipaddress.com
curl ipecho.net/plain
The following commands will get you the private IP address of your interfaces:

获取本地私网ip地址的方法:


ifconfig -a
ip addr (或者 ip a)
hostname -I | awk '{print $1}'
ip route get 1.2.3.4 | awk '{print $7}'
nmcli -p device show

money slow
文章已创建 1586

相关文章

开始在上面输入您的搜索词,然后按回车进行搜索。按ESC取消。

返回顶部
京ICP备11047313号-20