Installation of WireGuard server in CoreELEC:
1.- Install the docker addon if you haven’t done this yet.
2.- From an SSH terminal execute the command:
docker create \
--name=wireguard \
--cap-add=NET_ADMIN \
--cap-add=SYS_MODULE \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/Paris \
-e SERVERURL=<external_ip_of_server_or_ddns> \
-e SERVERPORT=51820 \
-e PEERS=test,x96air,rpi4,odroid<,other_devices> \
-e PEERDNS=8.8.8.8 \
-e INTERNAL_SUBNET=10.10.10.0 \
-e ALLOWEDIPS=0.0.0.0/0 \
-p 51820:51820/udp \
-v /storage/.config/wireguard:/config \
-v /lib/modules:/lib/modules \
--sysctl="net.ipv4.conf.all.src_valid_mark = 1" \
--restart unless-stopped \
--net=host \
linuxserver/wireguard
3.- Start the server in SSH with: docker start wireguard
4.- The client configuration files are in /storage/.config/wireguard
Note.- --net=host
allows identifying the IP of each of the clients
Installation of WireGuard client in CoreELEC:
Create the file /storage/.config/wireguard/wireguard.config with the following content:
[provider_wireguard]
Type = WireGuard
Name = WireGuard VPN
Host = <external _ip_of_server_or_ddns>
Domain = COREELEC
WireGuard.Address = <private_ip_addres_from_file_peer_test.conf_in_server>/32
WireGuard.PrivateKey = <privatekey_from_file_peer_test.conf_in_server>
WireGuard.PublicKey = <publickey_from_file_peer_test.conf_in_server>
WireGuard.DNS = 8.8.8.8,8.8.4.4
WireGuard.AllowedIPs = 0.0.0.0/0
WireGuard.EndpointPort = 51820
WireGuard.PersistentKeepalive = 25
Next in Kodi System-CoreELEC-Connections enable WireGuard VPN.
In android it is even easier, you just have to import the file peer_test.conf from the server to the WireGuard application.
Note.- The server and client may not work in LibreELEC and you may suffer a headache for this reason, all because the developers have blacklisted wireguard. Edit the file /storage/.config/modprobe.d/blacklist.conf and remove wireguard from the blacklist.