I really loved the last two episodes on creating a VPN. I have a Wifi Pineapple Nano and have setup a VPN server and can manually connect
. I used the forwarding 'foo' code in the video to get client forwarding working.
Now I wanted to make it so that the openvpn client and the forwarding script works on startup but I cannot seem to get it working. I've done some searching but cannot think of where to go from here.
I've put this in /etc/init.d/
# Start the openvpn service
#Setup forwarding for clients
iptables -t nat -A POSTROUTING -s 172.16.42.0/24 -o tun0 -j MASQUERADE
iptables -A FORWARD -s 172.16.42.0/24 -o tun0 -j ACCEPT
iptables -A FORWARD -d 172.16.42.0/24 -m state --state ESTABLISHED,RELATED -i tun0 -j ACCEPT
And created a symlink to /etc/rc.d/
If I run the commands separately it all works however I cannot get it to run on boot.
Should they be run as two different processes? Is it because openvpn is running the second won't trigger.
Not sure if it's my lack of understanding of Unix/bash scripting or something else.
Thanks for your time guys.