23

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?

9 Answers 9

15

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:[email protected]:8080) or you can use something like ntlmaps for better control.

More info could be found here.

4
  • 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.
    – Alexar
    Sep 12, 2010 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, 2010 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, 2010 at 18:38
  • You saved my life bro, big heat for you.
    – ako
    Oct 28, 2023 at 20:42
6

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

1
  • yes, i've done that.
    – Alexar
    Sep 8, 2010 at 6:37
6

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".

4

If you try:

curl http://www.google.com

from the command line, then if you get HTML back the proxy is working.

2

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.

1
  • 2
    To set the environment variable for one command only, you can also use: http_proxy="http://yourproxy:yourport" synaptic
    – hultqvist
    Mar 9, 2011 at 7:45
1

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 :-)

1

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"

0

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.

-1

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.

You must log in to answer this question.

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