Create a task to run this batch at the Windows system startup
wsl_ssh_port_forward.bat
@echo off
wsl --exec dbus-launch true
timeout /T 5
wsl --exec bash /opt/scripts/ssh_port_forward.sh
ssh_port_forward.sh
#!/usr/bin/bash
# Port-forward WIN:38122 -> WSL:38122 (SSH)
IP=$(hostname -I)
netsh.exe interface portproxy delete v4tov4 listenport=38122
netsh.exe interface portproxy add v4tov4 listenport=38122 connectaddress=$IP
sc.exe config iphlpsvc start=auto
sc.exe start iphlpsvc
No comments:
Post a Comment