LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   How do I set a system wide proxy setting? (https://www.linuxquestions.org/questions/linux-wireless-networking-41/how-do-i-set-a-system-wide-proxy-setting-602516/)

iAlta 11-26-2007 01:02 PM

How do I set a system wide proxy setting?
 
I need to set a system wide proxy setting, on my openSUSE 10.3 laptop.

Internet in my school is behind a proxy server.
Currently only Firefox's "Auto-detect proxy setting for this network" works. Which is great as Firefox is the mostly used web-required application I use, but fx. Pidgin, Lifera and Yast don't work.

I need to set a system-wide proxy setting, and be able to turn in of quickly, as I don't have a proxy at home.

nx5000 11-27-2007 06:00 AM

Pure System wide mechanism is through the environment variable http_proxy.
(Gnome is also using gconf but will not talk about Window Manager specific)

This has to be set for all shells and all applications.
One way is to do the proxy detection when you initially login and then export the value to sub-shells (non login shells, normally what you get in a window manager)

Do It Yourself method:

If your interfaces go up during boot (before your login shell is started), then you can set this variable based on your ip adress:
Example, when you are at work (you have ip 1.2.3.4), connections through eth1 should go through a proxy.

In /etc/profile:

Code:

cur_ip=`/sbin/ifconfig eth1 | sed -e '/inet\ adr/!d;s/.*inet adr:\([0-9\.]*\).*/\1/'`
if [ "$cur_ip" == "1.2.3.4" ]; then
        export http_proxy="http://1.2.3.251:3128"
fi


iAlta 11-27-2007 11:46 AM

Wooow!
That's pretty cool, thanks, I don't quite get it, but thanks!!

The network connection goes through wlan0, and it's a ndiswrapper driver, which isn't really properly installed, I have to modprobe it after every boot.

Anyways, that piece of code, should I append it to the /etc/profile? And what if I use DHCP(which I am), will it still work?

nx5000 11-28-2007 05:58 AM

Quote:

Originally Posted by iAlta (Post 2972343)
Wooow!
That's pretty cool, thanks, I don't quite get it, but thanks!!

LOL you're welcome.
Quote:

The network connection goes through wlan0, and it's a ndiswrapper driver, which isn't really properly installed, I have to modprobe it after every boot.

Anyways, that piece of code, should I append it to the /etc/profile? And what if I use DHCP(which I am), will it still work?
This piece of code can be appended at the end of /etc/profile yes.
It will look what is your current ip and decide accordingly.

But if at this moment the connection has no ip, it can not check..
So you need to do the modprobe before login into your WM.
Then use your current tool to autoconfigure the network (Or are you starting dhcp manually or static ip?) which will give you an ip. If it's graphic tool, you have a problem here...
And then start your wm which will read /etc/profile, the export command and give it to all applications opened in the wm.

And then the services that you want to use (pidgin,..), you have to check if they really works through http... For example bittorent doesn't go through a proxy, pidgin and stuff no idea.


All times are GMT -5. The time now is 07:03 AM.