7

As in title, I want to make Ubuntu 20.04 LTS WSL use proxied connections; I am in China, behind the infamous Great Firewall of China, if that doesn't ring any bells, just Google it.

Fortunately I know how to bypass it freely(as in "free of charge"), currently I use Lantern, its http proxy port is 1053, I had set it to "manage system proxy" and "proxy all traffic", I had run these commands:

netsh winhttp set proxy 127.0.0.1:1053
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d "127.0.0.1:1053" /f

And made Lantern proxy PowerShell traffic in addition to browsers and downloaders.

Now, I enabled Windows Subsystem for Linux, installed wsl_update_x64.msi, installed Ubuntu 20.04, and ran this:

sudo apt update

And it downloads files from archive.ubuntu.com and security.ubuntu.com with astonishingly slow speed: several (below 10)KB/s, my connection is 100mbps PPPoE(translates to 11.920928955078125MiB/s download speed), undoubtly it isn't being proxied, so how can I proxy its traffic?

0

2 Answers 2

10

Never mind, I had just solved it, again, and found sometimes Google really can be useful, well, I said SOMETIMES.

I just found this: https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-the-proxy-for-apt-for-ubuntu-18-04/

I used these:

sudo touch /etc/apt/apt.conf.d/proxy.conf
sudo vi /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "http://127.0.0.1:1053/";
:wq

(AND I closed Ubuntu)

Now its speed is much more resonable.

1
  • 2
    What about git clone, wget, curl, etc... I don't think they are proxied if you do this. Are they?
    – VidathD
    Jul 5, 2021 at 6:58
4

This worked for me too..

For other general HTTP access you can set proxy as follow

export http_proxy=<proxyUrl>:<proxyPort>

You can also have this in bash profile so that you do not have to set it each time.

1
  • 1
    This answer is the general solution for http/https connetion. (even working for "$ kubectl krew update" )
    – agfe2
    Dec 13, 2021 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.