Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to set Network Proxy to use my LAN's internet connection to update packages. while the proxy settings works on my firefox, but the package manager still cannot connect to Internet. I have set proxy in System >> Preferences >> Network Proxy and I have entered the user/pass for the proxy in 'Details' too.

How can I make sure that the Proxy Network is applied correctly?

share|improve this question
add comment

8 Answers

up vote 8 down vote accepted

First of all make sure you click on "Apply system-wide..." whenever you change proxy settings in the gnome-network-properties (System -> Preferences -> Network Proxy). This sets http_proxy and related environment variables. This should be available to all programs started after the proxy setting is "Applied system-wide...". To be really sure, you can logout and back-in to double-check this.

If you open a terminal and use the command set | grep -i proxy you would see the relevant environment variables set. Ideally this should be enough.

However, I have faced situations where all the above still doesn't work: Synaptic or apt-get (over commandline) can't connect to the internet through the proxy even after it is set in the above way. In such cases, one solution is to add a file in /etc/apt/apt.conf.d with specific proxy configuration for apt (this will be used by apt-get, aptitude, synaptic and Ubuntu software center).

Follow the below steps:

  1. Create /etc/apt/apt.conf.d/40proxy

    gksudo gedit /etc/apt/apt.conf.d/40proxy

  2. Put the following contents into it - modify the contents to suit your situation.

    Acquire::http::Proxy "http://proxy.site.com:8080";

If you have a user-name & password you could encode the same in the proxy url (like so, http://username:password@proxy.site.com:8080) or you can use something like ntlmaps for better control.

More info could be found here.

share|improve this answer
1  
thanks! first for introducing set. then as you predicted there were still problems with apt-get and update manager... and by creating 40proxy it solved. the only remained problem just root sees the proxy. e.g wget whatismyip.com has different outputs with normal user and root. –  takpar Sep 12 '10 at 15:47
    
Can you elaborate your remaining problem ? For example, If you set proxy using System -> Preferences -> Network Proxy and Apply System-wide... then are you saying commands run as root user do not see this setting ? (Meaning sudo wget whatismyip.com does not return proxy's IP address ?) –  koushik Sep 12 '10 at 18:36
    
On another note, make sure you backup this 40proxy file (say, somewhere in your home folder), I have had this mysteriously disappearing. I think selecting Direct connection to Internet on Network Proxy dialog probably wipes this. It could be an issue with my system also, but not sure. –  koushik Sep 12 '10 at 18:38
add comment

Have you clicked the Apply System Wide (highlighted) button? If you don't proxy settings are local to your Gnome session and therefore when root goes off to download packages, it won't use the same network settings.

Proxy settings

share|improve this answer
    
yes, i've done that. –  takpar Sep 8 '10 at 6:37
add comment

There's a bunch of good answers above that will help you if you're having problems (which is what your question implies). However, this is an answer to the narrow question of checking whether the Network proxy settings have been applied:

Method 1: Start a new shell (xterm), then check the environment variables:

% env | grep -i proxy
http_proxy=http://172.17.0.130:8080/
ftp_proxy=ftp://172.17.0.130:8080/
all_proxy=socks://172.17.0.130:8080/
...

Note that existing shells will not have updated environment variables. So if you're executing a command that looks at environment variables for its proxy settings, start it in a shell created after the changes to the proxy settings.

Method 2: Use gconftool to query the gconf settings (which are stored under ~/.gconf):

% gconftool -R /system/proxy 
 old_ftp_port = 0
 old_ftp_host = 
 old_secure_port = 0
 old_secure_host = 
 autoconfig_url = 
 mode = manual
 ftp_host = 172.17.0.130
 secure_host = 172.17.0.130
 ...

% gconftool -R /system/http_proxy 
 use_authentication = false
 authentication_password = 
 authentication_user = 
 ignore_hosts = [localhost,127.0.0.0/8,*.local,...]
 use_http_proxy = true
 port = 8080
 use_same_proxy = true
 host = 172.17.0.130

As others have noted, be sure that your browser and other apps are set to "Use System Proxy Settings".

share|improve this answer
add comment

To set a proxy temporarily you can fire up a terminal and enter

export http_proxy="http://yourproxy:yourport"

Then start the program, e.g. Synaptic for package management. The console might give you helpful output on what goes wrong.

share|improve this answer
1  
To set the environment variable for one command only, you can also use: http_proxy="http://yourproxy:yourport" synaptic –  phq Mar 9 '11 at 7:45
add comment

I'm using a proxy also, and I had to set the proxy settings specifically for Synergy and update manager (using Synergy: Configuration->Preferences->Network). There's no option there to use the "system settings", and even if it should work, changing the proxy server at the system level never made me able to update :-(

I'm interested in a solution that make it work though :-)

share|improve this answer
add comment

Click on "Apply System-Wide..." and check that all your internet applications are set to use the system proxy. There's nothing more to it than this. There's no need to tamper with configuration files and start-up scripts.

share|improve this answer
add comment

anyone thought to check/add settings to:

/etc/environment

try it with:

http_proxy="http://user:password@proxyserver:port" https_proxy="http://user:password@proxyserver:port" ftp_proxy="http://user:password@proxyserver:port"

share|improve this answer
add comment

Applying system-wide is not enough ! I think maybe ISA Server or maybe synaptic reset connection for each query to the web this issue that login and password authentication lie down. Or maybe ISA Server do not accept to transmit query that do not answer on HTTP protocol, but It's not my favorite.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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