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

栏目: 服务器 · 发布时间: 7年前

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

不管是在家里还是办公室,或者是公司的主机,很多时候都是在内网中,也就是说很多都是通过 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

dig

目前广受中外网友好评简单快速的查询公网 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

curl whatismyip.akamai.com
curl ifconfig.me
curl ipecho.net/plain
curl icanhazip.com

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Web Design for ROI

Web Design for ROI

Lance Loveday、Sandra Niehaus / New Riders Press / 2007-10-27 / USD 39.99

Your web site is a business--design it like one. Billions of dollars in spending decisions are influenced by web sites. So why aren't businesses laser-focused on designing their sites to maximize thei......一起来看看 《Web Design for ROI》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码