Reputation: 69
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}')
Upvotes: 0
Views: 4074
Reputation: 1457
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.
Upvotes: 0
Reputation: 119
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.
Upvotes: 0
Reputation: 365
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.
Upvotes: 1