本文记录我常用的几种在Linux下查看出口IP的方式
- curl icanhazip.com
- curl ifconfig.me
- curl http://members.3322.org/dyndns/getip
演示一下
chenshang@chenshangMacBook-Pro:~$ time curl icanhazip.com
103.37.140.38
real 0m0.682s
user 0m0.008s
sys 0m0.009s
chenshang@chenshangMacBook-Pro:~$ time curl ifconfig.me
103.220.76.84
real 0m0.294s
user 0m0.008s
sys 0m0.007s
chenshang@chenshangMacBook-Pro:~$ time curl http://members.3322.org/dyndns/getip
103.37.140.21
real 0m0.082s
user 0m0.008s
sys 0m0.007s
看来 curl http://members.3322.org/dyndns/getip
耗时最短,当然这也跟你所处的地理位置和网络环境有关。