参考自: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. Learning Spatial-Temporal Regularized Correlation Filters for Visual Tracking---随笔

    Learning Spatial-Temporal Regularized Correlation Filters for Visual Tracking DCF跟踪算法因边界效应,鲁棒性较差.SRD ...

  2. HDU 3262/POJ 3829 Seat taking up is tough(模拟+搜索)(2009 Asia Ningbo Regional)

    Description Students often have problems taking up seats. When two students want the same seat, a qu ...

  3. 软工实践-Alpha 冲刺 (1/10)

    队名:起床一起肝活队 组长博客:博客链接 作业博客:班级博客本次作业的链接 组员情况 组员1(队长):白晨曦 过去两天完成了哪些任务 描述: 学习了UI设计软件的使用,了解了项目开发的具体流程. 展示 ...

  4. Swift-元祖

    1.元组是多个值组合而成的复合值.元组中的值可以是任意类型,而且每一个元素的类型可以是不同的. let http404Error = (,"Not Found") print(ht ...

  5. Httpd主配置文件httpd.conf 详解

    Apache的主配置文件:/etc/httpd/conf/httpd.conf默认站点主目录:/var/www/html/Apache服务器的配置信息全部存储在主配置文件/etc/httpd/conf ...

  6. linux解压zip

    用 unzip 的先安装 yum install -y unzip #unzip file.zip -d /root  -d指解压路径 ,不写的话默认当前目录

  7. Agile.Net 组件式开发平台 - 服务开发示例

    在上一篇文章中已经讲解了组件的开发,这篇文章讲解平台服务开发. Agile.Net开发管理平台项目,已经托管在开源中国码云平台(http://git.oschina.net) 登陆码云平台进入项目主页 ...

  8. .NET环境下,通过LINQ操作SQLite数据库

    //对应数据库中的某个表 [Table(Name = "main.Student")]    public class Student    {        [Column(Na ...

  9. overflow:scroll 滚动条不显示

    overflow:scroll 滚动条不显示 ::-webkit-scrollbar-thumb 可能因为 自定义的滚动条height比元素可展示内容大

  10. bzoj2437-兔兔与蛋蛋

    题目 分析 第一次做这种题,其实很简单. 只能经过一次的博弈可以考虑转化为二分图博弈. 棋盘上有黑白色的棋子,可以把这个游戏看作空格在棋子间移动,于是就想到,把棋盘黑白染色,以空格为黑,那么空格的移动 ...