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.
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/ | |
Optional fields for custom configurations:
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o [NETWORK INTERFACE] -j MASQUERADEPostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o [NETWORK INTERFACE] -j MASQUERADE| Note | |
The plugin enables IP forwarding on the host by default. No need to add sysctl -w net.ipv4.ip_forward=1.
| |
192.168.1.0/24 MTU=1420). Adjust if needed; wg-quick does not support below 1280.
| 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. | |
0.0.0.0/0 and all client traffic goes through the tunnel. 0.0.0.0/0. 0.0.0.0/0.
| Note | |
| Any changes made must be applied again on the client using the QR code or configuration file for them to take effect. | |
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.
wgnet_NAME where NAME is your chosen name. 10.192.x.x network range used by the plugin in Tunnel and Client tabs, to prevent conflicts. /etc/wireguard.
| 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.
| |
| 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. | |
.conf extension on the PC..conf file and click OK.
| 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. | |
Useful if you want to access a remote network while still using your local network. This requires different network ranges for each network.
0.0.0.0/0 routes all traffic through the tunnel. 0.0.0.0/0 with a specific subnet. For example, 192.168.1.0/24 forwards only traffic to the 192.168.1.x network through the 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.
[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
[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.
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
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
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.
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:
curl installed on your system. If not, install it first:apt install curl curl.
echo url="https://www.duckdns.org/update?domains=[MY_DOMAIN]&token=[MY_TOKEN]&ip=" | curl -k -o /var/log/duck.log -K -
[MY_DOMAIN] with your chosen DuckDNS subdomain. [MY_TOKEN] with the token assigned to your account. DuckDNS_DDNS.
| Note | |
| This task will create a log file at /var/log/duck.log. | |
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
wgnet1wgnet2 …wgnet_.pp, its internal name will be wgnet_pp.backup, its internal name will be wgnet_backup.Summary:
wgnet1, wgnet2 …wgnet_<your_custom_name>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:
DOMAIN="[MY_DOMAIN]"; TOKEN="[MY_TOKEN]"; TUNNELS="wgnet1 wgnet_backup"; UPDATED=0; 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; }; 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
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.
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.
Sometimes domain name resolution may not work. If this is the case, try accessing through your server's IP instead of the domain name.
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:
AllowedIPs = 0.0.0.0/0 with this AllowedIPs = 192.168.1.0/24 (assuming that the scope of your local network is that, adapt it to your case)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.
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.
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