diff --git a/README.md b/README.md index 2f2c07b..2e72793 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,11 @@ $ docker-compose build Customize the file `docker-compose`. You can change the following environment variables as needed -* `DEVICE`: Some `tun` device, e.g. `tun0` +* `DEVICE`: Some `tun` device, defaults to `tun0` * `SERVER_HOST`: The host name of your server * `SERVER_PORT`: The port the service should listen at -* `NETWORK`: Some custom /24 network. e.g. `192.168.42.0` +* `NETWORK`: Some custom /24 network. Defaults to `192.168.42.0` +* `MTU`: MTU to be used. Use default wireguard MTU if not set. * `CLIENTS`: Number of clients for which configurations are to be created. Do not use more than 240 clients. * `DISABLE_FORWARD_ALL_TRAFFIC`: Use `true` or `yes` to not add iptables rules and do not forward all traffic. @@ -45,8 +46,9 @@ wg_1 | - Writing config to file tun0.conf wg_1 | - Using endpoint hostname example.com wg_1 | - Using port 51820 wg_1 | - Using network 192.168.42.0/24 -wg_1 | - Generating 5 client configs and client QR codes +wg_1 | - Using default MTU wg_1 | - Forward all traffic +wg_1 | - Generating 5 client configs and client QR codes wireguard_wg_1 exited with code 0 ``` diff --git a/scripts/add-client.sh b/scripts/add-client.sh index e65b781..13b2cf2 100755 --- a/scripts/add-client.sh +++ b/scripts/add-client.sh @@ -39,6 +39,13 @@ cat < $DEVICE-client_$CLIENT_ID.conf Address = $NETWORK.$(($CLIENT_ID+10))/24 ListenPort = $SERVER_PORT PrivateKey = ${CLIENT_SEC_KEY} +EOF + +if [ $MTU ]; then +echo "MTU = $MTU" >> $DEVICE-client_$CLIENT_ID.conf +fi + +cat <> $DEVICE-client_$CLIENT_ID.conf [Peer] PublicKey = $SERVER_PUB_KEY diff --git a/scripts/create-config.sh b/scripts/create-config.sh index 358af6b..05e6989 100755 --- a/scripts/create-config.sh +++ b/scripts/create-config.sh @@ -30,6 +30,12 @@ else fi echo " - Using network $NETWORK.0/24" +if [[ -z $MTU ]]; then + echo " - Using default MTU" +else + echo " - Using MTU: $MTU" +fi + if [ "$DISABLE_FORWARD_ALL_TRAFFIC" != "true" ] && [ "$DISABLE_FORWARD_ALL_TRAFFIC" != "yes" ]; then echo " - Forward all traffic" else @@ -66,6 +72,10 @@ ListenPort = $SERVER_PORT PrivateKey = $SERVER_SEC_KEY EOF +if [ $MTU ]; then +echo "MTU = $MTU" >> $DEVICE.conf +fi + if [ "$DISABLE_FORWARD_ALL_TRAFFIC" != "true" ] && [ "$DISABLE_FORWARD_ALL_TRAFFIC" != "yes" ]; then cat <> $DEVICE.conf @@ -102,6 +112,13 @@ cat <> $DEVICE-client_$i.conf Address = $NETWORK.$(($i+10))/24 ListenPort = $SERVER_PORT PrivateKey = ${CLIENT_SEC_KEYS[$i]} +EOF + +if [ $MTU ]; then +echo "MTU = $MTU" >> $DEVICE-client_$i.conf +fi + +cat <> $DEVICE-client_$i.conf [Peer] PublicKey = $SERVER_PUB_KEY