7

在命令行内获取公网 IP 的几种简单方法

 2 years ago
source link: https://wsgzao.github.io/post/myip/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
在命令行内获取公网 IP 的几种简单方法

不管是在家里还是办公室,或者是公司的主机,很多时候都是在内网中,也就是说很多都是通过 NAT 上网的,有时候需要查询下出口的公网 IP,如果有浏览器可以用百度或者 Google 搜索 ip 这个关键词得到公网 IP,那要是在命令行下呢?下面给大家分享下自己整理的几种方案

Extract your external IP using command line tools

2018 年 11 月 20 日 - 初稿

阅读原文 - https://wsgzao.github.io/post/myip/

扩展阅读

https://support.opendns.com/hc/en-us/search?utf8=%E2%9C%93&query=myip.opendns.com


目前广受中外网友好评简单快速的查询公网 IP 方案,OpenDNS 支持 IPv4 和 IPv6

# IPv4
dig -4 +short myip.opendns.com. @resolver1.opendns.com

# IPv6
dig -6 +short myip.opendns.com. @resolver1.opendns.com
curl whatismyip.akamai.com
curl ifconfig.me
curl ipecho.net/plain
curl icanhazip.com
curl ipinfo.io
curl https://api.myip.com

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK