Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a laptop running Windows 7 Professional. There are two wireless networks I connect to every day:

  • Home: no proxy server
  • Work: proxy server with authentication

On my iPad and iPhone, I've got two WIFI network profiles (one for home, one for work). The work one has the proxy server settings specified. The home one has no proxy specified. It all works great and I don't need to go changing settings around whenever I move from home to work or vice versa.

On my laptop, however, I can't seem to get this going. I can certainly connect to both networks, but when I'm at work I have to go and change the proxy settings (in Internet Options) to be able to use the network. When I'm at home, I have to then go and turn them off. It's a small thing, but considering this is something I have to do every day, it's a bit annoying.

Is there any way I can make Windows automatically switch proxy settings on or off based on the network I'm connected to?

share
    
Not quite what you are looking for, but does your work support auto proxy configuration? If so, just leave it on automatic. –  nonot1 Nov 2 '10 at 2:01
    
Unfortunately it doesn't - good thought though! –  John Nov 3 '10 at 5:36
    
i have the precise same problem, this is very annoying. –  JoséNunoFerreira May 2 '11 at 15:44
add comment

2 Answers

Most browsers today support a proxy configuration script. That's just a bit of javascript that takes the DNS name/IP as arguments, and returns a string to indicate which proxy to use.

http://en.wikipedia.org/wiki/Proxy_auto-config

Fairly simple even if you don't know javascript. And all you have to do is point your browser's "automatic proxy configuration script" setting at the file. Some browsers insist the script should be on the network somewhere.

There are small programs to host files from your own machine, such as http://tinyserver.sourceforge.net/

But I usually just put it on some local webserver I have handy.

Example autoconf.js:

   function FindProxyForURL(url, host) {
      // our local URLs from the domains below example.com don't need a proxy:
      if (shExpMatch(host, "*.example.com"))
      {
         return "DIRECT";
      }

      // URLs within this network are accessed through
      // port 8080 on fastproxy.example.com:
      if (isInNet(host, "10.0.0.0",  "255.255.248.0"))
      {
         return "PROXY fastproxy.example.com:8080";
      }

      // All other requests go through port 8080 of proxy.example.com.
      // should that fail to respond, go directly to the WWW:
      return "PROXY proxy.example.com:8080; DIRECT";
   }

That last bit is of particular importance, as it allows your system to attempt the proxy and then fall back to none.

There's also a variable myIpAddress, that can be used, as below:

function FindProxyForURL(url, host)
{
    if (isInNet(myIpAddress(), "192.168.1.0", "255.255.255.0"))
        return "PROXY 192.168.1.1:8080";
    else
        return "DIRECT";
}

Though some browsers/systems get confused on that point, and may return 127.0.0.1

share
add comment

Here are some free products that can switch all network attributes with one click :

Eusing Free IP Switcher
NetSetMan

NetSetMan has more a extensive feature-set, and the free version can flip : IP Addresses, Gateways (incl. Metric), DNS Servers, WINS Servers, IPv4 / IPv6, WiFi Management, Computer Name, Workgroup/domain, DNS Domain/Suffix, Default Printer, Network Drives, NIC Status and SMTP Server.

image

share
add comment

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .