Curl 纯文本格式输出:

curl icanhazip.com
curl ifconfig.me
curl curlmyip.com
curl ip.appspot.com
curl ipinfo.io/ip
curl ipecho.net/plain
curl www.trackip.net/i

curl JSON格式输出:

curl ipinfo.io/json
curl ifconfig.me/all.json
curl www.trackip.net/ip?json (有点丑陋)

curl XML格式输出:

curl ifconfig.me/all.xml

curl 得到所有IP细节 (挖掘机)

curl ifconfig.me/all

使用 DYDNS (当你使用 DYDNS 服务时有用)

curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\1/g'
curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"

使用 Wget 代替 Curl

wget http://ipecho.net/plain -O - -q ; echo
wget http://observebox.com/ip -O - -q ; echo

使用 host 和 dig 命令(如果有的话,你也可以直接使用 host 和 dig 命令。)

host -t a dartsclink.com | sed 's/.*has address //'
dig +short myip.opendns.com @resolver1.opendns.com

bash 脚本示例:

#!/bin/bash
PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`
echo $PUBLIC_IP

转自:https://my.oschina.net/epstar/blog/513186

几种在Linux下查询外网IP的办法(转)的更多相关文章

  1. 几种在Linux下查询外网IP的办法。

    几种在Linux下查询外网IP的办法.   Curl 纯文本格式输出: curl icanhazip.com curl ifconfig.me curl curlmyip.com curl ip.ap ...

  2. 几种在Linux下查询外网IP的办法

    原文地址:http://my.oschina.net/epstar/blog/513186 Curl 纯文本格式输出: curl icanhazip.com curl ifconfig.me curl ...

  3. Linux下查询外网IP的办法。

    Curl 纯文本格式输出:curl icanhazip.comcurl ifconfig.mecurl curlmyip.comcurl ip.appspot.comcurl ipinfo.io/ip ...

  4. linux下获取外网IP

    使用阿里云或者有多个网卡IP的机器需要取外网IP时,可以用下面这种 wget -qO - ifconfig.co 更多方法参考:https://yq.aliyun.com/ziliao/105999

  5. linux 下查看外网ip

    1. curl ipinfo.io ~/codes/qt_codes/qt-5.4.1-build$ curl ipinfo.io{  "ip": "114.241.21 ...

  6. linux下的外网木马前期要的工具

    这周看了demon哥的博客弄msf外网马,自己试了一下 首先去ngrok官网下载对应的系统版本,如果对应下载那个标签是绿色的(这里不支持windows) 下载好后在linux提取出来 让我们来看看他的 ...

  7. linux下查询域名或IP注册信息的操作记录(whois)

    在运维工作中,有时需要查询某些域名的注册信息(域名的NS,注册用户,注册邮箱等),可以使用whois这个命令.whois命令令用来查找并显示指定帐号(或域名)的用户相关信息,因为它是到Network ...

  8. Linux服务器查看外网IP地址的命令

    可以直接输入如下几个命令:1.curl ifconfig.me2.curl cip.cc3.curl icanhazip.com4.curl ident.me5.curl ipecho.net/pla ...

  9. 查看Linux机器的外网IP

    curl icanhazip.comcurl ifconfig.mecurl curlmyip.comcurl ip.appspot.comcurl ipinfo.io/ipcurl ipecho.n ...

随机推荐

  1. C#文件操作工具类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...

  2. js跟随的广告

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. MongoDB 2.4企业版分析

    作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs MongoDB v2.4版于3月19日发布,它引入了内置的文本搜索功能,以及基于哈希的分片和众所期盼的安全 ...

  4. HTML5标签embed详解

    摘要: <embed> 标签是 HTML 5 中的新标签,用来定义嵌入的内容,比如插件.类似于HTML 4.01 中的object和applet标签.我们要在网页中正常显示flash内容, ...

  5. python装饰器、继承、元类、mixin,四种給类动态添加类属性和方法的方式(一)

    介绍装饰器.继承.元类.mixin,四种給类动态添加类属性和方法的方式 有时候需要給类添加额外的东西,有些东西很频繁,每个类都需要,如果不想反复的复制粘贴到每个类,可以动态添加. # coding=u ...

  6. MVC5 Entity Framework学习之实现主要的CRUD功能

    在上一篇文章中,我们使用Entity Framework 和SQL Server LocalDB创建了一个MVC应用程序,并使用它来存储和显示数据.在这篇文章中,你将对由 MVC框架自己主动创建的CR ...

  7. LeetCode[Array]----3Sum

    3Sum Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find a ...

  8. iOS 定时器的比较

    然而,在iOS中有很多方法完成以上的任务,到底有多少种方法呢?经过查阅资料,大概有三种方法:NSTimer.CADisplayLink.GCD.接下来我就一一介绍它们的用法. 一.NSTimer 1. ...

  9. mysql 行转列 (case when的使用)

    现有 table1 如下 table2 如下 需要统计:各个部门每个月的绩效总和 实现如下:

  10. 转:ANDROID音频系统散记之四:4.0音频系统HAL初探

    昨天(2011-11-15)发布了Android4.0的源码,今天download下来,开始挺进4.0时代.简单看了一下,发现音频系统方面与2.3的有较多地方不同,下面逐一描述. 一.代码模块位置 1 ...