cURL 命令获取本机外网 IP

此功能仅用于查看本机公网地址,请勿用于其他用途,并遵守中国法律法规。

1.1 查询本机外网 IP

curl ipw.cn

106.224.145.147
1
2
3

1.2 输出格式为 JSON

curl ipw.cn/locate

{
    "result":true,
    "IP":"106.224.145.147",
    "Address":{
        "Country":"中国",
        "Province":"江西",
        "City":"南昌"
    },
    "ISP":"电信"
}
1
2
3
4
5
6
7
8
9
10
11
12

1.3 输出格式为 YAML

curl ipw.cn/locate?format=yaml

IP: 106.224.145.147
Address:
  Country: 中国
  Province: 江西
  City: 南昌
ISP: 电信
1
2
3
4
5
6
7
8

1.4 输出格式为 IP

curl ipw.cn/myip

106.224.145.147
1
2
3

1.5 输出格式为 CSV

curl ipw.cn/locate?format=csv

106.224.145.147,中国,江西,南昌,电信
1
2
3

1.6 查询指定 IP

curl ipw.cn/query?ip=106.224.145.147

{
    "result":true,
    "IP":"106.224.145.147",
    "Address":{
        "Country":"中国",
        "Province":"江西",
        "City":"南昌"
    },
    "ISP":"电信"
}
1
2
3
4
5
6
7
8
9
10
11
12

reference

访客IP: (, , , )