I'm using my laptop in different offices, and whenever I switch locations I have to re-set the http proxy for wget, firefox, apt, etc...

Is there a way to do this automatically based on the local IP address I get? Fortunately these are from different subnets, so rules could be set up like that.

Another possibility would be to set up a local proxy on my laptop, and set it as the proxy. Then again the question is, how to have this proxy reconfigured automatically based on the IP address.

2 Answers 2


This seems to be something that NetworkManager should do; but based on some searching it doesn't seem to. The most robust solution that I've come across so far is completely managing it yourself.

Granted that's not the most convenient. Another interesting suggestion I came across while searching around for this issue was that you could dynamically generate a .pac file (proxy-auto config) and use Firefox's network.proxy.autoconfig_url to point to a script that returns the desired proxy information based on your subnet.


I had the same problems and wrote a script that does exactly what you want to achieve. I am running a small, low footprint local proxy that is automatically reconfigured as soon as my laptop gets a new IP address.

I have described the setup on my blog, where you can also download the script.

You must log in to answer this question.

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