View on GitHub

VPN Forwarding

Task

Share vpn for other hosts in LAN.

What we need to do

1. Share host

First, we need turn on ip forwarding option in sysctl:

echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/local.conf

Add NAT to net interface:

iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
where br0 - vpn interface
2. Client hosts

Here we need only add route to route table:

sudo ip route add [LAN_gateway]/[submask] via [shared_host_ip]

That’s all. Now you can enjoy it!