(1) Enable IP forwarding in linux
echo 1 > /proc/sys/net/ipv4/ip_forward
Set net.ipv4.ip_forward = 1 in /etc/sysctl.conf:
(2) Enable NAT for the subnet of OpenVPN
sudo iptables -t nat -A POSTROUTING -s 10.168.100.0/24 -o eth0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s 10.168.200.0/24 -o eth0 -j MASQUERADE
(3) Keep iptables
sudo bash -c "iptables-save > /etc/iptables.rules"
(4) Auto start on boot by add the following lines into /etc/network/interfaces:
auto eth0
iface eth0 inet XXXX
pre-up iptables-restore < /etc/iptables.rules