mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
add Wireguard MTU support via setupVARS.conf
This commit is contained in:
parent
d7771c2514
commit
94744c77a9
3 changed files with 16 additions and 3 deletions
|
@ -1083,6 +1083,12 @@ installPiVPN(){
|
|||
pivpnDEV="wg0"
|
||||
pivpnNET="10.6.0.0"
|
||||
vpnGw="${pivpnNET/.0.0/.0.1}"
|
||||
# The default MTU should be fine for most users but we allow to set a
|
||||
# custom MTU via unattend setupVARs file. Use default if not provided.
|
||||
if [ -z "$pivpnMTU" ]; then
|
||||
# Using default Wireguard MTU
|
||||
pivpnMTU="1420"
|
||||
fi
|
||||
# Forward all traffic through PiVPN (i.e. full-tunnel), may be modified by
|
||||
# the user after the installation.
|
||||
ALLOWED_IPS="0.0.0.0/0, ::0/0"
|
||||
|
@ -1096,6 +1102,7 @@ installPiVPN(){
|
|||
confNetwork
|
||||
|
||||
echo "pivpnPROTO=${pivpnPROTO}" >> ${tempsetupVarsFile}
|
||||
echo "pivpnMTU=${pivpnMTU}" >> ${tempsetupVarsFile}
|
||||
|
||||
fi
|
||||
|
||||
|
@ -2047,6 +2054,7 @@ confWireGuard(){
|
|||
echo "[Interface]
|
||||
PrivateKey = $($SUDO cat /etc/wireguard/keys/server_priv)
|
||||
Address = ${vpnGw}/${subnetClass}
|
||||
MTU = ${pivpnMTU}
|
||||
ListenPort = ${pivpnPORT}" | $SUDO tee /etc/wireguard/wg0.conf &> /dev/null
|
||||
echo "::: Server config generated."
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ IPv4gw=192.168.23.1
|
|||
dhcpReserv=0
|
||||
install_user=pi
|
||||
VPN=wireguard
|
||||
pivpnMTU=1420
|
||||
pivpnPORT=51820
|
||||
pivpnDNS1=9.9.9.9
|
||||
pivpnDNS2=149.112.112.112
|
||||
|
|
|
@ -94,11 +94,15 @@ done
|
|||
|
||||
NET_REDUCED="${pivpnNET::-2}"
|
||||
|
||||
echo -n "[Interface]
|
||||
echo "[Interface]
|
||||
PrivateKey = $(cat "keys/${CLIENT_NAME}_priv")
|
||||
Address = ${NET_REDUCED}.${COUNT}/${subnetClass}
|
||||
DNS = ${pivpnDNS1}" > "configs/${CLIENT_NAME}.conf"
|
||||
Address = ${NET_REDUCED}.${COUNT}/${subnetClass}" > "configs/${CLIENT_NAME}.conf"
|
||||
|
||||
if [ -n "${pivpnMTU}" ]; then
|
||||
echo "MTU = ${pivpnMTU}" >> "configs/${CLIENT_NAME}.conf"
|
||||
fi
|
||||
|
||||
echo -n "DNS = ${pivpnDNS1}" >> "configs/${CLIENT_NAME}.conf"
|
||||
if [ -n "${pivpnDNS2}" ]; then
|
||||
echo ", ${pivpnDNS2}" >> "configs/${CLIENT_NAME}.conf"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue