Skip to content

WSL cannot use proxy with networkingMode=mirrored #10794

Closed

Description

@mingo99

Windows Version

Microsoft Windows [Version 10.0.22631.2715]

WSL Version

2.0.9.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.1

Distro Version

Ubuntu20.04

Other Software

No response

Repro Steps

  • Set .wslconfig:
[experimental]
autoMemoryReclaim=gradual
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true
  • wsl --shutdown to stop WSL
  • Set proxy port to 7890 in clash for windows and open system proxy
    image
  • Restart WSL

Expected Behavior

Both WSL and Windows can successfully access google.com(banned in my place) by curl

Actual Behavior

  1. Execute curl in Wondows(Powershell)
    • curl google.com succeeded
      image
  2. Excute curl in WSl
  • curl google.com failed
    image

Diagnostic Logs

Activity

  1. github-actions commented on Nov 19, 2023

    @github-actions
    Contributor

    Hi I'm an AI powered bot that finds similar issues based off the issue title.

    Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

    Closed similar issues:

    Note: You can give me feedback by thumbs upping or thumbs downing this comment.

  2. changed the title [-]WSL cannot use proxy[/-] [+]WSL cannot use proxy with networkingMode=mirrored[/+] on Nov 19, 2023
  3. zhaoqiu-china commented on Nov 20, 2023

    @zhaoqiu-china

    try firewall=false?

  4. mingo99 commented on Nov 20, 2023

    @mingo99
    Author

    try firewall=false?
    I've tried, but it still doesn't work

  5. zhaoqiu-china commented on Nov 20, 2023

    @zhaoqiu-china

    BTW, experimental feature has moved to wsl2.
    image

  6. mingo99 commented on Nov 20, 2023

    @mingo99
    Author

    yeah,now my .wslconfig is below, but also come same problem

    [wsl2]
    kernel=C:\\WINDOWS\\System32\\lxss\\tools\\5.15.90.1-kernel-usb
    networkingMode=mirrored
    dnsTunneling=true
    firewall=false
    autoProxy=true
    
    [experimental]
    sparseVhd=true
    autoMemoryReclaim=gradual
    
  7. mingo99 commented on Nov 21, 2023

    @mingo99
    Author

    Additionally, access the external network is normal, like ping github.com is ok

  8. PhyX-Meow commented on Nov 22, 2023

    @PhyX-Meow

    It may not help but, I tried firewall=false then everything works fine. Did you restart wsl by wsl --shutdown?

  9. mingo99 commented on Nov 22, 2023

    @mingo99
    Author

    yeah,even reboot computer

  10. mingo99 commented on Nov 22, 2023

    @mingo99
    Author

    I upgraded from Ubuntu 20.04 to Ubuntu 22.04, and the issue got resolved, although I don't know how it was fixed. The reason I had this idea is that my other computer, which has Ubuntu 22.04 installed, could successfully use the proxy.

  11. zhaoqiu-china commented on Nov 23, 2023

    @zhaoqiu-china

    Mingo (@mingo99)

    I upgraded from Ubuntu 20.04 to Ubuntu 22.04, and the issue got resolved, although I don't know how it was fixed. The reason I had this idea is that my other computer, which has Ubuntu 22.04 installed, could successfully use the proxy.

    whether you set the HTTP_PROXY environment variable?

  12. mingo99 commented on Nov 23, 2023

    @mingo99
    Author

    No, it will set itself.

  13. KnineF commented on Feb 6, 2024

    @KnineF

    我也遇到了这个问题。请问你解决了吗

  14. mingo99 commented on Feb 6, 2024

    @mingo99
    Author

    升级到 22.04 就没问题了🤣

  15. HawtinZeng commented on Feb 9, 2024

    @HawtinZeng

    Additionally, access the external network is normal, like ping github.com is ok

    Me too, but the tip about the local proxy is not mirrored into WSL still appears.And can't ping google.com

  16. SuAutumn commented on Mar 9, 2024

    @SuAutumn

    I changed the inbound rules of the Clash for windows in firewall, that does work in Ubuntu 20.

  17. Minphie commented on Mar 11, 2024

    @Minphie

    I changed the inbound rules of the Clash for windows in firewall, that does work in Ubuntu 20.
    Su Autumn (@SuAutumn)
    怎么改的?我的都勾选了还是不行。
    image

  18. SuAutumn commented on Mar 12, 2024

    @SuAutumn

    I changed the inbound rules of the Clash for windows in firewall, that does work in Ubuntu 20.
    Su Autumn (@SuAutumn)
    怎么改的?我的都勾选了还是不行。
    image

    You can curl http://<host_ip>:7890 -v in wsl terminal, get a 4xx status code means that you can successfully visit clash proxy in wsl. otherwise Just Shutdown firewall, and try again.
    ps: Please confirm clash allow LAN setting enabled.

  19. amorZhu commented on Mar 19, 2024

    @amorZhu

    Try deleting the Linux distribution and reinstalling it.
    wsl --unregister <DistributionName>
    wsl --install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions