Home SSH tunneling
Posted on 03 March 2022. Last updated on 05 March 2022.
You can use a simple command to setup an SSH tunnel to access anything in the local network of the SSH-server.
It like an simple VPN.
First you have to configure the SSH-server to allow port-forwarding.
Add GatewayPorts yes
in the sshd_config file
/etc/ssh/sshd_config
and restart SSH-daemon.
The command to be executed on the local PC:
ssh -L local_port:remote_address:remote_port user@sshserver.com
Perhaps more clear if you want to see the (intern) web-page from your modem.
ssh -L 8888:192.168.1.1:80 me@ssh.home.com
Now you can open the browser and go to http://localhost:8888
and see the web-page of you modem.
Remote can be any port Web-server, FTP-server, SQL-server, ...
For a more complete access to a network you should look at OpenVPN.