linux 获取外网IP

2021-04-16  本文已影响0人  零一间

常用命令

为了隐私问题,以下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
上一篇 下一篇

猜你喜欢

热点阅读