Skip to content

Use loopback for SSH connection in WSL2 #3299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

arixmkii
Copy link
Contributor

@arixmkii arixmkii commented Mar 3, 2025

Fixes #3242

According to WSL2 documentation - both mainstream networking modes NAT and mirrored support access to WSL2 running apps via loopback https://learn.microsoft.com/en-us/windows/wsl/networking#accessing-linux-networking-apps-from-windows-localhost

Other Hyper-V networking modes as bridged and may be some others are somewhat supported by WSL2, but are discouraged for common scenarios.

In this case there is no point to resolve external IP in a distro specific way to successfully run Lima provisioning of the said VM.

I tested this with NAT in GH actions and with mirrored networking locally.

There are setting for preventing access via loopback but there are also firewalls, which would prevent to access over external IP, so, the loopback sounds like a reasonable default and different settings should only be used if specific scenario is detected or if specifically requested. As these scenarios are not documented as of now the code in question could be removed and later reintroduced adjusted to the new usecases.

@AkihiroSuda AkihiroSuda added this to the v1.1 (tentative) milestone Mar 4, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 787faec into lima-vm:master Mar 4, 2025
31 checks passed
@arixmkii arixmkii deleted the loopback-wsl2-sshaddress branch March 6, 2025 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WSL2] getWslSSHAddress would fail on busybox distros
2 participants