How to Configure Proxy Settings on Ubuntu 20.04?


Introduction

Proxy servers are intermediary servers that act as a gateway between a user's device and the internet. When connected to the internet through a proxy server, all data requests from the user's device are first sent to the proxy server which then forwards them to the internet. Similarly, when data is received from the internet, it first goes through the proxy server before reaching the user's device.

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

Understanding Proxy Settings on Ubuntu 20.04

A proxy server acts as an intermediary between your computer and the Internet. It receives requests from your computer on your behalf and forwards them to the Internet.

Likewise, when the Internet responds with data, it first goes to the proxy server before being sent back to your computer. Understanding how proxies work is vital in configuring proxy settings on Ubuntu 20.04.

Types of Proxies

There are different types of proxies, each designed for specific purposes. The most common types of proxies include:

HTTP Proxy

The HTTP proxy is the most common type of proxy server. It is used to handle web traffic and can be utilized by both web browsers and command-line tools like wget or curl. HTTP proxies are also ideal for blocking access to certain websites or filtering content based on keywords or categories.

HTTPS Proxy

An HTTPS proxy is similar to an HTTP proxy, but it encrypts traffic that passes through it using SSL/TLS encryption protocol. This means that data passing through an HTTPS proxy cannot be read by anyone who intercepts it between your computer and the Internet.

SOCKS Proxy

A SOCKS (Socket Secure) proxy operates at a lower level than HTTP/HTTPS proxies, meaning that they can handle any type of traffic, not just web traffic. SOCKS proxies are commonly used for torrenting or other peer-to-peer (P2P) applications.

Configuring Proxy Settings on Ubuntu 20.04

Using the Terminal to Configure Proxy Settings

One way to configure proxy settings on Ubuntu 20.04 is using the terminal. This method involves setting up HTTP, HTTPS, and SOCKS proxy servers. To set up an HTTP proxy server, you need to open the terminal and enter the command "export http_proxy=http://proxy-server-ip:port" (replace "proxy-server-ip" with the IP address of your proxy server and "port" with its port number).

Similarly, for setting up an HTTPS proxy server, you need to enter the command "export https_proxy=https://proxy-server-ip:port". To configure a SOCKS proxy server, you need to install a package called "dante-client" using the following command: "sudo apt-get install dante-client".

Then create a configuration file by entering this command: "sudo nano /etc/danted.conf". Add your SOCKS5 server details in this file.

Setting Up HTTP and HTTPS Proxy Servers

HTTP proxies are commonly used for web browsing while HTTPS proxies are more secure than HTTP because they use SSL/TLS encryption. You can set up both types of proxies in Ubuntu 20.04 by opening System Settings from the top-right corner of your screen and selecting Network from there.

Then click on Network Proxy and select Manual under Method. Enter your proxy details such as IP address and port number in the relevant fields.

Setting Up SOCKS Proxy Server

SOCKS is a protocol that allows computers to communicate using TCP/IP via an intermediary relay named a SOCKS server. To set up a SOCKS proxy server on Ubuntu 20.04 using GUI, open Network Settings as described above but select “SOCKS” instead of “Manual”. Enter your desired configuration details in the relevant fields.

Using the GUI to Configure Proxy Settings

In addition to using the terminal, you can also configure proxy settings on Ubuntu 20.04 using the Graphical User Interface (GUI). The GNOME Control Center provides a simple way to configure network settings, including proxy settings.

To do this, open up the Control Center from the top-right corner of your screen and select Network. From there, click on Network Proxy and select Manual under Method, then enter your desired configuration details in the relevant fields.

Troubleshooting Common Issues with Proxy Settings on Ubuntu 20,04

Proxy Authentication Errors and How to Fix Them

One of the most common issues that users face when configuring proxy settings on Ubuntu 20.04 is authentication errors. This occurs when the proxy server requires a username and password for authentication, but the user fails to provide it during configuration. To fix this issue, you need to update your proxy configuration by including your username and password in the appropriate fields.

You can do this either through the terminal or via GUI. In the terminal, you can edit the /etc/environment file using any text editor such as nano or vim−

sudo nano /etc/environment  

You will see a line “http_proxy=…”.

Add your credentials after this line in this format: "http://username:password@proxyserver:port". Ensure to replace "username" with your actual username and "password" with your actual password.

For GUI-based configuration, navigate to Settings > Network > Network Proxy and click on Manual Configuration. Enter your details in the appropriate fields and click Apply System-Wide.

Firewall Issues and How to Resolve Them

Another common issue that users encounter when configuring proxies on Ubuntu 20.04 is firewall errors. This happens when there is a firewall blocking outbound connections from your system. To resolve firewall issues, you need to configure a rule that allows outgoing connections through port 80 or port 443 depending on whether you're using an HTTP or HTTPS proxy respectively.

For example, if you are using an HTTP proxy, execute this command to allow outbound traffic through port 80−

sudo ufw allow out 80/tcp  

Similarly, if you are using an HTTPS proxy server, execute this command instead:

sudo ufw allow out 443/tcp  

If you're using a SOCKS proxy, you need to allow outgoing connections through the port specified in your configuration. Once you've allowed outgoing connections through the appropriate port, you should be able to connect to your proxy server without any firewall issues.

It is important to note that configuring proxy settings on Ubuntu 20.04 can be a bit challenging, especially for users who are new to Linux systems. However, with this comprehensive guide, you should be able to navigate through most of the common issues that arise during configuration and get your system up and running in no time.

Conclusion

Configuring proxy settings on Ubuntu 20.04 involves understanding the types of proxies available, using either the command line or graphical user interface to configure them, and troubleshooting common issues that may arise during the process. HTTP, HTTPS, and SOCKS proxies are the most commonly used types on Ubuntu 20.04 and can be set up using various methods depending on your preferences.

Once you have configured your proxy settings on Ubuntu 20.04, it's important to test your configurations to ensure they are working correctly. This includes checking that you can access websites and services through your proxy servers and verifying that any authentication or firewall issues have been resolved. Testing also allows you to identify any potential performance issues that may result from using a proxy server.

Updated on: 11-Jul-2023

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements