Skip to content

Instantly share code, notes, and snippets.

@zsteva
Last active October 11, 2016 21:16
Show Gist options
  • Save zsteva/dc2c8f1e393be6af939046c183d731e9 to your computer and use it in GitHub Desktop.
Save zsteva/dc2c8f1e393be6af939046c183d731e9 to your computer and use it in GitHub Desktop.
ssh vpn
# /etc/ssh/sshd_config
# .....
Match User zsteva
PermitTunnel yes
# /etc/systemd/network/vpn.netdev
[NetDev]
Name=tun5
Kind=tun
MTUBytes=1480
[TUN]
User=zsteva
Group=network
# /etc/systemd/network/vpn.network
[Match]
Name=tun5
[Address]
Address=192.168.57.1/32
Peer=192.168.57.100/32
# host1# systemctl restart systemd-networkd
# host1# systemctl restart sshd
# host2# systemctl restart systemd-networkd
ssh -n -w5:5 host1 \
-o ServerAliveInterval=30 \
-o ServerAliveCountMax=5 \
-o TCPKeepAlive=yes \
-N
# /etc/systemd/network/vpn.netdev
[NetDev]
Name=tun5
Kind=tun
MTUBytes=1480
[TUN]
User=zsteva
Group=network
# /etc/systemd/network/vpn.network
[Match]
Name=tun5
[Address]
Address=192.168.57.100/32
Peer=192.168.57.1/32
[Route]
Destination=192.168.56.0/24
Gateway=192.168.57.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment