I am in the process of porting my "configure openvpn server" from ubuntu 14 to debian 8. So far it works well except for this section:
# Set up iptables to forward packets for vpn and do this upon startup. echo 'iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT iptables -A FORWARD -j REJECT iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE exit 0' > /etc/rc.local
It appears that debian 8 does not use this
/etc/rc.local file so my vpn server won't forward traffic correctly after a reboot. I have to manually call that script, or execute the commands.
What is the "debian 8 way" for updating the iptables on boot?
After reading that
/etc/rc.local should work, I made sure the permissions were set to 755 and updated the script to as follows:
/bin/echo "starting..." > /root/rc.local.log /sbin/iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT /sbin/iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT /sbin/iptables -A FORWARD -j REJECT /sbin/iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE /bin/echo "completed successfully" >> /root/rc.local.log exit 0
I then created an empty
/root/rc.local.log and gave it
777 permissions before rebooting. The file remained empty, making me think that the /etc/rc.local script is not being executed at all.