PAC File not working on multiple IP range

I have been looking into PAC files for proxy autoconfiguration on Internet Explorer.

We have multiple sites, and for a test PAC file, i have put 2 of these sites. One is on a 90 & the other is a 92 range.

Is the attached code correct? I have put just the 92 one in on a file by itself, and that worked fine. But when i try to add more than one range, it doesnt like it, and doesnt do anything.

Am i doing anything wrong?
function FindProxyForURL(url,host)
{
	if (
		isInNet(myIpAddress(), "192.168.90.0", "255.255.248.0") ||
		isInNet(myIpAddress(), "192.168.92.0", "255.255.248.0") 
	)
 
	return "PROXY 192.168.90.14:8000";
	else return "DIRECT";
}

Open in new window

LVL 1
AVONFRSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

elf_binCommented:
I think the problem is that both your addresses are on the same network.  If you calculate using the supplied subnet mask, I make the following:
NETWORK=192.168.88.0
BROADCAST=192.168.95.255
So you only need one entry as your network is actually just one network.

Hope this helps.
0
AVONFRSAuthor Commented:
Thanks for that information.

We have 25 locations each with different range, to our Headquarters which is 88-93. Headquarters has a 255.255.248.0 subnet mask, but the other 25 has 255.255.255.0

How would i go about adding for the rest of the sites with a subnet mask 255.255.255.0 and ip ranges:

90.104, 90.2, 90.3, 90.4, 90.5, 90.6, 90.7, 90.8, 90.10, 90.11, 90.12, 90.13, 90.14, 90.15, 90.16, 90.17, 90.18, 90.19, 90.20, 90.21, 90.22, 90.23, 90.24 & 90.25

Your help is appreciated if you can provide it.

0
elf_binCommented:
I don't quite understand what you're asking.  HQ network is 192.168.88.0 255.255.248.0 to 192.168.95.255 255.255.248.0 - that is one logical network.
Can you please provide the fully IP address and subnet mask ranges for these other sites (90.104, 90.2 is meaningless - 192.90.104.0 has meaning).
0
AVONFRSAuthor Commented:
Headquarters has a range of 192.168.88.0 - 192.168.93.0

The rest of the sites go like this:

192.168.2.0 - 255.255.255.0
192.168.3.0 - 255.255.255.0
192.168.4.0 - 255.255.255.0
192.168.5.0 - 255.255.255.0
192.168.6.0 - 255.255.255.0
192.168.7.0 - 255.255.255.0
192.168.8.0 - 255.255.255.0
192.168.10.0 - 255.255.255.0
192.168.11.0 - 255.255.255.0
192.168.12.0 - 255.255.255.0
192.168.13.0 - 255.255.255.0
192.168.14.0 - 255.255.255.0
192.168.15.0 - 255.255.255.0
192.168.16.0 - 255.255.255.0
192.168.17.0 - 255.255.255.0
192.168.18.0 - 255.255.255.0
192.168.19.0 - 255.255.255.0
192.168.20.0 - 255.255.255.0
192.168.21.0 - 255.255.255.0
192.168.22.0 - 255.255.255.0
192.168.23.0 - 255.255.255.0
192.168.24.0 - 255.255.255.0
192.168.25.0 - 255.255.255.0
192.168.104.0 - 255.255.255.0

All of these sites need to go through the proxy server 192.168.90.14:8000

Therefore i need the PAC to go through the list to see if the ip address is in one of those ranges.
0
elf_binCommented:
Because of the subnet mask, each address range is it;s own logical IP network.  You can do as you where doing, limiting each entry to the single network, so something like this:
function FindProxyForURL(url,host)
{
        if (
                isInNet(myIpAddress(), "192.168.90.0", "255.255.248.0") ||
                isInNet(myIpAddress(), "192.168.2.0", "255.255.255.0") ||
                isInNet(myIpAddress(), "192.168.3.0", "255.255.255.0") ||
                ......
           )
 
        return "PROXY 192.168.90.14:8000";
        else return "DIRECT";
}
BTW, the .... means and so on.
Or you can go more elaborate (for the future if things are likely to change).  You could assign a variable per site (so site proxy changes only involve changing the variable).  Something like:
function FindProxyForURL(url,host)
{
        var proxyHQ = "PROXY 192.168.90.14:8000";
        var proxySite1 = "PROXY 192.168.90.14:8000";
        var proxySite2 = "PROXY 192.168.90.14:8000";

        if (isInNet(myIpAddress(), "192.168.90.0", "255.255.248.0"))
           return proxyHQ;

        if (isInNet(myIpAddress(), "192.168.2.0", "255.255.255.0"))
           return proxySite1;

        if (isInNet(myIpAddress(), "192.168.3.0", "255.255.255.0"))
           return proxySite2;

}
and so on.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.