2

How can I easily get the IP address blocks for a particular state or city within the US?

I was thinking that I could plug that into my iptables firewall to restrict traffic.

3
  • 3
    I'm not sure IP blocks are strictly allocated based on location. Many of the original blocks were allocated to multinational corporations. Do you have a specific need to block traffic from certain geographic locations? This sounds somewhat like hunting for a solution to a problem that doesn't exist, mostly since the geographic region of traffic's origin will likely play little role in the quality of traffic on this specific of a scale. May 16, 2012 at 19:46
  • 3
    I will add that if you are trying to block traffic from individuals based on geographic location, it would be trivial for them to appear to be coming from a different location.
    – EBGreen
    May 16, 2012 at 19:52
  • MaxMind's GeoLite City is a free database that you can download that contains IP address to city mappings. May 16, 2012 at 20:03

2 Answers 2

1

this is the service that I have used for that: http://www.maxmind.com/app/javascript_city

ips are not allocated based on state/city etc.

0

A lot of IPs are allocated by state and town or neighborhood. If you use any of the free IP lookup services you will see that this is so. You can also add code to your website to block access to any range of IP addresses that you want to block.

The only remaining task is to get a list of IP addresses by city or state. There have to be such lists, otherwise all those free IP lookup services would not work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .