linux/unix/windows 查询服务器查询出口 ip

1. 使用 curl 命令

比如下面这个

curl cip.cc

 

2. 也可以在浏览器中直接输入 url 地址:http://www.cip.cc/

 

3. 其他的类似的网址:

https://ipinfo.io/

curl ipinfo.io

 

https://ifconfig.me/

curl ifconfig.me

 

https://ifconfig.io/

curl ifconfig.io

 

https://icanhazip.com/

curl icanhazip.com

 

4. 原理

curl cip.cc 获取公网IP的原理是利用curl命令发送HTTP请求到http://cip.cc这个网站,该网站会返回访问者的公网IP地址。

具体步骤如下:

  1. 访问http://cip.cc网站。
  2. 服务器接收到请求,处理请求。
  3. 服务器获取访问者的公网IP地址。
  4. 服务器返回包含公网IP地址的响应。
  5. 访问者的浏览器或curl客户端接收响应,显示或处理公网IP地址。

 

posted @ 2024-07-16 00:20  纵码万水千山  阅读(3)  评论(0编辑  收藏  举报