Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2035
  • Last Modified:

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

0
AVONFRS
Asked:
AVONFRS
  • 3
  • 2
1 Solution
 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now