sudo aptitude install openssh-server
Work:
IP address: 172.16.0.1
Netmask: 255.255.255.0
Default Gateway: 172.16.0.254
DNS: 8.8.8.8
172.16.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 0.0.0.0 172.16.0.254 0.0.0.0 UG 0 0 0 eth0
/etc/ssh/sshd_config
, add the line PermitTunnel point-to-point
and restart the OpenSSH server service ssh restart
sudo ssh root@74.125.87.104 -w 0:0
-w local_tun[:remote_tun]
Requests tunnel device forwarding with the specified tun (4) devices between the client (local_tun) and the server (remote_tun)
ifconfig tun0 10.0.0.1/30 pointopoint 10.0.0.2
ifconfig tun0 10.0.0.2/30 pointopoint 10.0.0.1
user @ host: ~ $ ping 10.0.0.1 -c 2 PING 10.0.0.1 (10.0.0.1) 56 (84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq = 1 ttl = 64 time = 5.80 ms 64 bytes from 10.0.0.1: icmp_seq = 2 ttl = 64 time = 8.61 ms --- 10.0.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min / avg / max / mdev = 5.800 / 7.209 / 8.618 / 1.409 ms
route add -host 74.125.87.104 gw 172.16.0.254
route add -host 8.8.8.8 gw 172.16.0.254
route del default
route add default gw 10.0.0.1
74.125.87.104 172.16.0.254 255.255.255.255 UGH 0 0 0 eth0 8.8.8.8 172.16.0.254 255.255.255.255 UGH 0 0 0 eth0 10.0.0.0 0.0.0.0 255.255.255.252 U 0 0 0 tun0 172.16.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 tun0
iptables -t nat -A POSTROUTING -s 10.0.0.2 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1
mcedit /etc/sysctl.conf
net.ipv4.ip_forward=1
and uncomment it.
Source: https://habr.com/ru/post/87197/