几种在Linux下查询外网IP的办法
2024-08-28 02:58:25
原文地址:http://my.oschina.net/epstar/blog/513186
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
nmap
最新文章
- Lesson 21 Mad or not?
- UVALive 4428 Solar Eclipse --计算几何,圆相交
- PAT 1036. 跟奥巴马一起编程(15)
- HTML案例—很讨巧的一种js+css制作hover模式展示二级菜单方法
- xcode配置绝对路径与相对路径
- 随机生成验证码import random
- Android数据共享
- iOS开发-关于网络状态的判断
- Workspace in use or cannot be created, choose a different one.--错误解决办法
- PHPFarm - How to run multiple versions of PHP on the same computer
- Selenium1 Selenium2 WebDriver
- eclipse 项目引入第三方jar包 3种方法
- 【Android测试工具】Android抓包解析全过程
- [python3.5][PyUserInput]模拟鼠标和键盘模拟
- logback配置信息
- cacti报警邮件的设置
- Jan.07
- 三、fgetc与fputc
- jquery-easyui:格式化列
- php的session获取不到问题之ie浏览器(yaf框架)