5

linux 获取外网IP

 3 years ago
source link: https://www.jianshu.com/p/85d35ada1f28
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

linux 获取外网IP

2021.04.16 00:57:31字数 90阅读 15

为了隐私问题,以下IP最后两位使用"2x.9x"代替。

cip.cc

# curl cip.cc
IP  : 81.69.2x.9x
地址  : 中国  中国

数据二 : 荷兰

数据三 : 中国北京北京 | 腾讯

URL : http://www.cip.cc/81.69.2x.9x

icanhazip.com

# curl icanhazip.com
81.69.2x.9x

ident.me

# curl ident.me
81.69.2x.9x

尾部不会主动换行

whatismyip.akamai.com

# curl whatismyip.akamai.com
81.69.2x.9x

尾部不会主动换行

myip.dnsomatic.com

# curl myip.dnsomatic.com
81.69.2x.9x

不是很稳定,容易出现"429 Too Many Requests" 提示.

ip.3322.net

# curl http://ip.3322.net
81.69.2x.9x

自定义命令别名

添加到 ".bashrc"文件

#vim ~/.bashrc 
...
alias myip='curl icanhazip.com'

重新载入

source .bashrc

测试

# source ~/.bashrc 
# myip
81.69.2x.9x

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK