26.1.X Wireguard - add net default: gateway Invalid argument

Started by systeme, April 21, 2026, 09:20:23 AM

Previous topic - Next topic
Hello,

Since upgrading to version 26.1.2 (or 26.1.7), we've been seeing this error in the WireGuard logs at startup:

2026-04-21T07:59:30
Error
wireguard
/usr/local/opnsense/scripts/wireguard/wg-service-control.php: The command </sbin/route add -'inet' default 'IP_WAN_GATEWAY'> returned exit code 1 and the output was "add net default: gateway IP_WAN_GATEWAY fib 0: Invalid argument"

Configuration IP_WAN_GATEWAY :



The priorities on the gateways have been changed since the last changelog (26.1.2), but the same errors persist.



Opnsense is virtualized, so there are no groups to configure at the gateway level.

Do you have any suggestions on how to avoid this error in the future?

Thank you in advance,

Best regards,



you add this under wireguard instance > advanced > gateway to resolve that error
DEC740 > USW-Pro-8-PoE> U6-Enterprise
Dec670. Retired / backup device

Quote from: systeme on April 21, 2026, 09:20:23 AMSince upgrading to version 26.1.2 (or 26.1.7)
More and more people from the future lately... LOL!

This is the latest Community Release : https://forum.opnsense.org/index.php?topic=51570.0 = 26.1.6 ;)
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)

Quote from: DEC740airp414user on April 21, 2026, 01:29:27 PMyou add this under wireguard instance > advanced > gateway to resolve that error

Indeed, the gateway field is empty on the WireGuard instances.

If I set the IP_WAN_GATEWAY under WireGuard instance > Advanced > Gateway, I have to disable route forwarding.



But since we use RIP for automatic route propagation on our WireGuard tunnels, won't that cause a problem?

We're following this documentation: https://docs.opnsense.org/manual/how-tos/wireguard-client.html

There's a "Dynamic gateway policy" checkbox on the interface—maybe that could be the solution to these errors?



Thanks for your help.

"There's a "Dynamic gateway policy" checkbox on the interface—maybe that could be the solution to these errors?"

for my wireguard i do exactly that.

it enables gateway monitoring.    i also click disable routes as well
DEC740 > USW-Pro-8-PoE> U6-Enterprise
Dec670. Retired / backup device