how to determine location based on ip - geolocation

how do one determine location based on ip? I'm not asking for any product or service, but rather how to go about implementing it technically.
The ip to country is a rather static mapping. What about more specific locations?

geobyte is a good service to locate ip address. If you are thinking about an algorithm to find location based on IP, I think there is none. It is basically a database look up and you will retrieve the location based on the IP address.

Related

IP address with different country

We are using IP geolocation vendor in our application. And vendor will update their database in monthly basis.
But IP address is getting assigned to different country over time. Any proper reference or standard for this changes?
You can publish a geofeed file and host it in your website. The format is based on RFC 8805.
However, it is still up to the geolocation vendor to trust your feed and take into records. IP geolocation is under heavily manipulation due to many reasons.

Best way to spoof geo ip information in xDB

I am looking to spoof the geo ip information in my local sitecore 8 instance so I can create events widget based on which city the end user is in.
From my research I found you can either use the ForwardedRequestHttpHeader in the header to pass the IP or my own class to override the IP via startTracking pipeline. Both these method allow me to write the IP address into the Interaction collection in my xDB.
My question is how do I resolve the spoofed IP to get rest of the details in Interaction collection document such as city, state, country and postcode?
Please note: I currently do not have access to the sitecore geolocation service. So really need a way to mock all the geo location based data.
Not sure if it helps, but 8.1's Experience Explorer allows you to (natively) spoof locations. If you expand out the ribbon and goto the Experience Tab and click "Other" you'll see "Explore":
Once you click that, the UI will change over and expose two expandable tabs (on left and right). On the left slide-out, you can manage location by going to the "Visitor Information" section and opening the "GEO IP" tab.
What I needed to was to spoof the IP address but also create a custom geo ip lookup provider by overriding the method GetInformationByIp(string ip) in
LookupProviderBase.

Are geolocation services using other methods than pure IP address?

More than a question this may be general information . I am using a VPN service and located in the Middle East. I've found most (if not all but one) IP geolocation webpages shows my location as New York which matches the VPN IP address. But the service whatismyipaddres_dot_com shows the correct IP address and my location in Kuwait. Clicking some links on the mentioned webpage it takes me to a page showing they use several services from which one is showing Kuwait and the other two New York. However,contary on the expected "majority vote", they pick the single one different which, in fact, is right. As you can see they do not mention the name, but I believe the provider is Maxmind (maxmind_dot_com).
Sorry, not allowed to post images!!
Does anyone knows what they may be using ( router MAC? Google account ?).I use VPN to access ESPN , etc , but if this method is used by all other geoloc services in the future ,it will render the VPN unusable !
The web site whatismyipaddress dot com is using a mixture of HTML5 geolocation and IP geolocation.
Most likely your MAC address are being used to geolocate the location using HTML5 than using IP address geolocation.
Source: http://www.geolocation.com

Geolocation - How Does it Work?

I am using a script bought from Code Canyon (a weather script) and the script uses MaxMind GeoIP Javascript Web Service to determine my users current location. The question I have is how does MaxMind (or other geolocation services) determine the location?
When it determines my location it is on average about 30 miles away from my actual city. Why and how does it determine the location being there and not closer? I assume this has to do with my ISP and my ISP routing. Is this correct?
The location it is showing you is the location of your internet server.
If you are using the geolocation code which uses your ip address to get the current location then it will show the location of your host server.
Your ISP assigns you an IP when connecting. Obviously, the ISP bought that IP at one point, and the geolocation service you are using has an entry for it, in this case, a data center of your ISP.

Reverse lookup in Ruby (preferably with Dnsruby)

Using Dnsruby, which is great, but how do I do a reverse lookup for the hostname associated with an IP address? Or if not dnsruby, other suggested routes?
Here is what I am working with so far, and I figured that my query would have the resolved name also, but its not apparent to me.
resolver = Resolver.new
query = resolver.query("example.com")
ip = query.answer.first.address.to_s
As for more background, I am basically using this in a monitoring app, and with apps on Amazon EC2, and I'd like to see what the IP we've been assigned resolves to. I am hoping I can then use that to further assess potential its location etc.
Socket class can be used for looking up host name based on address.
See this answer for an example.

Resources