proxy script does not work when two networking cards are connected. How to fix this?

6,170

Solution 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) ...

Solution 2

@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.

Share:
6,170

Related videos on Youtube

Bick
Author by

Bick

Updated on September 17, 2022

Comments

  • Bick
    Bick over 1 year

    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";
    }
    
    • Jeremy Rossi
      Jeremy Rossi over 14 years
      What OS and browser?
    • squillman
      squillman over 14 years
      What version of Windows and browser are your clients?
    • Bick
      Bick over 14 years
      Windows XP Pro SP3, Internet Explorer 7
  • Telemachus
    Telemachus about 13 years
    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 hardforum.com//showthread.php?t=1445677, myIpAddress() will always return a VMWare adapter. Any ideas?
  • Terrance
    Terrance over 11 years
    Credit for this method goes to spike305 in this MSDN thread. I couldn't include it in my original post due to a 2-link per post limit.