Fedora-Remix-for-WSL
Fedora-Remix-for-WSL copied to clipboard
fedora-remix-wsl sshd port not exposed to windows or the local network.
Describe the bug fedora-remix-wsl sshd port not exposed to windows or the local network.
To Reproduce Steps to reproduce the behavior:
-
start sshd a) ssh-keygen -A b) (optional) change port in /etc/ssh/sshd_config to something like 8222 c) /usr/sbin/sshd ( starts sshd ) d) confirm by doing ssh -p8222 localhost -> where 8222 matches port in b above.
-
from a locally networked computer do a) ssh -p8222 user@windows10-ip-address
3). you get: ssh -p8222 [email protected] ssh: connect to host 10.12.14.6 port 8222: Connection refused
and ( from a local network computer )
nmap -n -p8222 10.12.14.6 Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-08 09:47 CDT Nmap scan report for 10.12.14.6 Host is up (0.00053s latency).
PORT STATE SERVICE 8222/tcp closed unknown
Nmap done: 1 IP address (1 host up) scanned in 0.02 seconds
Expected behavior port 8222 on the windows box should be open and allow connects to the fredora-remix-wsl installation
Basic Troubleshooting Checklist
[x ] I have searched Google for the error message. [x ] I have checked official WSL troubleshooting documentation: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#confirm-wsl-is-enabled. [ ] I have searched the official Microsoft WSL issues page: https://github.com/Microsoft/WSL/issues. [ ] I have searched the WLinux issues page: https://github.com/WhitewaterFoundry/WLinux/issues. [x ] I have reset WLinux: Settings->Apps->Apps & features->WLinux->Advanced Options->Reset. [x ] I have disabled and re-enabled WSL in Windows Features. [x ] I have run Windows 10 updates and restarted.
What other troubleshooting have you attempted?
I've tried different ports ( 22, 7222, 9222) none of these work.
I have run ubuntu wsl and kali wsl instances and ssh on port 7222, 8222, and 9222 work... depending on the port specified in the /etc/ssh/sshd_config file.
Insert here:
WLinux Version
wsl -l -v
NAME STATE VERSION
* xWSL Stopped 1
fedoraremix Running 2
Ubuntu Stopped 2
( not sure if this is the wlinux version... and what the * by xWSL signifies )
Windows Build OS Version: 10.0.19640 N/A Build 19640
For help on retrieving: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#check-your-build-number
We will try to reproduce this and come back with answers.
What is strange for me is that it is working in Ubuntu and doesn't in Fedora Remix due to the networking is managed by WSL2.
Thbaks for reporting.
Regards, Carlos
Guess you can close this... it's not a bug but a windows 'feature'. with wsl 2 the user has to setup a port forwarding rule to go from the local network to the wsl 2 instance.
The ip address of the wsl 2 instance changes with each 'boot' so you have to set the rule each time the wsl 2 instance boots.
netsh interface portproxy add v4tov4 listenport=<local-port> listenaddress=0.0.0.0 connectport=<wsl 2 instance port> connectaddress=<wsl 2 instance ip address>
so if you had sshd listening on port 22 on your fedoraremixwsl instance... you'd start the instance, do ifconfig eth0 to get the ip adress and then do something like:
netsh interface portproxy add v4tov4 listenport=8222 listenaddress=0.0.0.0 connectport=22 connectaddress=172.x.x.x
where 172.x.x.x is the address of your fedora-remix-wsl instance.
- jack
Good findings I haven't had time to check it. I will mark it as a how-to candidate and create a how-to page for it.
Thank you
You can also allow forwarding between the WSL2 and the VM network with:
# Allow traffic from Hyper-V VMs to WSL and vice versa
Set-NetIPInterface -ifAlias "vEthernet (WSL)" -Forwarding Enabled
Set-NetIPInterface -ifAlias "vEthernet (Default Switch)" -Forwarding Enabled
... but yes, this is how Windows handles the networking.