Wireguard Configuration
Last Tested in Nodegrid Version 4.1.9
Overview
Wireguard is a current tunnel solution which is part of current Linux distributions. The Solutions are making its way into the some business applications and is for example currently supported by 128 Technologie and Perimeter81.
Advantages:
- Uses a current elliptic curve algorithm for the encryption
- Uses RSA keys and optional PSK's for authentication
- Roaming of End Points is en integrated part of the solution
- Easy to set up
- Good Client support, with native support for Windows, MacOS, Linux, iOS and Android
- Native support for tunnel interfaces to allow for Multicast traffic
- Support for IPv6 and IPv4 over the same interface
- Part of the Linux kernel ensures long term support
Disadvantages
- IP Addresses of endpoints systems are getting logged, in some environments this is undesirable due to local laws or regulations
- No native User authentication mechanisms are build in
- Relatively new protocol/solution
Wireguard is supported on Nodegrid devices since version 4.1 and allows for the establishment of an easy site to site tunnel.
Configuration
- Login to the Nodegrid shell as root user
- Navigate to `/etc/wireguard`
- Create a private and public key with the following command
- umask 077
- wg genkey | tee privatekey | wg pubkey > publickey
- This will create 2 files:
- privatekey : this file contains the private key. This should never be share.
- publickey: This file contains the public key which will be shared with other endpoints
- Create now configuration file. The file name has to match the interface which will be used for example if the interface which will be used is called `wg0` the file name should be `wg0.conf`
- [Interface]
- ListenPort = <Local UDP Port>
- PrivateKey = <LOCAL PRIVATE KEY>
- Address = <LOCAL IP ADDRESS RANGE WHICH WILL BE ALLOWED>
- [Peer]
- PublicKey = <ENDPOINT PUBLIC KEY>
- AllowedIPs = <ENDPOINT ADDRESS RANGE WICH WILL BE ALLOWD>
- PersistentKeepalive = 25 #Keepalive checks for the tunnel in secounds
- Endpoint = <ENDPOINT PUBLIC IP AND UDP PORT NUMBER>
Example
- root@nodegrid:/etc/wireguard# cat wg1.conf
- [Interface]
- ListenPort = 8000
- PrivateKey = yXi....j4=
- Address = 10.255.255.3/24
- [Peer]
- PublicKey = BVbf....aNXU=
- AllowedIPs = 10.255.0.0/16
- PersistentKeepalive = 10
- Endpoint = 134.122.64.42:8000
Tunnel Management
Start Tunnel
Tunnel can be started with the `wg-quick` command and the interface name
Stop Tunnel
Tunnel can be stopped with the `wg-quick` command and the interface name
Tunnel Status
The current tunnel status can be seen with the `wg` command
- root@nodegrid:/etc/wireguard# wg
- interface: wg1
- public key: ZLqr/.../MK3nGgC3k=
- private key: (hidden)
- listening port: 8000
- peer: BVb....XU=
- endpoint: xxx.xxx.xxx.xxx:8000
- allowed ips: 10.255.0.0/16
- latest handshake: 1 minute, 52 seconds ago
- transfer: 26.42 KiB received, 24.79 KiB sent
- persistent keepalive: every 10 seconds
Reference