Shadowsocks-windows: WSL Support

Created on 21 Nov 2019  ·  13Comments  ·  Source: shadowsocks/shadowsocks-windows

Shadowsocks version / 影梭版本

4.1.8.0

Environment (Operating system, .NET Framework, etc) / 使用环境(操作系统,.NET Framework等)

Windows 10 latest release

Steps you have tried / 操作步骤

  • Using Proxifier
  • Setting Shadowsocks client as "Global"
  • Using Outline client

What did you expect to see? / 期望的结果

WSL command lines can go through Shadowsocks proxy

What did you see instead? / 实际结果

WSL ignores Shadowsocks proxy even if set as "Global"

Config and error log in detail (with all sensitive info masked) / 配置文件和日志文件(请隐去敏感信息)

Seems no errors to show, Shadowsocks connects successfully.

question

Most helpful comment

In WSL, Please set your proxy info by using these command:

export http_proxy=http://127.0.0.1:1080
export https_proxy=http://127.0.0.1:1080

If your shadowsocks local proxy is not 1080, Change it before use.

For example:
image

All 13 comments

In WSL, Please set your proxy info by using these command:

export http_proxy=http://127.0.0.1:1080
export https_proxy=http://127.0.0.1:1080

If your shadowsocks local proxy is not 1080, Change it before use.

For example:
image

In WSL, Please set your proxy info by using these command:

export http_proxy=http://127.0.0.1:1080
export https_proxy=http://127.0.0.1:1080

If your shadowsocks local proxy is not 1080, Change it before use.

For example:
image

@chenshaoju it seems to be working, how to turn it off afterwards if want to turn it off?

You can simply shutdown your WSL by using wsl.exe -t ubuntu, This will clean all environment variable.

Or, You can use these command to set proxy environment variable to null.

export http_proxy=
export https_proxy=

Example:
Screenshot2

@chenshaoju that's great, thanks so much for the tip! I'd suggest you guys add that to your FAQ somewhere or documentation, it's very useful to know for those who are not very familiar with the internals of WSL but still would like to use it with the proxy.

@chenshaoju sometimes I try and it doesn't work:

But I have checked my port config and it's correct:

image
image
image

The ping command is ICMP protocol, It's unable through proxy.

Try curl or wget.

@chenshaoju when I access gitlab through browser it's super fast using proxy with shadwsocks. Even if shadowsocks is working well and I can curl google.com successfully, doing a git clone is still very very slow:

image

maybe try socks5 protocol:

export http_proxy=socks5h://127.0.0.1:1080
export https_proxy=socks5h://127.0.0.1:1080

@chenshaoju same result:

image

@chenshaoju it seems to be a problem if you clone a repository over SSH, but over HTTPS it works fine. Maybe client should support through SSH?

If using SSH, may try this:
https://gist.github.com/yougg/5d2b3353fc5e197a0917aae0b3287d64

After set ssh proxy line.

Maybe add some documents after WSL2 become stable

On WSL2 it's not working.
Because WSL can't see windows as localhost, so I have to get the proxy ip as described in /etc/resolv.conf:
image

Then I set the proxy env variable:
image

But curl to google.com still doesn't work:
image
Of course I have already set the shadowsocks properly and can acess to google on windows side.
image
So what's the problem? Did something went wrong with WSL2?

From your curl log, The proxy looks set successfully, But the proxy no responding.

image

If your WSL2 and Shadowsocks are on the same computer, try 127.0.0.1?

If not are on the same computer, maybe is your Shadowsocks computer Windows Firewall settings not correct. Please check your Windows Firewall income port allow list, is allowed your Shadowsocks proxy port?

Was this page helpful?
0 / 5 - 0 ratings