Re: [squid-users] Proxy Autodetect scripts

From: Billy Macdonald <whmac33@dont-contact.us>
Date: Wed, 08 Sep 2004 23:25:38 -0700

alaslavic@havertys.com wrote:

>
>
>
> I'm having some issues with the black art of proxy autodetect scripts
> (wpad.dat). I'm having a tough time getting it to work consistantly. I am
> doing a phased roll-out of a squid proxy server, and want to the the
> autodetect return "proxy:3128" for some ip addresses, and "DIRECT" for
> others.
>
> The script works for some hosts, but not for others. It works in the first
> couple of class C subnets mentioned, but it breaks down where the specific
> hosts are set to DIRECT (with the mask of 255.255.255.255), or anywhere
> below that in the script such as where 10.7.0.0/255.255.254.0 is supposed
> to be proxied.
>
> Anyone have any suggesions?
>
> code below:
> ################ wpad.dat ##############
> if (isInNet(myIpAddress(), "10.7.39.0", "255.255.255.0")) {
> return "PROXY proxy:3128";
> }
> else if (isInNet(myIpAddress(), "10.7.22.0", "255.255.255.0")) {
> return "PROXY proxy:3128";
> }
> else if (isInNet(myIpAddress(), "10.7.33.0", "255.255.255.0")) {
> return "PROXY proxy:3128";
> }
> else if (isInNet(myIpAddress(), "10.7.34.0", "255.255.255.0")) {
> return "PROXY proxy:3128";
> }
> else if (isInNet(myIpAddress(), "10.7.35.0", "255.255.255.0")) {
> return "PROXY proxy:3128";
> }
> else if (isInNet(myIpAddress(), "10.7.1.216", "255.255.255.255")) {
> return "DIRECT";
> }
> else if (isInNet(myIpAddress(), "10.7.1.217", "255.255.255.255")) {
> return "DIRECT";
> }
> else if (isInNet(myIpAddress(), "10.7.1.219", "255.255.255.255")) {
> return "DIRECT";
> }
> else if (isInNet(myIpAddress(), "10.7.0.0", "255.255.254.0")) {
> return "PROXY proxy:3128";
> }
> else {
> return "DIRECT";
> }
> }
> ####### end wpad.dat ############
>
>
>
> Alex Laslavic
> Havertys Tech Services
>
>

It looks like it should work. Is it possible that the isInNet doesn't
work well with at "255.255.255.255" mask. You could try
if (myIpAdress() == "10.7.1.216") instead. I've never used it with host
masks, just subnets.

Also define "breaks down". Do those three host go through the proxy but
the 10.7.0.0 ppl go out direct or do you get some sort of error?

Finally I've had issues where myIpAddress() returns the first IP listed
by ipconfig on Windows 2k laptops that were VPN instead of the PPTP IP.
  Never did find a workaround.

Billy
Received on Thu Sep 09 2004 - 00:28:57 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Oct 01 2004 - 12:00:02 MDT