본문 바로가기

Network

OpenVPN not working after server reboot

The problem was that on my Fedora installation there was no /etc/rc.d/rc.local file
Because of that during the installation of OpenVPN line:
CODE: SELECT ALL
iptables -t nat -A POSTROUTING -s x.x.x.x/24 -j SNAT --to x.x.x.x
could not be add to the /etc/rc.d/rc.local
So after reboot iptables line was not executed and routing did not work correctly.


NAT the VPN client traffic to the Internet. change the ip address mask according to your info of tun0 result while running "ifconfig" command.
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

To save the current configuration,
add a cron like this.
@reboot /sbin/iptables -v -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE