WireGuard Client service up in four steps with entware

Using a wireguard client in LibreELEC/CoreELEC with connman native services and with a DDNS server can cause a terrible headache because it only supports static IP addresses. In CoreELEC it is very easy to do this in the following way using entware:

1.- Install entware, command: installentware

2.- Install software-wireguard, commands:

opkg install wg-quick
opkg install wireguard-tools
opkg install wireguard-go

3.- Create wg0 as file /opt/etc/wireguard/wg0.conf with the content similar to this:

[Interface]
Address = 10.10.10.5 # local-ip-of-wg-interface
PrivateKey = ... # private-key
ListenPort = 51820 # wg-port

[Peer]
PublicKey = ... # public-key
Endpoint = <dynamic-dns-of-server>:51820
AllowedIPs = 0.0.0.0/1,128.0.0.0/1 # instead of 0.0.0.0/0

4.- Start the wireguard service with the command: /opt/bin/wg-quick up wg0

Note.- If you don’t want to redirect all traffic to wireguard interface and want to keep the default route, then you can use AllowedIPs = 10.10.10.0/24, where 10.10.10.0 is the wireguard subnet