Free test available for France , UK or SG on Telegram Join Telegram
Linux Configuration

Mobile Proxy Configuration on Linux

On Linux every tool manages its own proxy configuration, so there is no single place to set one. This guide covers environment variables and how far they reach, the desktop setting and what it misses, and the tools that insist on their own file.

PXM2 Proxies August 24, 2026 8 min read
3 Variables that matter
Ubuntu · Debian Distributions covered
HTTP · SOCKS5 Protocol support
5+ Countries available
  • Environment variables reach most tools — curl, wget, git, pip and npm all read http_proxy and https_proxy.
  • sudo throws them away — an elevated command loses your proxy unless you pass it through deliberately.
  • apt ignores them by design — the package manager wants its own configuration file rather than your shell environment.
  • The desktop setting is not system-wide — it reaches GNOME applications, and your terminal is not one of them.
4G / 5G Mobile Proxies Standard Protocols
Protocol supportHTTP(S), SOCKS5
Session typeSticky or rotating
BandwidthUnlimited
HardwareDedicated 4G/5G modem
Server Friendly

Whitelist a static server address and skip credentials entirely.

Scriptable

Four exports in a profile configure most of the userland.

Environment Variables, and How Far They Reach

Linux has no system proxy setting in the sense the other operating systems mean it. What it has instead is a convention: most software reads the http_proxy and https_proxy environment variables, and respects no_proxy for the hosts that should bypass them. That convention covers a great deal — curl, wget, git, pip, npm, most language runtimes — but it is a convention rather than a rule, and the exceptions are what this guide is really about.

Add to ~/.bashrc or ~/.zshrc
export http_proxy="http://user123:[email protected]:8000"
export https_proxy="$http_proxy"
export no_proxy="localhost,127.0.0.1,::1,.internal.example.com,10.0.0.0/8"

# Some tools read only the upper-case names
export HTTP_PROXY="$http_proxy"
export NO_PROXY="$no_proxy"
Illustrative endpoint and credentials

Set no_proxy deliberately rather than leaving it empty. Without it, requests to localhost and to internal hostnames are sent to the proxy, which cannot reach them — so a database connection or a health check that worked five minutes ago starts timing out for reasons that look nothing like a proxy problem. Comma-separated, no spaces, and a leading dot matches subdomains.

Note that https_proxy takes an http:// scheme. The scheme says how to reach the proxy, not what protocol the target speaks; the client opens a tunnel and TLS runs end to end inside it. For SOCKS5, prefer the socks5h form, whose trailing h sends DNS resolution through the proxy as well — without it your machine resolves every hostname locally and leaks the entire list of domains you visit to your own network.

Layer What reads it What it misses
Environment variables curl, wget, git, pip, npm, most runtimes Anything run through sudo, apt, and services started by systemd
Desktop proxy setting GNOME Web and applications that read desktop configuration Your terminal, and everything launched from it
Per-tool configuration apt, Docker, snap, git — each with its own file Nothing, but you must write one per tool
proxychains Any program, by intercepting its network calls Statically linked binaries, and anything that avoids libc networking

The Desktop Proxy Setting and What It Covers

GNOME, KDE and the other desktop environments all offer a network proxy setting, and it looks like the system-wide control that Linux otherwise lacks. It is not. It writes a desktop configuration key, and only applications that deliberately read that key are affected — GNOME Web and a handful of GNOME applications, in practice.

Your terminal does not read it. Neither does anything you launch from your terminal. Setting the desktop proxy and then wondering why curl returns your real address is probably the single most common Linux proxy mistake, and it is entirely reasonable to make: nothing in the interface suggests how narrow its scope is.

Treat the desktop setting as a per-application setting that happens to live in the system menu. If you want the whole userland proxied, environment variables in your shell profile are the mechanism — and even those stop at the boundary of sudo.

apt, sudo and the Tools That Need Their Own File

Two things reliably break a working Linux proxy setup, and both are about the environment not surviving a boundary.

The first is sudo. For security reasons sudo strips most environment variables before running the command, so your carefully exported proxy simply is not there any more. A one-off can be fixed by asking sudo to preserve the environment; a permanent fix means adding the proxy variables to the env_keep list in the sudoers file, which should be edited with visudo rather than directly.

The second is apt, which ignores the environment by design and wants its own configuration. Passing variables through sudo every time works, but a configuration file is more reliable because it applies no matter who runs the command or how.

Per-tool configuration that survives sudo
# apt -- write /etc/apt/apt.conf.d/95proxies
Acquire::http::Proxy "http://user123:[email protected]:8000";
Acquire::https::Proxy "http://user123:[email protected]:8000";

# sudo -- preserve the environment for one command
sudo -E some-command

# sudo -- permanently, via `sudo visudo`
Defaults env_keep += "http_proxy https_proxy no_proxy HTTP_PROXY HTTPS_PROXY NO_PROXY"

# git, which keeps its own config
git config --global http.proxy "http://user123:[email protected]:8000"
Illustrative endpoint and credentials

Docker deserves a mention of its own, because it has two separate problems wearing the same name. The daemon needs a proxy to pull images, configured in a systemd drop-in; containers need one passed in as build arguments or environment variables. Configuring one does nothing for the other, which produces the familiar situation where images pull fine and the application inside cannot reach anything.

For software that supports no proxy at all — some older network utilities, a few closed-source tools — proxychains is the standard answer. It preloads a library that intercepts the program’s network calls and routes them through a proxy defined in its own configuration file, and it handles SOCKS5 as well as HTTP. It cannot help with statically linked binaries, since there is nothing to intercept.

1. Export the variables in your shell profile
This covers the majority of command-line software in one step. Open a new shell afterwards, or source the file — the current shell will not pick it up on its own.
2. Give apt its own configuration
A file under /etc/apt/apt.conf.d/ means package operations work regardless of how they are invoked, which matters most in scripts and automation.
3. Decide about sudo deliberately
Adding the variables to env_keep is convenient and means every elevated command inherits your proxy. That is a genuine trade-off on a multi-user machine, so make it consciously rather than by accident.
4. Configure services separately
Anything started by systemd never sees your shell profile. Those need a drop-in file with the environment set explicitly, and a daemon reload afterwards.

Finding Out Which Proxy a Command Is Really Using

Because every tool is configured independently, the useful question is never whether the proxy works — it is which configuration this particular command is reading. Ask the command itself rather than inspecting settings.

Ask the tool, not the system
env | grep -i proxy
curl -v https://api.ipify.org 2>&1 | head -20

curl https://api.ipify.org ; echo               # through whatever env says
curl --noproxy '*' https://api.ipify.org ; echo # deliberately direct
sudo -E env | grep -i proxy                     # does sudo keep them?
Comparing the two curl lines tells you immediately whether the proxy is being used
Symptom Most likely cause
Works in your shell, fails under sudo sudo stripped the environment. Use the preserve flag or env_keep.
curl proxied, apt is not apt ignores the environment. Give it a file under apt.conf.d.
Desktop setting on, terminal unaffected Working as designed. The desktop key does not reach the shell.
Local services suddenly time out no_proxy is unset, so localhost traffic is being sent to the proxy.
Images pull, containers have no network The Docker daemon is proxied but the containers are not.
Settings correct, nothing changed The profile was edited but never sourced. Open a new shell.

If the endpoint itself is what you want to confirm rather than your configuration, the free PXM2 proxy checker tests it from a browser and reports the detected proxy type and exit country.

Get a Mobile Proxy for Linux

Live PXM2 locations — pick the country you need an exit IP in, and configure it with the steps on this page:

🇫🇷

France

3 Operators 20-150 Mbps
Starting from
$4.34 for 1 hour
4G 5G
Available Operators:
Bouygues Orange SFR
🇮🇳

India

3 Operators 20-30 Mbps
Starting from
$2.74 for 1 hour
4G
Available Operators:
Airtel Jio Vodafone Idea (Vi)
🇸🇬

Singapore

2 Operators 30-70 Mbps
Starting from
$2.99 for 1 hour
4G
Available Operators:
Singtel Vivifi
View all locations →

Frequently Asked Questions

How do I set a proxy on Linux?

Export http_proxy and https_proxy in your shell, and set no_proxy for the hosts that should bypass it. Put them in your shell profile to make them persist. That covers curl, wget, git, pip, npm and most command-line software, though apt and a few other tools need their own configuration in addition.

Why does apt ignore my proxy environment variables?

By design — apt does not inherit your shell environment when it runs under sudo, and it prefers its own configuration. Write an Acquire proxy directive into a file under /etc/apt/apt.conf.d/ so the setting survives regardless of who runs the command and how. That is more reliable than passing variables through sudo every time.

Why does my proxy stop working under sudo?

sudo strips most environment variables before running the command, so your exported proxy never reaches it. Use sudo with the flag that preserves the environment for a one-off, or add the proxy variables to env_keep in the sudoers file through visudo if you need it permanently.

Does the GNOME network proxy setting apply to the terminal?

No. The desktop proxy setting reaches applications that read the desktop configuration — GNOME Web and a handful of GNOME applications. Terminal utilities read environment variables and are entirely unaffected by it. Setting it and expecting curl to follow is one of the most common Linux proxy mistakes.

How do I proxy an application that has no proxy support?

Use proxychains, which intercepts the program’s network calls and routes them through a proxy you configure in its own file. It is the standard answer for software that reads neither environment variables nor a proxy setting of its own, and it works with SOCKS5 as well as HTTP.

If your Linux box is a server rather than a desktop, IP whitelisting is usually the better authentication choice — the setup overview covers when to prefer it.

Setup guides

Core mobile proxy guides

Route Your Linux Box Through a Real Carrier IP

Dedicated 4G/5G modems with unlimited bandwidth and unlimited rotations — HTTP(S) and SOCKS5 endpoints, with IP whitelisting for servers that have a stable address.

Get a Mobile Proxy