HowTo : Use system-wide proxy in linux and set up a local proxy server

1 minute read

Let’s say you have a board (beaglebone, raspberry pi, etc) and you want to connect internet by using a proxy server. Your work network may not allow this little guy or you may be in a closed-network with one gateway – proxy.

Use system-wide proxy

First, let’s see how to configure system-wide proxy in linux. Most programs honor http_proxy environmental variable. Let’s add them permanently in the system.

Open the file /etc/environment

Add the following lines, update as necessary.


Great! However, you will notice, apt-get  will not work. You need to change one more file for that.

Open the file /etc/apt/apt.conf. Add following lines, update as necessary.

Acquire::http::Proxy "";
Acquire::https::Proxy "";
Acquire::ftp::Proxy "";

 Set up local proxy server

cntlm is a great proxy server written in C. Install it to your machine.

  • Configure cntlm.ini file that fits to your network configuration (Domain, Username, Password tag).
  • Specify any proxy that you have in your nework. (Proxy tag).
  • Give a proxy port (Listen tag).
  • Give permission to a certain address range (Allow tag). You can use CIDR notation. (i.e.

Cntlm should register itself as a service. You can run it explicitly by calling Start Cntlm Authentication Proxy.

Voila, your proxy server should be running now.