8

I'm using Squid and I want to know how to make a specific IP range of allowed connections, I use this

acl permittedips src 77.86.72.49

http_access allow permittedips

But I want to make an range that allows from 70.*.*.* to 90.*.*.*. How can I do this the easiest way?

MacMac
  • 1,931
  • 8
  • 30
  • 38

2 Answers2

7

You can use CIDR notation to signify this in the ACL for squid. You would want:

acl permittedips src 70.0.0.0/8
acl permittedips src 90.0.0.0/8

More information on CIDR:

http://en.wikipedia.org/wiki/CIDR_notation

polynomial
  • 3,968
  • 13
  • 24
  • This doesn't seem to work? My IP is `86.132.x.x` and I can't connect to squid, it works if I put my oringinal IP address, but I want to specify the range **BETWEEN** `70.*.*.*` to `90.*.*.*`. – MacMac Aug 26 '11 at 18:11
  • Oh, I missed the 'to' part. You really can't do that easily with CIDR, you'd be best off adding 20 rows one for 70, 71, 72...89, 90. – polynomial Aug 26 '11 at 20:32
  • Hmm, didn't work. When I restart squid, it tells me `start: Job failed to start`. On `service squid start`. – MacMac Aug 26 '11 at 20:50
  • You probably need to give different names to each block, like permittedips70, permittedips71 – polynomial Aug 26 '11 at 21:19
  • 1
    @polynomial No, it is possible to use same acl name for multiple lines. He should look into squid `cache.log` for errors. – AlexD Aug 29 '11 at 05:51
0

Although this is a very old thread but since it still shows up on Google when searching for squid ip range I am going to give a new answer that worked for me.

Squid allows you to specify a range of ips in accordance to:

acl permittedips src 1x.x.x.x-2x.x.x.x

So in this case:

acl permittedips src 70.0.0.0-90.255.255.255

Erik T
  • 1
  • 1