From dfa964552f799e24e4ab123b5a085f84812f9ffd Mon Sep 17 00:00:00 2001 From: Tony Xu Date: Tue, 6 Sep 2016 15:26:57 +0800 Subject: [PATCH] fix net.ipv4.ip_forward settings centos7 `# net.ipv4.ip_forward=1` --- openvpn-install.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 279a1e7..0e31b63 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -286,16 +286,8 @@ status openvpn-status.log verb 3 crl-verify crl.pem" >> /etc/openvpn/server.conf # Enable net.ipv4.ip_forward for the system - if [[ "$OS" = 'debian' ]]; then - sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf - 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 - fi - fi + sed -i "/\/d" + echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf # Avoid an unneeded reboot echo 1 > /proc/sys/net/ipv4/ip_forward # Set NAT for the VPN subnet