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.
PermitTunnel yes
ssh root@192.168.1.10 -p22022 -w0
ifconfig tun0 1.1.1.1 netmask 255.255.255.0
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ppp+ -j MASQUERADE
ifconfig tun0 1.1.1.2 netmask 255.255.255.0
ping -c 4 1.1.1.1
route add -net <client network> gw <old gateway>
route del default
route add default gw 1.1.1.1
BY: Pejman Moghadam
TAG: ssh, sshdconfig
DATE: 2021-05-26 01:20:35