1

I have deployed a wpad.dat. Works like a charm except for some users that are connected to two networks at the same time (ethernet and another networkadapter that emulates an analog modem for fax). I also tested this with my notebook. When I connect to the LAN through cable and at the same time to another network through WiFi, I do not get a connection to the internet. When I provide the proxy address directly, it works.

How do I have to change my script, in order to solve my problem?

function FindProxyForURL(url, host) {
    if (isInNet(host, "127.0.0.1", "255.255.255.255"))
        return "DIRECT";
    if (shExpMatch(url, "*.intranet.*/*"))
        return "DIRECT";
    if (isInNet(myIpAddress(), "172.0.0.0", "255.255.0.0"))
        return "PROXY 10.1.1.254:8080";
    return "DIRECT";
}
Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
mrt181
  • 171
  • 1
  • 10

3 Answers3

4

@Palmin I had the same problem, and thankfully stumbled upon a solution in this social.technet thread! The priority of adapter IPs that Windows returns to a browser's myIpAddress() implementation can be modified by changing the IP metrics.

I manually set the metrics for my physical adapters to 1, 2, etc, and put the VirtualBox Host-Only Network at the end. It works like a charm now.

My specific configuration/journey for others struggling with the same issue:

  • Windows 7 Enterprise
  • VirtualBox 4.1.20 r80170

Accessing web pages on the Internet when on wireless always failed. When on a wired connection they worked just fine, and intranet pages were always accessible. Disabling the VirtualBox Host-Only Network adapter resolved the issue. Manually configuring my browser to always use a proxy (versus auto-detect) also resolved the issue.

To confirm the nature of the PAC problem, I used the pactester utility to test the behavior of wpad.dat with my physical addresses versus the VirtualBox one. As expected, the proxy script returns direct connections for private IPv4 addresses. The default VirtualBox Host-Only IPv4 address is in the 192.168.x.x range.

Modifying the adapter priority did not resolve the issue for me. It was not fully (and cleanly) resolved until I modified the metrics for each adapter.

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Terrance
  • 141
  • 2
  • Credit for this method goes to spike305 in this [MSDN thread](http://social.technet.microsoft.com/Forums/en-US/ieitprocurrentver/thread/903a5985-f83d-4ec5-aea5-698ff6786114). I couldn't include it in my original post due to a 2-link per post limit. – Terrance Sep 10 '12 at 13:48
1

I have a solution, eureka :)

I had to change the priority of the network interfaces. The interface (LAN) that will have access to the proxy has to be the first interface, if more than one interface is connected to some network.

This lead to my solution: http://www.geurtsrus.com/gerke/2005/01/proxy-auto-configuration-blues.html

Paragraph starts with: Credits to Oliver Presland (Microsoft UK) ...

mrt181
  • 171
  • 1
  • 10
  • Changing the network interface priority does not seem to work on Windows 7 together with Firefox and a proxy.pac file. Even though I have changed the network interface order like described in http://hardforum.com//showthread.php?t=1445677, myIpAddress() will always return a VMWare adapter. Any ideas? – Palmin Feb 13 '11 at 13:07
0

This may not work (sorry). The design of PAC was to assume that there was a single, primary interface, and that you could tell it make choices of what proxy on that primary interface should be used.

The most likely cause is that your proxy address is in the address range of the "wrong" interface. You'd have to provide netstat -rn for me to figure that out.

benc
  • 663
  • 1
  • 5
  • 13