20220603怎么查询公网IP

本文介绍了三种方法来查询公网IP地址:访问http://ip.cn、http://ip138.com和http://ifconfig.me。此外,还提供了通过命令行工具curl访问ifconfig.me获取IP及相关信息的示例,并提及了在Windows系统中使用cmd查询本地网络配置的快捷方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

怎么查询公网IP

别扒拉我代码

于 2022-01-14 10:45:34 发布

13853
 收藏 1
文章标签: tcp/ip 服务器 网络协议 程序人生
版权
如果我们连接的是公司或者学校的局域网,查询公网的IP方法有:

①:在浏览器上输入http://ip.cn。

 

②:在浏览器上打开http://ip138.com,这是一个国内的外网地址;

 

 

 

③:同样通过浏览器访问http://ifconfig.me,国外的外网地址;

 

 

Need a robust API to Geolocate IPs and fetch other crucial information? Try IPInfo.io.

What Is My IP Address? - ifconfig.me

Your Connection

IP Address112.95.47.23
User AgentMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
Languagezh-CN,zh;q=0.9,en;q=0.8
Referer
MethodGET
Encoding
MIME Typetext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Charset
X-Forwarded-For112.95.47.23, 34.117.59.81,130.211.0.59

Command Line Interface

$ curl ifconfig.me112.95.47.23
$ curl ifconfig.me/ip112.95.47.23
$ curl ifconfig.me/uaMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
$ curl ifconfig.me/langzh-CN,zh;q=0.9,en;q=0.8
$ curl ifconfig.me/encoding
$ curl ifconfig.me/mimetext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
$ curl ifconfig.me/charset
$ curl ifconfig.me/forwarded112.95.47.23, 34.117.59.81,130.211.0.59
$ curl ifconfig.me/allip_addr: 112.95.47.23
remote_host: unavailable
user_agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
port: 43310
language: zh-CN,zh;q=0.9,en;q=0.8
referer:
connection:
keep_alive:
method: GET
encoding:
mime: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
charset:
via: 1.1 google
forwarded: 112.95.47.23, 34.117.59.81,130.211.0.59
$ curl ifconfig.me/all.json{"ip_addr":"112.95.47.23","remote_host":"unavailable","user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36","port":43310,"language":"zh-CN,zh;q=0.9,en;q=0.8","method":"GET","mime":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","via":"1.1 google","forwarded":"112.95.47.23, 34.117.59.81,130.211.0.59"}

以上就是查询我们所用的公网IP

补充:如果我们想查询自己本台电脑的网络,可采用快捷键:Win+R,输入CMD,在”黑窗口”下输入ipconfig/all,即可。
————————————————
版权声明:本文为优快云博主「别扒拉我代码」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/qq_56948714/article/details/122488546

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值