#! /bin/sh ### BEGIN INIT INFO # Provides: startvpn # Required-Start: # Required-Stop: # Default-Start: 2 # Default-Stop: # Short-Description: Connect to VPN Server # Description: ### END INIT INFO #Tun0 - Connect to SITE A openvpn --remote [INSERT_PUBLIC_IP_FOR_REMOTE_SITE_HERE] --port 5000 --dev tun0 --ifconfig 10.99.0.2 10.99.0.1 --verb 1 --secret /etc/openvpn/tun0.key --fragment 1400 --mssfix 1400 --tun-mtu 1450 & sleep 30 #set up a route to the remote LAN subnet for this tunnel ip route add 192.168.6.0/24 via 10.99.0.2 #set up a ping to keep NAT alive, one ping sent once every 60 seconds, otherwise NAT translations get deleted and the tunnel won't pass traffic when needed ping [IP_OF_SERVER] -i 60 & #enable packet forwarding echo 1 > /proc/sys/net/ipv4/ip_forward