Re: [squid-users] Proxy Autodetect scripts

From: Billy Macdonald <whmac33@dont-contact.us>
Date: Thu, 09 Sep 2004 21:35:00 -0700

alaslavic@havertys.com wrote:
>
>
>
> alaslavic@havertys.com wrote on 09/09/2004 07:35:13 AM:
>
>
>>
>>
>>
>>Billy Macdonald <whmac33@comcast.net> wrote on 09/09/2004 02:25:38 AM:
>>
>>
>>>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
>>
>>I will try using myIpAddress()== "10.7.1.216" and see what happens. By
>>"breaks down" I mean that it seems that beneath the host, 255.255.255.255
>>lines does not bother to work. I will replace the host/mask definition
>>with the myIpAddress()== "10.7.1.216" and see what happens.
>>
>>Thanks
>>
>
>
> Excuse me for replying to myself. The reason this was not working, as
> mentioned by Billy above, is that the first IP listed by ipconfig is not
> the IP address I had defined in the autodetect script. Many of the windows
> machines I had specified sit on multiple subnets. Thanks for the tip
> Billy. I'll have to find another way to get this working.
>
>

Well at least you won't bang your head against the wall as much. It
sure was confusing me when I was trying to get it working. If you
figure it out please let me know as I eventually gave up.

Thanks,
Billy
Received on Thu Sep 09 2004 - 22:38:29 MDT

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