Seyare Seyare

INTEGRATIONS

Proxy for Ubuntu: HTTP & SOCKS5 Guide

Learn how to configure HTTP and SOCKS5 proxies in Ubuntu using CLI, Squid, SSH, and proxychains with step-by-step instructions.

Marketing Team · · 6 min read

Proxy in Ubuntu: HTTP and SOCKS5 Methods Explained

In Ubuntu, working with proxies is not just about “turning something on in settings”. It’s more like adjusting the path your internet traffic takes — and that path can change a lot depending on what tool you use.

In this guide we’ll go step by step through HTTP and SOCKS5 proxy setup. But more importantly, we’ll also explain why each step exists. Because just copying commands without understanding them tends to break things later — and honestly, it becomes confusing very quickly.

Let’s go.

What is a proxy in Ubuntu?

A proxy in Ubuntu is an intermediary server between your device and the internet.

So instead of this:

Your PC → Website

you get this:

Your PC → Proxy server → Website

That middle step is the key. It’s not just “extra routing” — it can:

  • hide your real IP address
  • filter or control traffic
  • bypass restrictions based on region or network rules

At first glance it might look like just an extra hop. But that “hop” is actually where all control happens.

And yes, sometimes it also slightly affects speed — depending on the server quality.

Forward vs Reverse proxy in Ubuntu

This part confuses many beginners, so it’s worth slowing down a bit here.

A forward proxy is what you, as a user, connect to. It handles outgoing requests from your system and sends them to the internet. Think of it like a “middleman” acting on your behalf.

Why it matters: this is exactly what we configure in Ubuntu when using proxy credentials from a provider.

A reverse proxy, on the other hand, works for servers. It sits in front of websites or applications and distributes incoming traffic. For example, it can split load between multiple backend servers.

So:

  • forward proxy = for users
  • reverse proxy = for servers

We only deal with forward proxies here.

HTTP vs SOCKS5 proxy — what’s the real difference?

This is where things become practical.

HTTP proxy

An HTTP proxy is designed specifically for web traffic. That means:

  • browsing websites
  • working with APIs
  • scraping data

It understands HTTP and HTTPS protocols only.

So if you try to use it for something outside that scope, it simply won’t work.

SOCKS5 proxy

SOCKS5 is more general. It doesn’t care what kind of traffic you send:

  • browsers
  • games
  • apps
  • torrents

It just forwards packets.

That flexibility is the reason people often prefer SOCKS5 — but it requires slightly more setup.

Simple comparison

FeatureHTTP ProxySOCKS5 Proxy
Type of trafficWeb onlyAlmost all traffic
Setup complexityEasyMedium
FlexibilityLowHigh
Use caseBrowsing, APIsGaming, apps, general use

Prerequisites (and why they matter)

Before configuring anything, Ubuntu must be ready.

Check:

  • system is running
  • terminal is accessible
  • internet connection works

Update system packages:

sudo apt update
sudo apt upgrade

Why do this?
Because outdated packages can cause weird networking issues — not always obvious, but very common.

Test connectivity:

ping google.com

This simply checks: can your system actually reach the internet before we add proxy complexity?

You also need proxy credentials:

  • host (server address)
  • port (connection entry point)
  • username
  • password

These are not optional. They define how authentication works.

HTTP proxy setup in Ubuntu

We’ll start with the simplest method first — CLI environment variables.

Why environment variables?

Ubuntu uses environment variables to define system-wide behavior for applications. In this case, we tell programs:

“Hey, don’t go directly to the internet — go through this proxy instead.”

Step 1: Temporary setup

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

What is happening here?

We are temporarily telling the system:

  • use this proxy for HTTP traffic
  • use this proxy for HTTPS traffic

Important detail:
The username:password@ part is authentication. Without it, many proxies will simply reject the connection.

Step 2: Why it resets after reboot

These exports only live in the current terminal session. Once you close it, they disappear.

So we make it permanent.

Step 3: Permanent configuration

nano ~/.bashrc

This file runs every time a terminal starts.

Add:

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

Then apply changes:

source ~/.bashrc

Now every terminal session automatically uses the proxy.

Testing HTTP proxy

We need a way to verify traffic routing.

curl ifconfig.me

What does this do?

It asks a service: what is my public IP address?

If proxy works — you’ll see proxy IP instead of your real one.

Disabling proxy (important)

Sometimes you need to return to normal connection.

unset http_proxy
unset https_proxy

Why is this needed?
Because leaving proxy variables active can break package installs or local services later.

Squid proxy (advanced HTTP control)

Now we move into a more “server-like” setup.

What is Squid?

Squid is a proxy server that runs locally or on a server. It can:

  • cache traffic (speed up repeated requests)
  • control access
  • log requests

So it’s not just a proxy — it’s a full traffic manager.

Installation

sudo apt install squid

Configuration file

sudo nano /etc/squid/squid.conf

Here we define how Squid behaves.

Example:

http_port 3128

This means Squid listens on port 3128.

Why this matters

Port = entry point.
Without it, nothing can connect to Squid.

Allowing access (for testing only)

acl all src 0.0.0.0/0
http_access allow all

This literally means: allow all connections.

Important note — this is only for testing. In real setups, you restrict it.

Start service

sudo systemctl start squid
sudo systemctl enable squid

Why two commands?

  • start → run now
  • enable → run automatically after reboot

Test Squid

curl -x http://localhost:3128 http://ifconfig.me

If IP changes → Squid works.

SOCKS5 proxy in Ubuntu

Now things change slightly.

Ubuntu does NOT support SOCKS5 through simple environment variables.

So we need tools.

Method 1: SSH SOCKS5 tunnel

ssh -D 1080 user@remote-server-ip

What is happening here?

We are creating a tunnel:

  • -D 1080 → opens local SOCKS5 port
  • traffic is routed through remote server

So your system behaves like it has a SOCKS5 proxy locally.

Test:

curl --socks5 localhost:1080 ifconfig.me

Method 2: proxychains

This tool forces apps to use proxy even if they don’t support it.

Install

sudo apt install proxychains

Configuration

sudo nano /etc/proxychains.conf

Add:

socks5 username password proxy-server port

Why this is useful

Some applications ignore system proxy settings completely. proxychains “wraps” them and forces traffic through proxy.

Example:

proxychains firefox

SOCKS5 server (Dante)

If you need to host SOCKS5 yourself:

sudo apt install dante-server

Dante is a dedicated SOCKS5 server.

Configuration defines:

  • internal interface (your server)
  • external interface (internet)
  • authentication method

Why it matters? Because SOCKS5 is not just “a setting” — it’s a full network service.

Wrapping up

Proxy setup in Ubuntu is not hard — but it becomes meaningful only when you understand what each layer does.

  • HTTP proxy → simple web routing
  • SOCKS5 proxy → flexible full traffic routing
  • Squid → advanced control system
  • SSH tunnel → quick SOCKS5 creation

And the most important habit?

Always verify traffic:

curl ifconfig.me

Because what you think is happening… and what is actually happening on the network, are not always the same thing.

Ready to test with real IPs?

Register now to get immediate access to our proxy pools.