Set a System Proxy on Ubuntu: Quick Steps

Setting a system proxy on Ubuntu allows you to route all your internet traffic through a proxy server. This is useful for various reasons, including enhanced privacy, accessing geo-restricted content, or bypassing network restrictions. This guide provides quick and practical steps to configure a system-wide proxy on Ubuntu.

Try Proxies: Free Trial →

Understanding Proxy Types

Before configuring, understand the proxy types. Common types include HTTP, HTTPS, SOCKS4, and SOCKS5. Your proxy provider will specify the type you should use.

HTTP proxies handle HTTP traffic, while HTTPS proxies handle secure HTTP traffic. SOCKS proxies are more versatile and can handle various types of traffic.

SOCKS5 proxies often provide better security and support authentication.

Graphical Interface Method

The easiest way to set a system proxy is through Ubuntu's graphical interface. This method is suitable for most users.

Open 'Settings', then navigate to 'Network'. Look for 'Network Proxy' or a similar option. Select 'Manual' under proxy settings.

Enter the proxy server's address, port, and authentication details (if required). Apply the changes system-wide.

Command-Line Method

For advanced users, configuring the proxy via the command line offers more control. This method involves setting environment variables.

Edit your `.bashrc` or `.profile` file to include the proxy settings. This ensures the proxy is set every time you open a new terminal.

After editing the file, source it to apply the changes immediately: `source ~/.bashrc`.

Environment Variables Configuration

  • `http_proxy`: Sets the proxy for HTTP traffic.
  • `https_proxy`: Sets the proxy for HTTPS traffic.
  • `ftp_proxy`: Sets the proxy for FTP traffic (less common).
  • `no_proxy`: Specifies domains or IP addresses that should bypass the proxy.

Verification and Troubleshooting

  • Verify the proxy is working by visiting a website that displays your IP address. Check if the displayed IP matches the proxy's IP.
  • Ensure DNS resolution is handled correctly by the proxy. If not, configure DNS settings manually.
  • If you encounter issues, double-check the proxy address, port, and authentication details. Also, verify that the proxy server is online and accessible.

export http_proxy="http://your_proxy_address:your_proxy_port"
export https_proxy="http://your_proxy_address:your_proxy_port"
export no_proxy="localhost,127.0.0.1,::1"

sudo apt update
sudo apt install curl
curl -s https://api.ipify.org

Examples

  • Settings > Network > Network Proxy > Manual
  • http_proxy=http://192.168.1.100:3128
  • no_proxy=localhost,127.0.0.1
  • curl -x http://your_proxy_address:your_proxy_port https://api.ipify.org

Tips

  • Always use HTTPS proxies for sensitive data.
  • Test your proxy connection after setup.
  • Set 'no_proxy' for local addresses.
  • Consider using a proxy manager for easier switching.

Try Proxies: Free Trial →

FAQ

Q: How do I disable the proxy?

A: In the GUI, set the proxy to 'None' or 'Off'. In the command line, unset the environment variables: `unset http_proxy https_proxy ftp_proxy`.

Q: What if I need authentication for the proxy?

A: Include the username and password in the proxy URL: `http_proxy=http://username:password@your_proxy_address:your_proxy_port`.

Q: Why is my internet slow after setting the proxy?

A: The proxy server might be overloaded or located far from you. Try a different proxy server or check your internet connection.

This document may contain affiliate links. Information in this document may be outdated or incorrect.