I have openvpn working fine and it loads at startup as expected. However, without running the following commands on the server I cannot use it to forward the traffic from my client:
sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE su echo '1' > /proc/sys/net/ipv4/ip_forward
su is because sudo isn't sufficient (i.e.
sudo echo '1' > /proc/sys/net/ipv4/ip_forward will fail so I must use
su, log in as root and then run the command. If you know a better way to do this I'm all ears).
I want this to all be done automatically on boot (so after a reboot I don't have to log in via SSH, run the commands and log out again... I want to just launch my client and go) but do not know how to do this. I'm using Ubuntu 10.10 Server.
*FYI this is so I can use this (US based... in my living room) VPN from within China if (when) they block my normal aid VPN (which they do all too frequently).