Configuring a proxy on windows and linux

I have a daily battle with a proxy. Each day I think, “today this proxy will be tamed”. Only to have the proxy stop working and I have to start figuring it out from scratch.

Below is what I go through each time I experience problems with proxy connection.

Connecting to a proxy via command line:

Windows

Configure your windows environment to work through a proxy

Environment variables

One way is to update your environment variables.

Open a command console, and in it add these two settings:

set http_proxy=”http://proxyUsername:proxyPassword@proxyUrl:port”
set https_proxy=”’http://proxyUsername:proxyPassword@proxyUrl:port”

View environment variables

To view your system settings enter in your command console:

set

Using “set” is more like a “cache” setting, it will go away when you close the command console, or restart your computer. To set it permanently, either manually add it to your environment variables. Or use setx.

setx /M http_proxy “http://proxyUsername:proxyPassword@proxyUrl:port”
setx /M https_proxy “http://proxyUsername:proxyPassword@proxyUrl:port”

A note on the value ”http://proxyUsername:proxyPassword@proxyUrl:port”

This format can be:

  • ”http://proxyUsername:proxyPassword@proxyUrl:port”
  • ”http://proxyUrl:port”

Another note: ping will not work with a proxy. (Well for now I haven’t found a way for it to work yet.) From the research I have done to date, ping works at a different level to the proxy. So just a head’s up, if you use ping to test if your proxy settings now allow internet access, you will be going in circles.

What should work is if you use a tool like vagrant for example and you need to download a box.

If this doesn’t work, and you use a tool that needs internet acces through the command line and it still cannot connect to the internet. Make double-triple sure your proxy details are 100% correct. Make sure you are connected to the internet.

And try the below:

LAN Settings

Setting the proxy on the lan settings. I have found two ways of setting this, one way is through a web browser like Chrome. And the other is through the control panel.

Using chrome

Go to Settings.
Show advanced settings.
In the Network section click “Change proxy settings”.
In the window that opens up click on “LAN settings”.
Select “Use a proxy server for your LAN…”
Add the proxy address, add the proxy port.

Additional notes on using windows for proxy

  • Often something doesn’t work because you need to open a new console window for to take effect (eg changing environment variables).
  • Often something doesn’t work because you nee the entire system to be restarted (this is always my last go to, if all else fails, restart).

Proxy is still not working on windows

If you have done all of the above and you still do not have internet acces through the proxy, you need to check if your proxy itself is not blocking the access.

Setting up proxy details on Linux

This is still a work in progress, below is what I’ve figured out so far:
To set the system variables on linux:

export http_proxy=”http://proxyUsername:proxyPassword@proxyUrl:port”
export https_proxy=”http://proxyUsername:proxyPassword@proxyUrl:port”