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

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

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

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

查看所有标签

猜你喜欢:

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

Squid: The Definitive Guide

Squid: The Definitive Guide

Duane Wessels / O'Reilly Media / 2004 / $44.95 US, $65.95 CA, £31.95 UK

Squid is the most popular Web caching software in use today, and it works on a variety of platforms including Linux, FreeBSD, and Windows. Squid improves network performance by reducing the amount of......一起来看看 《Squid: The Definitive Guide》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具