Re: [squid-users] Change tcp_outgoing_address every hour, best way to do this?

From: Pieter De Wit <pieter_at_insync.za.net>
Date: Wed, 14 Oct 2009 07:04:04 +1300 (NZDT)

Ah - this is what I was "looking" for....makes me wonder...i might change
my setup :)

So tcp_outgoing_address supports ACL's tagged to it, so you could have
something like....

acl morning time 06:00-11:59
acl afternoon time 12:00-18:00
acl night time 18:00-06:00

tcp_outgoing_address 1.2.3.4 morning # IP used in the morning
tcp_outgoing_address 1.2.3.4 afternoon # IP used in the afternoon
tcp_outgoing_address 1.2.3.4 night # IP used in the night

Cheers,

Pieter

On Tue, 13 Oct 2009, Henrik Nordstrom wrote:

> tis 2009-10-13 klockan 11:19 -0500 skrev Andres Salazar:
>> Hello,
>>
>> Iam wanting to pass the option of tcp_outgoing_address when I run the
>> command to refresh or reload the config file. This so that every hour
>> I can rorate with a cron the IP that squid uses to browse the
>> internet.
>>
>> Is this possible? Or is there a better way then to create dozens of
>> config files with the only difference being the IP?
>
> I would set up a included squid.conf snippet with 24
> tcp_outgoing_address settings (one per hour, selected by acl) and update
> this file nightly to assign a new set of IP addresses for the next day.
>
> generate_random_outgoing.sh
>
> #!/bin/sh
> top=`dirname $0`
> HOUR=0
> cat $1 | sort -R | while [ $HOUR -lt 24 ] && read ip; do
> printf "acl hour_%d time %02d:00-%02d:59\n" $HOUR $HOUR $HOUR
> printf "tcp_outgoing_address %s hour_%d\n" $ip $HOUR
> HOUR=`expr $HOUR + 1`
> done
>
> Usage:
> generate_random_outgoing.sh /path/to/file_with_ipaddresses.txt >/path/to/etc/squid/random_outgoing.conf
> squid -k reconfigure
>
> and in squid.conf
>
> include /path/to/etc/squid/random_outgoing.conf
>
> Regards
> Henrik
>
>
Received on Tue Oct 13 2009 - 18:05:38 MDT

This archive was generated by hypermail 2.2.0 : Wed Oct 14 2009 - 12:00:02 MDT