Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Virtual private networks
»
Wireguard client disconnect in Opensense 24.1
« previous
next »
Print
Pages: [
1
]
Author
Topic: Wireguard client disconnect in Opensense 24.1 (Read 3201 times)
HTop
Newbie
Posts: 1
Karma: 0
Wireguard client disconnect in Opensense 24.1
«
on:
February 01, 2024, 12:53:17 am »
Identified Wireguard VPN client disconnect issue with upgrade from 23.7.12 to 24.1 to VPN providers. Only way to resolve issue is to restart Wireguard (Disable / Enable in Wireguard Settings)
24.1 Release Notes state the following:
- wireguard: installed by default using the bundled FreeBSD 13.2 kernel module
- core inclusion of the os-firewall and os-wireguard plugins
(os-wireguard plugins are no longer available in v24.1.)
A disconnect of Router WAN port (ADSL2+ which is very unstable in remote location) causes the VPN tunnel to fail (100%). v23.7.12 had the same issue but reverted to the older os-wireguard-go plugin (non kernel version) to resolve the issue. Only way to fix issue is to fully restart wireguard service on every WAN disconnect. Also setup CRON job to restart FW every 24 hours as small workaround to issue.
Investigated numerous fixes to resolve issue including adjusting MTU, keepalives, inspecting routes etc. Nothing has resolved the issue. V24.1 no longer has option to revert to os-wireguard-go package. Opensense has been working well through multiyear upgrades, so unlikely to be fundamental configuration error.
https://forum.opnsense.org/index.php?topic=33927.0
On error, the gateway configuration will show the status of the WG VPN tunnel as "offline" (see attached screenshot).
On restart of the VPN connection, error in VPN logs:
/usr/local/opnsense/scripts/Wireguard/wg-service-control.php: The command '/sbin/route add -'inet' '10.25.169.200' -interface 'wg3'' returned exit code '1', the output was 'add host 10.25.169.200: gateway wg3 fib 0: route already in table'
Suggestions for fix will be welcome. Happy to experiment as Opensense running as Proxmox VM with snapshots, so rollback of a broken config is very easy.
«
Last Edit: February 01, 2024, 01:30:07 am by HTop
»
Logged
mtltt
Newbie
Posts: 15
Karma: 1
Re: Wireguard client disconnect in Opensense 24.1
«
Reply #1 on:
March 10, 2024, 10:16:41 pm »
I have the same problem and figured out, that a stale state is the problem. OPNsense doesn't kill/reset all states when WAN goes down/up. Manually clearing all states/the VPN connection states (Firewall->Diagnostics->States) is resolving this for me. But this is just a bad workaround and not a fix.
This also helps me in my dual WAN failover setup. When the backup connections kicks in, I get the same problem. The WireGuard client doesn't reconnect automatically, because it is in a stale state.
I tied to automate the state resetting with Monit and gateway alerts, but couldn't get it working.
Logged
freegoer
Newbie
Posts: 6
Karma: 0
Re: Wireguard client disconnect in Opensense 24.1
«
Reply #2 on:
March 20, 2024, 07:17:29 pm »
I am experiencing the same issue when WG client gets disconnected. Unable to reconnect until I restart the WG service on OPNSense. Happy to help troubleshoot if anyone has ideas for a fix.
Update 3/27/2024: I have ZenArmor running on my FW. I disabled it on the roadwarrior WG interface that I was experiencing WG reconnect issues and the issue seems to have gone away for now. I will update if anything changes.
«
Last Edit: March 27, 2024, 10:24:49 pm by freegoer
»
Logged
vinet
Newbie
Posts: 5
Karma: 0
Re: Wireguard client disconnect in Opensense 24.1
«
Reply #3 on:
April 04, 2024, 12:19:00 pm »
OPNsense 24.1.4-amd64
i had similar error with routing adding. (Error wireguard /usr/local/opnsense/scripts/Wireguard/wg-service-control.php: The command '/sbin/route -q -n add -'inet' )
i fixed also the - "os-wireguard (missing)"
in System - Frimware - Plugins
also i found in the peerings my ip that dosent work double listed, so my fault and sure that it doesnt work. The Tunnel Adress was reachabl at any time also the handshakes worked.
Logged
LovelyCupOfTea
Newbie
Posts: 14
Karma: 0
Re: Wireguard client disconnect in Opensense 24.1
«
Reply #4 on:
April 04, 2024, 09:37:11 pm »
I've had endless issues setting up wireguard in both opnsense and pfsense
Gave up and used openwrt on a gl.inet and it took about 5 min
Logged
mtltt
Newbie
Posts: 15
Karma: 1
Re: Wireguard client disconnect in Opensense 24.1
«
Reply #5 on:
June 16, 2024, 11:47:17 am »
I have finally "solved" this problem with the following workaround:
I use Monit to ping the IP address of the WireGuard server. If the connection is stale, WireGuard is restarted.
To do this, you need the following Monit settings:
WireGuard instance id:
You need the ID (UUID) of the WireGuard instance that should be restarted when it becomes stale. I couldn't find an easy way to get the UUID. So I opened the developer tools in the browser on the WireGuard instance page and inspected the 'Edit' button of the instance I wanted to be restarted when stale. The edit button had the UUID embedded in the HTML tag (data-row-id="<instance uuid>")
Monit:
1. Service settings:
Add test:
- Condition: failed ping4 count 3 with timeout 3 seconds for 2 cycles
- Action: Execute
- Path: /usr/local/bin/bash -c '/usr/local/opnsense/scripts/Wireguard/wg-service-control.php restart <ID of the WireGuard instance>'
Note: the usr/local/bin/bash -c '<command>' is the important part. I could not get it to work with the direct command.
2. Add a service:
- Type: "Remote Host"
- Address: <the WireGuard server's IP address>.
- Tests: <the defined ping test>
Result:
If the ping of the WireGuard server's IP address fails 3 times with a timeout of 3 seconds for 2 times, the WireGuard instance is restarted.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Virtual private networks
»
Wireguard client disconnect in Opensense 24.1