How to Configure Proxy Settings on Ubuntu 20.04?

Proxy servers are intermediary servers that act as a gateway between a user's device and the internet. When connected through a proxy server, all data requests are first sent to the proxy server which then forwards them to the internet. This setup provides enhanced security, privacy, and network control for organizations and individuals.

There are several types of proxies including HTTP proxies, HTTPS proxies, and SOCKS proxies. Each type serves different purposes with varying degrees of security and functionality.

Understanding Proxy Settings on Ubuntu 20.04

Ubuntu 20.04 provides multiple methods to configure proxy settings, allowing you to route your network traffic through intermediary servers. Understanding how proxies work is vital for proper configuration and troubleshooting.

Proxy Server Architecture Client (Ubuntu 20.04) Proxy Server Internet Resources Request Forward Response Relay

Types of Proxies

Proxy Type Protocol Security Level Use Cases
HTTP HTTP Basic Web browsing, content filtering
HTTPS HTTPS/SSL High Secure web traffic, encrypted data
SOCKS TCP/UDP Medium Any traffic type, P2P, torrenting

Configuring Proxy Settings via Terminal

The terminal method provides system-wide proxy configuration using environment variables.

Setting HTTP and HTTPS Proxies

Configure temporary proxy settings for the current session:

export http_proxy=http://proxy-server:port
export https_proxy=https://proxy-server:port
export ftp_proxy=http://proxy-server:port

For persistent configuration, edit the /etc/environment file:

sudo nano /etc/environment

Add the following lines:

http_proxy="http://proxy-server:port"
https_proxy="https://proxy-server:port"
ftp_proxy="http://proxy-server:port"
no_proxy="localhost,127.0.0.1,::1"

Proxy with Authentication

For proxies requiring username and password:

export http_proxy=http://username:password@proxy-server:port
export https_proxy=https://username:password@proxy-server:port

Configuring Proxy Settings via GUI

Ubuntu 20.04's GNOME desktop provides a user-friendly interface for proxy configuration.

Step 1: Open Settings ? Network ? Network Proxy

Step 2: Select "Manual" configuration method

Step 3: Enter proxy server details (IP address and port)

Step 4: Click "Apply system-wide" to save settings

Application-Specific Proxy Configuration

APT Package Manager

Configure APT to use proxy for package downloads:

sudo nano /etc/apt/apt.conf.d/95proxies

Add the configuration:

Acquire::http::Proxy "http://proxy-server:port";
Acquire::https::Proxy "https://proxy-server:port";

Web Browsers

Most browsers inherit system proxy settings, but you can configure them individually through their network settings if needed.

Troubleshooting Common Issues

Authentication Errors

When proxy servers require authentication, ensure credentials are properly encoded in the proxy URL. Special characters in passwords should be URL-encoded.

Firewall Configuration

Allow outbound connections through proxy ports:

sudo ufw allow out 8080/tcp    # Common proxy port
sudo ufw allow out 3128/tcp    # Squid proxy default

Testing Proxy Configuration

Verify your proxy setup using curl:

curl -I http://www.google.com

Check current proxy environment variables:

env | grep -i proxy

Conclusion

Configuring proxy settings on Ubuntu 20.04 can be accomplished through multiple methods including terminal commands and GUI settings. Proper configuration involves understanding proxy types, setting appropriate environment variables, and troubleshooting common authentication and firewall issues to ensure reliable network connectivity.

Updated on: 2026-03-17T09:01:38+05:30

12K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements