Table of Contents


Wireguard Plugin For OMV8

Wireguard Plugin For OMV8

Wireguard Plugin For OMV8



Under Services > Wireguard

Wireguard

Summary


Third Party Software Note

www.wireguard.com While this OMV plugin makes the WireGuard package easy to integrate into OpenMediaVault, the WireGuard software itself is developed and maintained by a third party. For more detailed information and official support, please refer to the WireGuard website.

WireGuard® is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances. Initially released for the Linux kernel, it is now cross-platform (Windows, macOS, BSD, iOS, Android) and widely deployable. It is currently under heavy development, but already it might be regarded as the most secure, easiest to use, and simplest VPN solution in the industry.


Prerequisites


Installation

In OMV8's GUI:
Under System > Plugins, locate and select openmediavault-wireguard 8.X, then click the Install button.

  Note
If your system is based on an Armbian image, installing this plugin may replace or break the existing kernel.
To resolve this, reinstall the Armbian kernel once the plugin installation has completed.
See this forum thread for more details: https://forum.openmediavault.org/index.php?thread/54000-catastrophic-wireguard-install/


Management of a Tunnel

Under Services > Wireguard > Tunnels

Wireguard Tunnels


Configuring a tunnel

Wireguard Tunnels Create

Optional fields for custom configurations:

  Note
Ensure your ISP provides a public IP. If behind CG-NAT, external access will fail.
Also, make sure your server firewall does not block the port forwarded on your router.


Editing a tunnel


Delete a tunnel


See the Tunnel Config


Management of a Client

Under Services > Wireguard > Clients

Wireguard Clients


Configuring a Client

Wireguard Clients Create


Editing a Client

  Note
Any changes made must be applied again on the client using the QR code or configuration file for them to take effect.


Delete a Client


See the Client Config


Management of a Custom Config

Under Services > Wireguard > Custom Config

Wireguard Custom Config


This tab allows you to create a tunnel with custom settings. You can paste configuration from a text file and define the parameters you need. Use this tab if you need to connect the server to an external (commercial) Wireguard VPN service, or for advanced network topologies like point-to-point connections.


Create a Custom Config

Wireguard Custom Config Create

  Tip: Use templates to automatically generate keys.
If creating a custom tunnel from scratch, you can use a pre-existing tunnel and client as templates:
1. Create a tunnel in the Tunnels tab and enable it, then create a client in Clients tab and enable it.
2. In Tunnels, select the tunnel and press **Tunnel Config**. Copy the text.
3. Go to Custom Config, create a new tunnel, paste the text, and save without enabling.
4. In Clients, select the template client, press **Client Config**, and copy the keys to a file. Delete the template tunnel and client.
5. Edit your custom tunnel, adjusting network ranges and other parameters as needed.

  Note
See the procedures section of this document for a step-by-step guide to create a point-to-point tunnel.

  Note
The plugin enables IP forwarding on the host by default. No sysctl -w net.ipv4.ip_forward=1 instructions are required.


Edit a Custom Config


Delete a Custom Tunnel


How to configure a smartphone or PC

If the client is a smartphone (Android or iOS)

  Note
Depending on your router settings, the connection may not work if your smartphone is on the same Wi-Fi network as the server.
In that case, turn off Wi-Fi on your smartphone and use mobile data to test the connection.


If the client is a PC (Linux, macOS, or Windows)

Wireguard > Clients > Client config

  Note
Depending on your router settings, the connection may not work if the PC is on the same network as the server.
You can test by sharing a mobile data connection via Wi-Fi from your smartphone to the PC.


How to split the tunnel traffic

Useful if you want to access a remote network while still using your local network. This requires different network ranges for each network.


How to configure a Point-to-Point tunnel

Point-to-Point: Standard tunnel

Wireguard's point-to-point configuration creates a private connection between two peers, so they can communicate only with each other, without exposing any other devices on their local networks.

This setup is useful for scenarios such as remote backups between two servers. For example, a peer can access an rsync module on the other peer if provided with credentials.


Configuration of the first server (peer 1)

[Interface]
PrivateKey = Uses the previously generated TUNNEL PRIVATE KEY
ListenPort = 51500
Address = 10.15.15.1/32

[Peer]
PublicKey = Uses the previously generated CLIENT PUBLIC KEY
AllowedIPs = 10.15.15.2/32


Configuration of the second server (peer 2)

[Interface]
PrivateKey = Uses the previously generated CLIENT PRIVATE KEY
ListenPort = 51500
Address = 10.15.15.2/32

[Peer]
PublicKey = Use the previously generated TUNNEL PUBLIC KEY
AllowedIPs = 10.15.15.1/32
Endpoint = mydomain.com:51500
PersistentKeepalive = 25

Make sure the port is open on both routers and the domain points to peer 1's public IP.

Test the connection:

ping 10.15.15.2  # from peer 1
ping 10.15.15.1  # from peer 2

The response should be something similar to this:

ping 10.15.15.1 (10.15.15.1) 56 (84) bytes of data.
64 bytes from 10.15.15.1: icmp_seq = 1 ttl = 64 time = 30.6 ms
64 bytes from 10.15.15.1: icmp_seq = 2 ttl = 64 time = 30.7 ms
64 bytes from 10.15.15.1: icmp_seq = 3 ttl = 64 time = 29.6 ms
64 bytes from 10.15.15.1: icmp_seq = 4 ttl = 64 time = 28.9 ms
^ C
--- 10.15.15.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 8ms
rtt min / avg / max / mdev = 28.877 / 29.934 / 30.677 / 0.775 ms

If it doesn't work, check the domain and router port forwarding.


Point-to-Point: Two Endpoints variant (silent connection)

Peer 1:

[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ListenPort = 51500
Address = 10.15.15.1/32

[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AllowedIPs = 10.15.15.2/32
Endpoint = peer2.mydomain.com:51500

Peer 2:

[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ListenPort = 51500
Address = 10.15.15.2/32

[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AllowedIPs = 10.15.15.1/32
Endpoint = peer1.mydomain.com:51500


Point-to-Point: Firewall configuration with iptables

The default setup allows all ports. You can restrict communication using iptables.

Peer 1:

[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ListenPort = 51500
Address = 10.15.15.1/32

# Firewall
PreUp = iptables -A INPUT -i wgnet_pp_peer1 -m state --state ESTABLISHED,RELATED -j ACCEPT
PreUp = iptables -A INPUT -i wgnet_pp_peer1 -m state --state NEW -p tcp --dport 873 -j ACCEPT
PreUp = iptables -A INPUT -i wgnet_pp_peer1 -j REJECT
PostDown = iptables -D INPUT -i wgnet_pp_peer1 -m state --state ESTABLISHED,RELATED -j ACCEPT
PostDown = iptables -D INPUT -i wgnet_pp_peer1 -m state --state NEW -p tcp --dport 873 -j ACCEPT
PostDown = iptables -D INPUT -i wgnet_pp_peer1 -j REJECT

[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AllowedIPs = 10.15.15.2/32
Endpoint = peer2.mydomain.com:51500

Peer 2:

[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ListenPort = 51500
Address = 10.15.15.2/32

# Firewall
PreUp = iptables -A INPUT -i wgnet_pp_peer2 -m state --state ESTABLISHED,RELATED -j ACCEPT
PreUp = iptables -A INPUT -i wgnet_pp_peer2 -m state --state NEW -p tcp --dport 873 -j ACCEPT
PreUp = iptables -A INPUT -i wgnet_pp_peer2 -j REJECT
PostDown = iptables -D INPUT -i wgnet_pp_peer2 -m state --state ESTABLISHED,RELATED -j ACCEPT
PostDown = iptables -D INPUT -i wgnet_pp_peer2 -m state --state NEW -p tcp --dport 873 -j ACCEPT
PostDown = iptables -D INPUT -i wgnet_pp_peer2 -j REJECT

[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AllowedIPs = 10.15.15.1/32
Endpoint = peer1.mydomain.com:51500

PreUp = iptables -A INPUT -i wgnet_pp_peer1 -m state --state NEW -p tcp -m multiport --dports 80,443 -j ACCEPT
PostDown = iptables -D INPUT -i wgnet_pp_peer1 -m state --state NEW -p tcp -m multiport --dports 80,443 -j ACCEPT


How to Set up a free domain with DuckDNS and fix dynamic IP

www.duckdns.org If you need a domain, there are many ways to get one. One of them is provided for free by DuckDNS.

If your IP is dynamic, which is the most common case, it can change at any time. If this happens, you will lose the connection because the domain will point to an IP that is no longer your server’s. DuckDNS provides a simple dynamic IP update system to solve this.

Get a domain on DuckDNS

Dynamic IP update with DuckDNS on OMV

The original instructions can be seen here. www.duckdns.org/install.jsp.

Instead we will use the scheduled task execution in the OMV GUI to execute the instruction directly:

echo url="https://www.duckdns.org/update?domains=[MY_DOMAIN]&token=[MY_TOKEN]&ip=" | curl -k -o /var/log/duck.log -K -

  Note
This task will create a log file at /var/log/duck.log.


Update DuckDNS IP, receive notifications only when it changes, and restart the tunnel if needed

This script can be added to an OMV scheduled task. It will:

Useful for securing persistent connections between servers, e.g., for backups.

WireGuard tunnel naming in OMV-extras plugin

Summary:

Important: The TUNNELS variable in the scheduled task script must use these internal names to correctly check and reactivate the interfaces.

Script example:


DOMAIN="[MY_DOMAIN]"
TOKEN="[MY_TOKEN]"
TUNNELS="wgnet1 wgnet2 wgnet_backup"
UPDATED=0

# Update IP address in DuckDNS
curl -s -k "https://www.duckdns.org/update?domains=${DOMAIN}&token=${TOKEN}&ip=&verbose=true" | grep -q UPDATED && {
    echo "IP updated in DuckDNS"
    UPDATED=1
}

# Check tunnel status and reactivate if needed
for TUNNEL in $TUNNELS; do
    ip link show "$TUNNEL" >/dev/null 2>&1 || {
        echo "WireGuard $TUNNEL down, reactivating..."
        systemctl start wg-quick@"$TUNNEL" || exit 1
        UPDATED=1
    }
done

[ "$UPDATED" -eq 1 ] && echo "CHANGES APPLIED" || true

How to use:


Common Problems

I can't connect to the network from outside


The connection works, I receive data, but I cannot access the network

Set the value AllowedIPs = 0.0.0.0/0 and check if you have access. If so, you can now proceed to customize the network range. If after customizing the network range you lose access, you haven't done it right.


I have set the same settings on the smartphone and the laptop and it only works on one

If you need two accesses from two or more clients, you must configure a different connection for each client. If you establish the same configuration on different clients, only one of them will work, they will never work simultaneously.


I can't access my shared folders

Sometimes domain name resolution may not work. If this is the case, try accessing through your server's IP instead of the domain name.


I can't access the internet from my client

If you can access your local network from the client but cannot access the internet, try splitting the tunnel traffic. Connections directed to your local network would go through the Wireguard tunnel, the rest of the connections would go through your smartphone's standard network interface accessed by the laptop. To do that you must do it like this:


I can't access some of my containers. MacVLAN.

If you have containers configured using a MacVLAN network interface, you won't be able to access them using Wireguard. Containers with this configuration can't communicate with the host, so Wireguard can't access them either. This is a limitation of the Linux kernel.

There are workarounds, but they're beyond the scope of this document; please refer to the Docker documentation.


I can access my LAN, but I don't have internet access.

We've received reports of some Mac clients where the network remains split even with AllowedIPs = 0.0.0.0/0 set. This results in the client being unable to access the internet.

Try adding a generic DNS to your Wireguard tunnel on the client. Something like DNS = 1.0.0.1 or DNS = 8.8.8.8 might work.


Source Code

openmediavault-wireguard


A Closing Note

We, who support the openmediavault project, hope you’ve found this guide to be useful and that you’ll find your openmediavault server to be efficient, easy to use, and enjoyable.

If you found this plugin guide to be helpful, please consider a modest donation to support the hosting costs of this server.

OMV-Extras.org



Venmo: ryecoaaron