How can I find location of a private IP address?

2.9k Views Asked by At

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}')
3

There are 3 best solutions below

0
Alexandre Marcq On

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.

0
Reincoder On

No. A private IP is PRIVATE. To get location or other insights such as network level information, you must provide the PUBLIC IP address to a IP geolocation service.

0
Michael C. On

No. There is no way to geolocate using private IP address.

Let's consider the real world scenario. The 10.0.0.1 is a private IP address. Network administrator in location X assigned 10.0.0.1 to one machine in LAN A. Another network administrator in location Y assigned 10.0.0.1 to another machine in LAN B. Therefore, there is no unique geolocation information can be assigned to private IP address.