How can you calculate the geographic distance (e.g. 500 miles) between 2 IP addresses?
Is there some API that lets you look this up?
you can check this questtion distance between 2 ip address
This might be the closest you're gonna get: Who provides a WHOIS API? as #carl norum said not all IP addresses resolve to a physical location due to ISP and DNS server locations and other fun routing magic. But if you do get the client's ISP it's up to that ISP to release the physical address of their client.
Related
This issue came up as a result of SEO concerns, but having done some further research, it seems Google feels that IP/hosting location are now a weak signal for ranking, at best. So now I'm just curious, as I'm only familiar with networking on a basic level.
I have several sites hosted in the europe-west-1 region. Each site is on a compute engine instance with an external static IP assigned. I can ping the domains/IPs and then have my colleague in the UK ping the same and based on response time it's clear that the IP is ultimately resolving in Europe (probably Dublin, Ireland where it should be). But a DNS lookup of the same domain/IP lists the IP in Mountain View, CA? It always comes out like this: xxx.xxx.xxx.xxx.bc.googleusercontent.com. Is this Google acting like an ISP, and then the routing to Europe is behind the scenes? Why do none of the IPs show as resolving in the data center where the instances are hosted?
It sounds like you are conflating three concepts:
The domain registration for the googleusercontent.com reverse DNS
The SWIP record for the subnet
The routing decision to reach an IP
All three are independent. All GCE instance IP addresses have a reverse DNS entry that maps to xxx.xxx.xxx.xxx.bc.googleusercontent.com. This domain is under Google's control and therefore registered to the HQ in Mountain View.
The SWIP record / WHOIS entry denotes the administrative ownership of an IP address resp. its subnet. It's therefore also registered to the HQ in Mountain View.
Both of these do not reflect anything about physical location of the machine answering packets to an IP address nor the decisions on how packets are routed to the destination.
Google has a global network. Packets to a GCE instance will cross over to Google's network relatively close to the client. Since Google maintains a lot of peerings with ISPs worldwide, most of the time your packets will end up on Google's network directly from your ISP.
If you run a traceroute to your instance, you might see hops with airport codes in their reverse DNS names, especially when traversing peering points. The hops internal to Google usually do not hint any further at geographical location.
And finally, when the "proximity" or location of an IP address is discussed, most of the time the relevant metric is the latency or network distance to the host - not the geographical distance. (Although geographical distance sets a lower bound for latency as packets cannot go faster than the speed of light)
could you please help me understand why am I getting Phoenix IP address when I ping my service? This site is fully behind Cloudflare CDN so I would expect it will serve me nearest datacenter which is Prague, Europe. Not Phoenix.
Ip I´m getting http://www.ip2location.com/104.31.80.242
thank you
This is an anycast address from CloudFlare, you can see it as CDN in the usage type in IP2Location. The exact server location depends to your own location. You could not use a geolocation database to detect the server location because there are many servers sharing the same IP address.
You can try to ping the IP address. If it is less than 50ms latency, then it should be very good.
I have a theoretical question here on IP's.
We all know how to do a simple trace on a IP address ether in the cmd or via a web application to find a Physical Geo location linked to that ip. My Question is can this be reversed?
For example if i know the address of my house and i am on holiday how would i find my ip?
My line of thought is that there is a massive data base of ip to Geo location can you just reverse the search ? if not why and what would be the kinda of problems to overcome. Is there another way of doing it?
There is no way you can do it, because it is one-directional relationship. IP address does not depend directly on your physical location. Think about it that way: if you connect to your wifi from your neighbour's home, does it mean that your IP has changed? Your address depends on location only in the way that your ISP operates within certain area only and some IP address range is reserved for him.
In theory you could determine the IP address based on physical address if you had access to your ISP's customers database, but unless you are e.g. a police officer working on some case, you have no legal access to it.
The problems to overcome would be breaking into databases of every ISP in the world ;)
If you want to have access to your computer while on holiday, it's enough to have a static IP or use a service like dyndns.
What are the other types of DNS available?
How does it makes difference in resolving host names?
There is unicast and anycast DNS. For clients they are indistinguishable, if only you don't measure time needed for a name resolve. Unicast DNS is an old and simple installation type: your have one primary DNS server which is physically located somewhere. So it may take much time for packets to travel over a globe to that server. Anycast DNS is a new installation type. Instead of one server you have many servers in different spots on the Earth, but that servers respond to the same IP address. And requests are routed to the closest server. So response time can be much less.
I have our customers iso generated ip addresses where I like to do some analysis to see where our most customers are accessing our site.
I tried to do api calls to
http://ip-api.com/<ip address>
to retrieve the state where the ip address generated but there are over 4 million ip addresses to process and this will take some time.
Are ip addresses designated by State in the US? If first octets are designated to the states, I can then write a script to parse out the ip addresses. Other than api calls to determine the location of the ip address?
I recommend using something like Maxmind that can get the geo-location(city,State) of the IP addresses. They have an API that you can implement into your code to find the location of all IP's in a database.