Pejman Moghadam / Debian

Debian 10 - Internet access through SSH

Public domain


Server: A machine with SSH server that you can connect from Client, but does not have Internet access.
Client: A machine with SSH access to server and has Internet access.
Objective: Provide Internet access to Server through Clients SSH tunnel.

Server: add to /etc/ssh/sshd_config and restart ssh service

PermitTunnel yes

Client: connect to server

ssh root@ -p22022 -w0

Client: router settings

ifconfig  tun0 netmask
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ppp+ -j MASQUERADE

Server: Gateway settings

ifconfig  tun0 netmask
ping -c 4
route add -net <client network> gw <old gateway>
route del default
route add default gw

BY: Pejman Moghadam
TAG: ssh, sshdconfig
DATE: 2021-05-26 01:20:35

Pejman Moghadam / Debian [ TXT ]