Open TawfikDaim opened 1 year ago
Linux Debian ((like the one I did on old Microsoft surface laptop))
Another Method (but this was not completely successful yet, as I can't ping or ssh from another PC to the Windows with Debian WSL - what I will do now is to try to install homeassistant on Debian to see if its accessible (hoping the issue is with firewall or ssh but it will not be with 8123 port for homeassistant)
Route Port 22 (SSH port) Traffic to WSL Distro (e.g., Ubuntu 22.04) Session This is where the tutorial becomes kludgy because there are a few problems with WSL as follows:
The IP address is assigned to the WSL distro (e.g., Ubuntu 22.04) session dynamically, so every time the WSL session starts or restarts, a new IP address is assigned. If you issue a command like ‘wsl — shutdown’ to shut down the WSL session(s) and start a new WSL session, a new IP address gets assigned. The IP address assigned to the WSL distro (e.g., Ubuntu 22.04) session is only accessible by the host computer (i.e., Windows computer). It is not accessible by remote computers. The only way a remote computer can SSH into the WSL session is by creating a network port proxy rule on a Windows computer that maps port 22 to the WSL distro (e.g., Ubuntu 22.04) session. This means that every time the WSL IP address changes, we will need to delete the existing network port proxy rule and replace it with a new one.
Step 3: Delete the Existing Network Port Proxy Rule and Create a New Network Port Proxy Rule
This information was provided by Scott Hanselman on his blog “How to SSH into WSL2 on Windows 10 from an external machine”.
From PowerShell in administrator mode or run as administrator, issue the following command to delete/add network port proxy rules where it uses $wsl_ipaddress1 variable:
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=22 netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=22 connectaddress=$wsl_ipaddress1 connectport=22 Issue the following command to validate network port proxy rule has been changed:
netsh interface portproxy show v4tov4 which should return the following information:
You can also remove all port proxy rules:
netsh int portproxy reset all
Step 4: Open the Firewall
By default, port 22 is blocked by Windows Defender’s firewall. From the same PowerShell in administrator mode or run as administrator, issue the following command to open port 22.
netsh advfirewall firewall add rule name=”WSL SSH” dir=in action=allow protocol=TCP localport=22.
Test SSH Access to WSL from a Remote Computer Finally, restart the computer then log into the computer. You should see two activities:
Windows Terminal window starting with selected WSL Distro (Ubuntu 22.04) Flash of Powershell terminal executing Powershell script. Using the remote computer, SSH into the Windows computer using its IP address:
ssh sungkim@192.168.1.100
check the Linux version that will allow HACS to be installed with now issues