参考自:http://www.gaojinbo.com/linux%E5%86%85%E7%BD%91ip%E7%9A%84%E6%9C%BA%E5%99%A8%E5%A6%82%E4%BD%95%E6%9F%A5%E7%9C%8B%E6%9C%AC%E5%9C%B0%E5%A4%96%E7%BD%91ip.html

非常简单,下面一条命令搞定

curl ifconfig.me

完成!

更多命令以及返回结果如下:

Command Line Interface

$ curl ifconfig.me 221.7.252.66
$ curl ifconfig.me/ip 221.7.252.66
$ curl ifconfig.me/host  
$ curl ifconfig.me/ua Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11 QIHU THEWORLD
$ curl ifconfig.me/port 31255
$ curl ifconfig.me/lang zh-CN,zh;q=0.8
$ curl ifconfig.me/keepalive  
$ curl ifconfig.me/connection keep-alive
$ curl ifconfig.me/encoding gzip,deflate,sdch
$ curl ifconfig.me/mime text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
$ curl ifconfig.me/charset GBK,utf-8;q=0.7,*;q=0.3
$ curl ifconfig.me/via  
$ curl ifconfig.me/forwarded  
$ curl ifconfig.me/all ip_addr: 221.7.252.66

remote_host: 

user_agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11 QIHU THEWORLD

port: 31255

lang: zh-CN,zh;q=0.8

connection: keep-alive

keep_alive: 

encoding: gzip,deflate,sdch

mime: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

charset: GBK,utf-8;q=0.7,*;q=0.3

via: 

forwarded: 
$ curl ifconfig.me/all.xml <info>

    <charset>GBK,utf-8;q=0.7,*;q=0.3</charset>

    <connection>keep-alive</connection>

    <encoding>gzip,deflate,sdch</encoding>

    <forwarded></forwarded>

    <ip_addr>221.7.252.66</ip_addr>

    <keep_alive></keep_alive>

    <lang>zh-CN,zh;q=0.8</lang>

    <mime>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</mime>

    <port>31255</port>

    <remote_host></remote_host>

    <user_agent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11 QIHU THEWORLD</user_agent>

    <via></via>

</info>
$ curl ifconfig.me/all.json {"connection":"keep-alive","ip_addr":"221.7.252.66","lang":"zh-CN,zh;q=0.8","remote_host":"","user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11 QIHU THEWORLD","charset":"GBK,utf-8;q=0.7,*;q=0.3","port":"31255","via":"","forwarded":"","mime":"text/html,application/x

linux内网机器如何查看本地外网ip的更多相关文章

  1. Android 获取本地外网IP、内网IP、计算机名等信息

    一.获取本地外网IP public static String GetNetIp() { URL infoUrl = null; InputStream inStream = null; try { ...

  2. windows,linux,cmd查看公网/外网IP

    1.linux(centos)查看公网/外网ip: curl ifconfig.me #inconfig.me是一个网站来的#或者,如果上面的无法访问curl icanhazip.com   2.Wi ...

  3. 读取本地外网IP地址

    读取本地外网IP地址. 根据启动并运行的网卡名称,找到本机实际的IP地址(已知当前运行的无线网卡名包含某一个字符) import java.net.InterfaceAddress; import j ...

  4. Linux CentOS7 开启80,443端口外网访问权限

    一.查看系统防火墙状态(如果返回 running 代表防火墙启动正常) firewall-cmd --state 二.开启端口外网访问 1.添加端口 返回 success 代表成功(--permane ...

  5. vmware中linux虚拟机使用NAT模式不能连接外网解决

    linux虚拟机一直配置的桥接模式,今天改成NAT模式发现不能上外网 环境:VMware12,CentOS 6.8,NAT模式 ①电脑实际ip:192.168.1.100 ②NAT使用虚拟网卡网关: ...

  6. 阿里云VPC网络内网实例通过SNAT连接外网

    场景: 1.有多个ECS实例,其中A实例有公网IP,可以上外网 其它实例没有公网IP,不能上外网 2.所有实例在一个交换机,也就是一个网络(172.16.0.0/16) 实例 内网IP 外网IP A ...

  7. linux 能访问内网,但不能访问外网?解决方案

    用iptables就可以了 iptables -F iptables -t nat -F iptables -A INPUT -s -d -j ACCEPT iptables -A INPUT -d ...

  8. vmware能够ping通内网,上不了外网的解决方法

    一般这是由于里面的路由域名服务器没有配置好. issta@ubuntu:~$ ping www.baidu.com ping: unknown host www.baidu.com 先看一下地址解析器 ...

  9. linux操作系统运行一个java程序并外网访问

    (一)安装jdk 1.新建文档java  : mkdir java 2.进入java并且下载jdk     下载jdk : wget --no-check-certificate --no-cooki ...

随机推荐

  1. LCD1602指令集解读

    LCD1602指令集(11个)     1.清屏指令(clear display)   RS=0 ,R/w=0, 01H 功能:清除液晶显示器,即将DDRAM中的内容全部填入20H(空白字符)     ...

  2. SpringCloud IDEA 教学 (一) Eureka的简介与服务注册中心的建立

    写在开头 SpringCloud进来成为业界排名靠前的微服务框架,最核心功能就是搭建微服务,并在此基础上衍生出一系列功能,如断路器(Hystrix).断路监控.管理配置.Zuul.OAuth2等功能. ...

  3. URAL 1297 Palindrome(Manacher)

    The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent ...

  4. POJ 2208 Pyramids(求四面体体积)

    Description Recently in Farland, a country in Asia, a famous scientist Mr. Log Archeo has discovered ...

  5. MySQL用户管理及权限管理

    MySQL 默认有个root用户,但是这个用户权限太大,一般只在管理数据库时候才用.如果在项目中要连接 MySQL 数据库,则建议新建一个权限较小的用户来连接. 在 MySQL 命令行模式下输入如下命 ...

  6. Pipeline组Beta版本发布说明

    项目名称 Pipeline 项目版本 Beta版本 负责人 北京航空航天大学计算机学院 IloveSE 小组 联系方式 http://www.cnblogs.com/IloveSE 要求发布日期 20 ...

  7. joomla 出现The file Cache Storage is not supported on this platform;

    错误提示:The file Cache Storage is not supported on this platform:在这个平台上不支持文件缓存存储 出现这样的原因很简单,有两个文件夹不可写,这 ...

  8. Spring中Controller和RequestMapping的详解

    先看一个简单的实例: @Controller @RequestMapping("/hello") public class anyTypeController{ @RequestM ...

  9. java — 垃圾回收

    1. 垃圾回收的意义 在java中,当没有对象指向原先分配给某个对象的内存的时候,这片内存就变成了垃圾,JVM的一个系统级线程就会自动释放这个内存块,垃圾回收意味着程序不再需要的对象是“无用的信息”, ...

  10. python学习笔记06:操作文件

    调用内置的open函数打开文件,传递两个参数:文件路径(绝对路径或相对路径),打开模式('r':读,'r+':读写,'w':写,'b':二进制): f = open('data.txt','w') f ...