参考自: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. LeetCode 108——将有序数组转化为二叉搜索树

    1. 题目 2. 解答 一棵高度平衡的二叉搜索树意味着根节点的左右子树包含相同数量的节点,也就是根节点为有序数组的中值. 因此,我们将数组的中值作为根节点,然后再递归分别得到左半部分数据转化的左子树和 ...

  2. 算法模板の数学&数论

    1.求逆元 int inv(int a) { ) ; return (MOD - MOD / a) * inv(MOD % a); } 2.线性筛法 bool isPrime[MAXN]; int l ...

  3. 【python】scrapy相关

    目前scrapy还不支持python3,python2.7与python3.5共存时安装scrapy后,执行scrapy后报错 Traceback (most recent call last): F ...

  4. 自测之Lesson7:设备文件操作

    题目:请编写一个输入密码(不回显)的程序,要求通过设置终端来完成. 完成代码: #include <stdio.h> #include <unistd.h> #include ...

  5. Bacon's Cipher(培根密码)

    Description Bacon's cipher or the Baconian cipher is a method of steganography (a method of hiding a ...

  6. Microsoft.Practices.EnterpriseLibrary

    项目中使用了Microsoft.Practices.EnterpriseLibrary这个东西,根据名字猜测和微软有关系(可以翻译为:微软实践企业库). 看到了引入了两个命名空间: using Mic ...

  7. LintCode-70.二叉树的层次遍历 II

    二叉树的层次遍历 II 给出一棵二叉树,返回其节点值从底向上的层次序遍历(按从叶节点所在层到根节点所在的层遍历,然后逐层从左往右遍历) 样例 给出一棵二叉树 {3,9,20,#,#,15,7}, 按照 ...

  8. 字符串数组去重 ["a","b","c","a","b","c"] --> ["a","b","c"]

    非正则实现: let str_arr=["a","b","c","a","b","c&qu ...

  9. Jmeter系列-webdriver代码范例

    范例 WDS.sampleResult.sampleStart() try{ //打开博客首页 WDS.browser.get('http://xqtesting.blog.51cto.com') / ...

  10. 判断集合不为空Java

    list.size>0判断集合size是否大于0 list.isEmpty()判断集合是否为空,返回布尔值