mirror of
				https://github.com/angristan/openvpn-install.git
				synced 2025-10-31 05:57:36 +01:00 
			
		
		
		
	Fix iptables rules on reboot for some OS
Thanks a lot to Nyr for the fix : a31aaf82f3
Fixes https://github.com/Angristan/OpenVPN-install/issues/6.
On Ubuntu 17.04, 16.10 and Debian 9, the iptables rules were not applied because of rc.local
			
			
This commit is contained in:
		| @@ -490,6 +490,12 @@ verb 3" >> /etc/openvpn/server.conf | ||||
| 	fi | ||||
| 	# Avoid an unneeded reboot | ||||
| 	echo 1 > /proc/sys/net/ipv4/ip_forward | ||||
| 	# Needed to use rc.local with some systemd distros | ||||
|  	if [[ "$OS" = 'debian' && ! -e $RCLOCAL ]]; then | ||||
|  		echo '#!/bin/sh -e | ||||
|  exit 0' > $RCLOCAL | ||||
| 	fi | ||||
| 	chmod +x $RCLOCAL | ||||
| 	# Set NAT for the VPN subnet | ||||
| 	iptables -t nat -A POSTROUTING -o $NIC -s 10.8.0.0/24 -j MASQUERADE | ||||
| 	sed -i "1 a\iptables -t nat -A POSTROUTING -o $NIC -s 10.8.0.0/24 -j MASQUERADE" $RCLOCAL | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Angristan
					Angristan