Commented out code related to adding a route to the remote subnet (e.g. 192.168.0.0).

This commit is contained in:
Jelle Dekker 2017-09-22 16:03:38 -05:00
parent 97a50c66ef
commit 4e77245a97
2 changed files with 11 additions and 11 deletions

View file

@ -367,15 +367,15 @@ setStaticIPv4() {
fi fi
} }
setNetwork() { #setNetwork() {
# Sets the Network IP and Mask correctly # Sets the Network IP and Mask correctly
export PATH=${PATH}:/sbin:/usr/sbin #export PATH=${PATH}:/sbin:/usr/sbin
LOCALMASK=$(ifconfig "${pivpnInterface}" | awk '/Mask:/{ print $4;} ' | cut -c6-) #LOCALMASK=$(ifconfig "${pivpnInterface}" | awk '/Mask:/{ print $4;} ' | cut -c6-)
LOCALIP=$(ifconfig "${pivpnInterface}" | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*') #LOCALIP=$(ifconfig "${pivpnInterface}" | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*')
IFS=. read -r i1 i2 i3 i4 <<< "$LOCALIP" #IFS=. read -r i1 i2 i3 i4 <<< "$LOCALIP"
IFS=. read -r m1 m2 m3 m4 <<< "$LOCALMASK" #IFS=. read -r m1 m2 m3 m4 <<< "$LOCALMASK"
LOCALNET=$(printf "%d.%d.%d.%d\n" "$((i1 & m1))" "$((i2 & m2))" "$((i3 & m3))" "$((i4 & m4))") #LOCALNET=$(printf "%d.%d.%d.%d\n" "$((i1 & m1))" "$((i2 & m2))" "$((i3 & m3))" "$((i4 & m4))")
} #}
function valid_ip() function valid_ip()
{ {
@ -887,8 +887,8 @@ EOF
# Write config file for server using the template .txt file # Write config file for server using the template .txt file
$SUDO cp /etc/.pivpn/server_config.txt /etc/openvpn/server.conf $SUDO cp /etc/.pivpn/server_config.txt /etc/openvpn/server.conf
$SUDO sed -i "s/LOCALNET/${LOCALNET}/g" /etc/openvpn/server.conf #$SUDO sed -i "s/LOCALNET/${LOCALNET}/g" /etc/openvpn/server.conf
$SUDO sed -i "s/LOCALMASK/${LOCALMASK}/g" /etc/openvpn/server.conf #$SUDO sed -i "s/LOCALMASK/${LOCALMASK}/g" /etc/openvpn/server.conf
# Set the user encryption key size # Set the user encryption key size
$SUDO sed -i "s/\(dh \/etc\/openvpn\/easy-rsa\/pki\/dh\).*/\1${ENCRYPT}.pem/" /etc/openvpn/server.conf $SUDO sed -i "s/\(dh \/etc\/openvpn\/easy-rsa\/pki\/dh\).*/\1${ENCRYPT}.pem/" /etc/openvpn/server.conf

View file

@ -14,7 +14,7 @@ server 10.8.0.0 255.255.255.0
# Add route to Client routing table for the OPenVPN Subnet # Add route to Client routing table for the OPenVPN Subnet
#push "route 10.8.0.0 255.255.255.0" #push "route 10.8.0.0 255.255.255.0"
# your local subnet # your local subnet
push "route LOCALNET LOCALMASK" #push "route LOCALNET LOCALMASK"
# Set your primary domain name server address for clients # Set your primary domain name server address for clients
push "dhcp-option DNS 8.8.8.8" push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4" push "dhcp-option DNS 8.8.4.4"