简体   繁体   English

如何找到私有 IP 地址的位置?

[英]How can I find location of a private IP address?

Basically, I have created a program that finds the location of a public IP address, but out of curiosity is there any way to get my exact location with my private IP address.基本上,我创建了一个程序来查找公共 IP 地址的位置,但出于好奇,是否有任何方法可以使用我的私有 IP 地址获取我的确切位置。

import pygeoip
import requests
my_ip_addr = requests.get('https://api.ipify.org').text

gip = pygeoip.GeoIP('GeoLiteCity.dat')
res = gip.record_by_addr(my_ip_addr)

for key, val in res.items():
    print(f'{key} : {val}')

A private address is, as the name suggests, private .顾名思义,私有地址是private It only exists within your local network.它只存在于您的本地网络中。

From your program, only your public address can be seen, which is the address of your router.从你的程序中只能看到你的公网地址,也就是你路由器的地址。 Here are more details about the differences.以下是有关差异的更多详细信息。

So no, you cannot find your location using your private address.所以不,您无法使用您的私人地址找到您的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM