The OpenFortiVPN runs on a Pi and allows any device on the network to route over to the remote network over the VPN tunnel The DHCP server is configured to provide eth0 MAC a specific IP address Download Raspbian Buster Lite - https://downloads.raspberrypi.org/raspbian_lite_latest Download the imager for your platform - https://www.raspberrypi.org/downloads/ Create your SD card using the imager and bootup $ sudo bash # systemctl enable ssh # apt install tmux openfortivpn edit wpa_supplicant.conf to connect to the guest SSID and reboot after login start tmux with two sessions. run company.sh in the first session and run company-nat.sh in the second session
route add company-vpn-IP gw 192.168.200.5 while true do openfortivpn vpn.company.com:10443 -u -p --trusted-cert echo `date` - restarting in 5 seconds - press ctrl-c to stop sleep 5 done
# eth0 IP is used to forward queries to DNS1 # eth0:1 IP is used to forward queries to DNS2 ifconfig eth0:1 192.168.0.129/24 sysctl -w net.ipv4.ip_forward=1 iptables -t nat -F iptables -F iptables -t nat -A PREROUTING -i eth0 -p udp --dport 53 -j DNAT --to company-dns1-IP:53 iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 53 -j DNAT --to company-dns1-IP:53 iptables -t nat -A PREROUTING -i eth0:1 -p udp --dport 53 -j DNAT --to company-dns2-IP:53 iptables -t nat -A PREROUTING -i eth0:1 -p tcp --dport 53 -j DNAT --to company-dns2-IP:53 iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE iptables -A FORWARD -i eth0 -o ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT #iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT #iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPT iptables -L iptables -t nat -L
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US network={ ssid="guest-SSID" psk="SSID-password" key_mgmt=WPA-PSK }
https://github.com/adrienverge/openfortivpn