Tuesday, 30 April 2013

How to: Setup Proxy for Linux

When working inside an enterprise network, there could be a necessity to setup the network proxy in order to connect to internet. While Linux proxy does not really share the same proxy settings as windows, the other approach has to be performed.

The following does work for me according to a Linux guru and some quick search:

1. Install cntlm

sudo apt-get install cntlm
since the internet cannot be established, the better way is to download it from some machine which does have internet connection and install it remotely.

2. Configure cntlm

sudo nano /etc/cntlm.conf
drop in the valid proxy settings and login credentials for the network, including username, domain and password.

3. Setup network proxy

Open System Settings > Network > Network Proxy
Set all proxy settings to use 'localhost' with port number '3128'

Alternatively, try adding the following lines to /etc/bash.bashrc or ~/.bashrc

sudo nano <unc>

export http_proxy=http://localhost:3128/
export https_proxy=http://localhost:3128/
export ftp_proxy=http://localhost:3128/

4. The internet should work after those steps and a relogin, if not instantly

NOTE:

According to the guru, the Linux network connection settings actually consist of many parts, including Web Apps, Console Apps and etc (if he's right, and I understood him correctly). The terminal, which is a console app and also a terminal, would not be able to connect to the internet until the proxy is set for it.

Therefore, open /etc/apt/apt.conf and/or /etc/apt/apt.conf.d/02proxy, and type in the following magic spells, which establishes network proxy for terminal:

sudo nano <unc>

Acquire::http::proxy "http://localhost:3128/"

Hola!

Reference:

http://askubuntu.com/questions/6340/cannot-connect-to-internet-from-terminal-and-other-programs-authentincation-inv
http://askubuntu.com/questions/158557/setting-proxy-from-terminal

No comments:

Post a Comment