Bonanza
Email
Enterprise Service
menu
Email
Enterprise Service
Submit
Basic information
Waiting for a reply
Your form has been submitted. We'll contact you in 24 hours.
Close
Home/ Blog/ How to Configure System-Wide Proxy Settings in Ubuntu

How to Configure System-Wide Proxy Settings in Ubuntu

Author:PYPROXY
2024-09-05 15:47:24

How to Configure System-Wide Proxy Settings in Ubuntu


In today’s digital age, maintaining privacy and security while browsing the internet is crucial. One effective way to enhance your online security is by using a proxy server. Configuring system-wide proxy settings in Ubuntu allows all applications to route their traffic through the proxy server, ensuring that your browsing activities remain private and secure. This article will guide you through the steps to set up a system-level proxy in Ubuntu, covering both graphical and command-line methods.


Understanding Proxies

Before diving into the setup process, it’s essential to understand what a proxy server is and how it functions. A proxy server acts as an intermediary between your device and the internet. When you use a proxy, your requests to websites are routed through the proxy server, which can provide several benefits:

1. Anonymity: By masking your IP address, proxies help keep your online activities private.

2. Access Control: Proxies can restrict access to certain websites, making them useful for organizations or schools.

3. Bypassing Geo-Restrictions: Proxies allow you to access content that may be restricted in your region.

4. Improved Security: Some proxies can encrypt your data, adding an extra layer of security.


Prerequisites

Before setting up a proxy on Ubuntu, ensure you have the following:

- Proxy Server Details: You need the IP address and port number of the proxy server you intend to use. If authentication is required, have your username and password ready.

- Ubuntu System: This guide is applicable for Ubuntu Desktop versions, including 20.04 LTS and later.


Method 1: Configuring Proxy Settings via GUI

Step 1: Open System Settings

1. Access System Settings: Click on the system menu in the top-right corner of your screen (the gear icon) and select “Settings.”

Step 2: Navigate to Network Settings

2. Select Network: In the Settings window, click on the “Network” tab on the left sidebar.

Step 3: Configure Proxy Settings

3. Open Proxy Settings: Scroll down to the “Network Proxy” section and click on it.

4. Select Manual Configuration: In the Proxy settings window, select the “Manual” option. This will allow you to enter the proxy details manually.

5. Enter Proxy Information:

- HTTP Proxy: Enter the IP address and port number of your HTTP proxy.

- HTTPS Proxy: If you have a separate HTTPS proxy, enter its details as well.

- FTP Proxy: Similarly, enter the FTP proxy information if applicable.

- SOCKS Proxy: If you use a SOCKS proxy, fill in this information too.

6. Apply to All Applications: Check the option “Apply system wide” to ensure that the proxy settings are applied to all applications that respect the system’s proxy settings.

7. Save Settings: Click the “Apply” button to save your changes.

Step 4: Test Your Proxy Configuration

1. Open a Web Browser: Launch Firefox or any other web browser.

2. Check Your IP Address: Visit a website like [WhatIsMyIP.com](https://www.whatismyip.com) to verify that your IP address reflects the proxy server’s location. This confirms that your proxy is working correctly.


Method 2: Configuring Proxy Settings via Command Line

For users who prefer the command line, Ubuntu provides a straightforward way to configure proxy settings.

Step 1: Open Terminal

1. Launch Terminal: Press `Ctrl + Alt + T` to open the terminal window.

Step 2: Set Environment Variables

2. Edit Environment Variables: You can set the proxy by exporting environment variables. Use the following commands, replacing `proxy_ip` and `port` with your proxy server's IP address and port number:

```bash

export http_proxy="http://proxy_ip:port/"

export https_proxy="http://proxy_ip:port/"

export ftp_proxy="http://proxy_ip:port/"

export socks_proxy="socks://proxy_ip:port/"

```

3. Add Authentication (if required): If your proxy requires authentication, include your username and password in the URL:

```bash

export http_proxy="http://username:password@proxy_ip:port/"

export https_proxy="http://username:password@proxy_ip:port/"

```

Step 3: Make Proxy Settings Persistent

To ensure that the proxy settings persist across reboots, you can add the export commands to your `~/.bashrc` or `~/.bash_profile` file.

1. Open the File: Use a text editor to open the `.bashrc` file:

```bash

nano ~/.bashrc

```

2. Add Export Commands: Scroll to the bottom of the file and add the export commands you used earlier.

3. Save and Exit: Press `Ctrl + O` to save the file, then `Ctrl + X` to exit.

4. Apply Changes: Run the following command to apply the changes:

```bash

source ~/.bashrc

```

Step 4: Test Your Proxy Configuration

1. Check IP Address: Just like in the GUI method, open a web browser and visit [WhatIsMyIP.com](https://www.whatismyip.com) to confirm that your IP address reflects the proxy server’s location.


Method 3: Configuring Proxy for APT Package Manager

If you want to use the proxy for package management as well, you need to configure it for APT.

Step 1: Create or Edit APT Configuration File

1. Open Terminal: Press `Ctrl + Alt + T` to open the terminal.

2. Edit the APT Configuration: Open or create the file `/etc/apt/apt.conf.d/99proxy`:

```bash

sudo nano /etc/apt/apt.conf.d/99proxy

```

Step 2: Add Proxy Details

3. Add the Following Lines: Replace `proxy_ip` and `port` with your proxy details:

```bash

Acquire::http::Proxy "http://proxy_ip:port/";

Acquire::https::Proxy "http://proxy_ip:port/";

Acquire::ftp::Proxy "http://proxy_ip:port/";

```

4. Save and Exit: Press `Ctrl + O` to save the file, then `Ctrl + X` to exit.

Step 3: Update Package List

5. Update APT: Run the following command to check if the proxy is working correctly with APT:

```bash

sudo apt update

```


Troubleshooting Common Issues

1. Proxy Not Connecting

If you are having trouble connecting to the internet after setting up the proxy:

- Check Proxy Settings: Ensure that the IP address and port number are entered correctly.

- Test Proxy Server: Use a different device or tool to verify that the proxy server is operational.

- Firewall/Antivirus: Sometimes, firewall or antivirus software may block your proxy connection. Temporarily disable them to see if that resolves the issue.

2. Slow Browsing Speed

If your browsing speed is slow while using the proxy:

- Choose a Different Proxy: Some proxies may be slower than others. Try switching to a different server.

- Check Network Connection: Ensure that your internet connection is stable and fast.

3. Authentication Issues

If you encounter authentication issues:

- Verify Credentials: Double-check your username and password for the proxy service.

- Contact Proxy Provider: If you continue to have issues, reach out to your proxy service provider for assistance.


Best Practices for Using Proxies

1. Choose a Reliable Proxy Provider: Use reputable proxy services that prioritize privacy and security.

2. Regularly Update Your Proxy Settings: If your proxy provider changes their server IPs or ports, make sure to update your settings accordingly.

3. Monitor Your Connection: Keep an eye on your connection status and performance. If you notice any issues, investigate promptly.

4. Use HTTPS Proxies: Whenever possible, choose HTTPS proxies for added security, especially when dealing with sensitive information.

5. Clear Browser Cache: Regularly clear your browser cache to avoid any issues related to loading outdated information.


Conclusion

Configuring system-wide proxy settings in Ubuntu is a straightforward process that can significantly enhance your online privacy and security. Whether you choose to use the graphical interface or the command line, the steps outlined in this guide will help you set up and manage your proxy connections effectively. By following best practices, you can maintain a secure and efficient network connection, ensuring a safer browsing experience.