怎么查询公网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.me⇒112.95.47.23
$ curl ifconfig.me/ip⇒112.95.47.23
$ curl ifconfig.me/ua⇒Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
$ curl ifconfig.me/lang⇒zh-CN,zh;q=0.9,en;q=0.8
$ curl ifconfig.me/encoding⇒
$ curl ifconfig.me/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
$ curl ifconfig.me/charset⇒
$ curl ifconfig.me/forwarded⇒112.95.47.23, 34.117.59.81,130.211.0.59
$ curl ifconfig.me/all⇒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
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,即可。