mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-23 21:46:08 +03:00
Better way to enable IP forwarding
Should be more universal than the previous approach.
This commit is contained in:
parent
6e349e31cb
commit
791c54786c
@ -286,16 +286,10 @@ status openvpn-status.log
|
|||||||
verb 3
|
verb 3
|
||||||
crl-verify crl.pem" >> /etc/openvpn/server.conf
|
crl-verify crl.pem" >> /etc/openvpn/server.conf
|
||||||
# Enable net.ipv4.ip_forward for the system
|
# Enable net.ipv4.ip_forward for the system
|
||||||
if [[ "$OS" = 'debian' ]]; then
|
sed -i '/net.ipv4.ip_forward/c\net.ipv4.ip_forward=1' /etc/sysctl.conf
|
||||||
sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf
|
if ! grep -q "net.ipv4.ip_forward" /etc/sysctl.conf; then
|
||||||
else
|
|
||||||
# CentOS 5 and 6
|
|
||||||
sed -i 's|net.ipv4.ip_forward = 0|net.ipv4.ip_forward = 1|' /etc/sysctl.conf
|
|
||||||
# CentOS 7
|
|
||||||
if ! grep -q "net.ipv4.ip_forward=1" "/etc/sysctl.conf"; then
|
|
||||||
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
|
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
# Avoid an unneeded reboot
|
# Avoid an unneeded reboot
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
# Set NAT for the VPN subnet
|
# Set NAT for the VPN subnet
|
||||||
|
Loading…
Reference in New Issue
Block a user