美文网首页
linux 获取外网IP

linux 获取外网IP

作者: 零一间 | 来源:发表于2021-04-16 08:57 被阅读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

相关文章

网友评论

      本文标题:linux 获取外网IP

      本文链接:https://www.haomeiwen.com/subject/divslltx.html