Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Help with Geo::IP output

by afoken (Canon)
on Jun 29, 2020 at 23:38 UTC ( #11118685=note: print w/replies, xml ) Need Help??

in reply to Help with Geo::IP output

Just a minor note on guessing locations from IP addresses:

It does not work, period.

I'm currently sitting in Hamburg, Germany. Google can't even guess the right federal state from my public IP address. It guesses that I'm in Norderstedt, a pimple on Hamburg's butt small city close to Hamburg, but in the federal state of Schleswig-Holstein. (Hamburg is both a city and a federal state.) Why? Because my internet provider is actually two tightly coupled internet providers, one working in Hamburg as a private company, and another one working in Norderstedt as a private-public partnership company. (Yes, that sounds insane. But it works quite well.) Both share large parts of their infrastructure, and because the borderline between Hamburg and Schleswig-Holstein is literally just a few hundred meters away from my home, my internet line probably crosses the borderline and connects to network infrastructure located in Norderstedt instead of going a longer way to network infrastructure in Hamburg. Yes, it is an edge case, but still, even for this most trivial case, IP geolocation does not work.

Now, due to the COVID-19 pandemic, I worked from home for several weeks, using a VPN to my employer's office. All outgoing traffic is tunnelled through the VPN by policy, and despite sitting in Hamburg, that stupid geolocation guesswork now thinks that I'm 40 km away from Hamburg, close to Lübeck. Guessing that location is no big problem, because it has a fixed IP address, unlike my home.

Years ago, I had the same situation working on a VPN, but for a company that had its main office in Munich, Bavaria. And the geolocation guesswork had a "slight" error of about 600 km (800 km by car) at guessing my location. Imagine how wrong the guessed location is for their empoyees working on location all over the world, connected through the VPN to the Munich office. IP-based geolocation won't even guess the right continent!

Now imagine a pizza delivery service checking my "location" from my public IP address. "Yo, dude, Are you kiddin' me? You're sittin' in frickin' Bavaria, we won't drive 800 km twice to deliver a pizza!" Luckily, all pizza delivery services I use give a sh*t about that geolocation nonsense. They simply deliver to the address that I type into their web form. And if they think there's something fishy, they simply call your phone number.

Streaming services and some other retards do actually try to guess my location to restrict access. Well, use a server in the proper location, set up a VPN, issue solved.

Some clowns also try to guess where all of those evil hackers originate from, that trigger their snake oil incoming ping alert scam, or bring down their home-grown web frame work by issueing two requests withing one second. "And they all come from Russia, no China, no, wait, who's the evil state of the hour? Antarctia! Yes, that's where all of those evil people come from to invade our home county by hacking our computers. Just look at them! All of those little people dressed in black and white, with big *NAKED* yellow feet and those ridiculously large yellow noses. You really can't trust them!"


Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: Help with Geo::IP output
by Tux (Abbot) on Jun 30, 2020 at 08:17 UTC

    I agree that geographical location is informative only, but the registrar data is definitive. If I have an intrusion detection system for a voting system in the US, and you see repeated intrusion attempts from an IP that is registered in Russia, it is highly likely *not* a local registered voter. (swap any of the two countries with random other two countries)

    You don't need an exact location for that.

    And yes, that is one of the experiments I am doing. Nothing is automatic (yet), but reports are quite informative this way: I have my blocking and detection systems report the IP's to an analyser that expands them with Geographical location and registrar data.

    Fun facts: North Korea has only one registered CIDR of 1024 IP's. The Vatican has 321 CIDR's with a total of 13056 IP's.

    Enjoy, Have FUN! H.Merijn
      The Vatican has 321 CIDR's with a total of 13056 IP's.

      And only 453 residents. Mysterious ways, huh?

        Maybe all the cardinals and archbishops have dedicated VPNs?

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^2: Help with Geo::IP output
by Anonymous Monk on Jun 30, 2020 at 02:51 UTC

    Thanks for the reminder. For my purpose, I just need to know the country of the IP - not the specific state or city.

    I am able to use geoip from a perl script from the command line but I can't get the same script (with the shebang line added and correct cgi permission of 755 set) to run as a web script. It's frustrating (my apologies to those who helped with answering my questions from my earlier post venting my frustration).

    I saw someone suggesting Geo::IPfree and tried it. It works so I'm using that now.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11118685]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2021-03-02 01:56 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (33 votes). Check out past polls.