Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – Darth Android May 16 '12 at 19:46
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 '12 at 19:52
MaxMind's GeoLite City is a free database that you can download that contains IP address to city mappings. – David Schwartz May 16 '12 at 20:03

this is the service that I have used for that:

ips are not allocated based on state/city etc.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.