mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-24 05:56:08 +03:00
Adds an option to enable internal networking on VPN
This commit is contained in:
parent
b6f0c42b5b
commit
cfe1758b0b
@ -193,6 +193,9 @@ else
|
|||||||
echo " 6) Verisign"
|
echo " 6) Verisign"
|
||||||
read -p "DNS [1-6]: " -e -i 1 DNS
|
read -p "DNS [1-6]: " -e -i 1 DNS
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Do you want to enable internal networking between the hosts connected to your VPN?"
|
||||||
|
read -p "Yes(y)/No(n):" -e -i n NATOPTION
|
||||||
|
echo ""
|
||||||
echo "Finally, tell me your name for the client cert"
|
echo "Finally, tell me your name for the client cert"
|
||||||
echo "Please, use one word only, no special characters"
|
echo "Please, use one word only, no special characters"
|
||||||
read -p "Client name: " -e -i client CLIENT
|
read -p "Client name: " -e -i client CLIENT
|
||||||
@ -293,8 +296,14 @@ crl-verify crl.pem" >> /etc/openvpn/server.conf
|
|||||||
# 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
|
||||||
|
if [[ "$NATOPTION" == 'y' ]];then
|
||||||
|
# Allows internal networking amongst hosts connected to the VPN.
|
||||||
|
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
|
||||||
|
sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL
|
||||||
|
else
|
||||||
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP
|
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP
|
||||||
sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL
|
sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL
|
||||||
|
fi
|
||||||
if pgrep firewalld; then
|
if pgrep firewalld; then
|
||||||
# We don't use --add-service=openvpn because that would only work with
|
# We don't use --add-service=openvpn because that would only work with
|
||||||
# the default port. Using both permanent and not permanent rules to
|
# the default port. Using both permanent and not permanent rules to
|
||||||
|
Loading…
Reference in New Issue
Block a user