Linux下查询外网IP的办法。
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
最新文章
- 裁剪要素出现错误 :HRESULT:0x80040239
- RCP:gef智能寻路算法(A star)
- CSS 概念 Block Inline Containing block
- iOS支付宝集成时遇到的问题整理(1)
- linux下proc里关于磁盘性能的参数
- touch ImageView
- 什么是AJAX技术及其常识
- Mysql-udf-http 插件的安装与使用
- Java使用POI解析Excel表格
- MySQL:参数wait_timeout和interactive_timeout以及空闲超时的实现【转】
- 『数组的最大代价 贪心优化DP』
- 单元测试系列之八:Sonar 数据库表关系整理一(续)
- python接口自动化28-requests-html爬虫框架
- Mac下安装Mysql以及修改Mysql密码
- Android.StructureOfAndroidSourceCodeRootTree
- python traceback捕获并打印异常
- JS浏览器BOM
- LINUX下PHP编译添加相应的动态扩展模块so(不需要重新编译PHP,以openssl.so为例)
- 如何实现PLC与THINGWORX工业物联网平台对接
- React生命周期总结
热门文章
- 面经手册 · 第14篇《volatile 怎么实现的内存可见?没有 volatile 一定不可见吗?》
- echarts常用功能封装|抽象为mixin
- 微服务nacos服务注册与发现
- Oracl Linux KVM虚拟机备份
- altium designer使用小技巧,记录
- ctfshow 1024杯 部分web题解
- Google Cayley图数据库使用方法
- day78:luffy:前端对于token的认证&;滑动验证码的实现
- 【转】Setting up SDL 2 on MinGW
- Java关键字——break和continue、this等