2

I'm tired of commenting in and out different proxy acquire lines which located in /etc/apt/apt.conf.d/10proxy as I change networks. Is there a way for binding the settings for networks? Iphones have an option like that, but I wonder if I can do it with my computer without writing a script for doing that for me. I've made a little search and checked man proxy & man 10proxy but they don't exist and couldn't find anything useful.

2 Answers 2

2

I suggest pacproxy if you are familier with Ruby. After installation, you can use like as follows.

$ bundle exec pacproxy -P ~/proxy.pac -p 3128

$ export $PROXY=localhost:3128
0

Whenever a network interface goes up or down, scripts in /etc/network/*.d are executed.

So for example you could make /etc/apt/apt.conf.d/10proxy a symbolic link whose target gets changed by a script in /etc/network/if-up.d. These scripts get a few environment variables, in particular IFACE with the interface name; you can use ifconfig, route, ip, etc. to obtain information about the network that's being joined. The interfaces(5) man page documents this facility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.