简体   繁体   中英

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.

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 . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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