just wanted to share the approach i use when switching between LAN and the internet. generally i use WSL in windows so that i can use bash scripts and not deal with powershell (for better or worse). this is just a registry editing shortcut that let’s me flip on the tunnel behavior.
so, i’m no longer at home, and i want to connect to my server at home on the LAN.
step 1: ssh -L2222:localhost:22 username@myserver.com
establish the ssh tunnel to the host running the thinlinc server host. i port forwarded this from my home router and ensured my tlc server has a static LAN IP.
step 2: enable thinlinc tunnel: tlc-tunnel.sh on
step 3: open thinlinc and connect to the server using its LAN (!) ip. yes, lan, even though you are not on the LAN. the registry entry created by the tlc-tunnel script below make thinlinc interpret the ip differently.
~done~
here is the script source for tlc-tunnel.sh
. this assumes my server runs on 192.168.68.60 on my home LAN.
#!/bin/bash
set -e
LAN_TARGET="192.168.68.60"
if [ "$1" == "on" ]; then
/mnt/c/Windows/System32/reg.exe add "HKCU\\Software\\Cendio\\ThinLinc\\tlclient" /v "HOST_ALIASES" /d "${LAN_TARGET}:22=localhost:2222" /t REG_SZ /f
elif [ "$1" == "off" ]; then
/mnt/c/Windows/System32/reg.exe delete "HKCU\\Software\\Cendio\\ThinLinc\\tlclient" /v "HOST_ALIASES" /f
else
echo "Invalid parameter. Please use 'on' or 'off'."
fi