How to check if Network Proxy is really applied?

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?


Solution 1:

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.

Solution 2:

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