Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Virtual private networks
»
How to get a second wireguard tunnel working?
« previous
next »
Print
Pages: [
1
]
2
3
Author
Topic: How to get a second wireguard tunnel working? (Read 5045 times)
hushcoden
Hero Member
Posts: 548
Karma: 23
How to get a second wireguard tunnel working?
«
on:
September 08, 2023, 10:48:40 am »
After crashing my head for several days
I managed to get wireguard working, and now I'd like to add a second tunnel for failover: is there a guide for dummies I can follow?
Tia.
Logged
Maurice
Hero Member
Posts: 1213
Karma: 158
Re: How to get a second wireguard tunnel working?
«
Reply #1 on:
September 08, 2023, 07:34:46 pm »
Depends. Tunnel for Internet access, site-to-site or road warriors?
Logged
OPNsense virtual machine images
OPNsense aarch64 firmware repository
Commercial support & engineering available. PM for details (en / de).
hushcoden
Hero Member
Posts: 548
Karma: 23
Re: How to get a second wireguard tunnel working?
«
Reply #2 on:
September 08, 2023, 08:17:25 pm »
Just Internet access
Logged
Maurice
Hero Member
Posts: 1213
Karma: 158
Re: How to get a second wireguard tunnel working?
«
Reply #3 on:
September 08, 2023, 10:19:38 pm »
If both tunnels use the same local config (private key and tunnel addresses), you just have to add a second endpoint. Only enable one endpoint at any given time.
Otherwise, you'll have to duplicate everything. Local config, endpoint, interface assignment, gateway etc.
Cheers
Maurice
Logged
OPNsense virtual machine images
OPNsense aarch64 firmware repository
Commercial support & engineering available. PM for details (en / de).
hushcoden
Hero Member
Posts: 548
Karma: 23
Re: How to get a second wireguard tunnel working?
«
Reply #4 on:
September 08, 2023, 10:45:48 pm »
I've configured the second endpoint, local, gateway, interface and only I need is to configure wireguard in a way that when the wg1 connection is down, wg2 takes over...
Logged
Maurice
Hero Member
Posts: 1213
Karma: 158
Re: How to get a second wireguard tunnel working?
«
Reply #5 on:
September 08, 2023, 10:51:42 pm »
Enable both wg instances and endpoints, create a gateway group and use this group in your pbr firewall rules.
Logged
OPNsense virtual machine images
OPNsense aarch64 firmware repository
Commercial support & engineering available. PM for details (en / de).
hushcoden
Hero Member
Posts: 548
Karma: 23
Re: How to get a second wireguard tunnel working?
«
Reply #6 on:
September 08, 2023, 11:34:35 pm »
Now, for the life of me I can't understand why the second tunnel gateway is offline although if I go in wireguard -> diagnostics I see there is handshake...
Logged
hushcoden
Hero Member
Posts: 548
Karma: 23
Re: How to get a second wireguard tunnel working?
«
Reply #7 on:
September 08, 2023, 11:57:12 pm »
I've found out that in the gateway section, when I change the monitor IP address the tunnel shows offline: if I use 10.2.0.1 the tunnel shows online but anything else like 10.2.0.x takes the tunnel offline - 10.2.0.1 is the DNS IP address provided by ProtonVPN.
Any suggestions?
Logged
Maurice
Hero Member
Posts: 1213
Karma: 158
Re: How to get a second wireguard tunnel working?
«
Reply #8 on:
September 09, 2023, 12:44:13 am »
Make sure not to use the same monitor IP for both. Ping distinct public addresses instead, like 1.1.1.1 and 1.0.0.1. Using unique gateway IP addresses might be required, too (they're arbitrary anyway). Last, you can remove the /28 from the tunnel addresses to avoid having two interfaces with the same subnet (might not be strictly required though).
Logged
OPNsense virtual machine images
OPNsense aarch64 firmware repository
Commercial support & engineering available. PM for details (en / de).
hushcoden
Hero Member
Posts: 548
Karma: 23
Re: How to get a second wireguard tunnel working?
«
Reply #9 on:
September 09, 2023, 01:00:50 pm »
Great, thanks, it seems the gateway group is working.
I was watching the gateway stats for a few minutes for both tunnels, and noticed they fluctuate a lot, i.e. from online they go to packet loss then back to online: should I be concerned or it's normal? I've set the tunnel MTU for both at 1412, does it matter at all?
Also, do I have to use any rules at all in Firewall -> WireGuard (Group)?
In Firewall -> NAT -> Outbound, I've created just one rule for the interface WireGuard (Group), but I don't know if that's the correct setting or I have to create two separate Outbound rules, one for wg1 and one for wg2 ?
«
Last Edit: September 09, 2023, 01:08:29 pm by hushcoden
»
Logged
Maurice
Hero Member
Posts: 1213
Karma: 158
Re: How to get a second wireguard tunnel working?
«
Reply #10 on:
September 09, 2023, 01:10:46 pm »
Packet loss is not normal, no. Did this start after adding the second wg interface? No packet loss before? You could try different monitor IPs.
No, you don't need any firewall rules since this is essentially a WAN interface. Everything outbound is allowed and anything inbound is blocked by default.
Logged
OPNsense virtual machine images
OPNsense aarch64 firmware repository
Commercial support & engineering available. PM for details (en / de).
hushcoden
Hero Member
Posts: 548
Karma: 23
Re: How to get a second wireguard tunnel working?
«
Reply #11 on:
September 09, 2023, 01:26:23 pm »
For the monitor IPs, I'm using Proton servers IP addresses (I believe it makes no difference from the Cloudflare or Google ones).
Another thing I noticed in the log is that pings from those servers towards the two locals are blocked, can this be an issue?
«
Last Edit: September 09, 2023, 01:31:42 pm by hushcoden
»
Logged
Maurice
Hero Member
Posts: 1213
Karma: 158
Re: How to get a second wireguard tunnel working?
«
Reply #12 on:
September 09, 2023, 03:21:01 pm »
Are 146.70.83.66 / 146.70.96.66 your monitor IPs? But these are also the endpoint IPs, right? That won't work.
Logged
OPNsense virtual machine images
OPNsense aarch64 firmware repository
Commercial support & engineering available. PM for details (en / de).
hushcoden
Hero Member
Posts: 548
Karma: 23
Re: How to get a second wireguard tunnel working?
«
Reply #13 on:
September 09, 2023, 05:13:08 pm »
Ah okay, I can use Cloudflare or Quad 9 then, but exactly what won't work? Thanks
And I noticed that with one tunnel the connection is pretty stable but with two tunnels the devices lose Internet time by time
Logged
Maurice
Hero Member
Posts: 1213
Karma: 158
Re: How to get a second wireguard tunnel working?
«
Reply #14 on:
September 09, 2023, 05:32:38 pm »
The monitor IP must be routed through the tunnel, the endpoint IP mustn't. The tunnel can't be routed through itself.
Logged
OPNsense virtual machine images
OPNsense aarch64 firmware repository
Commercial support & engineering available. PM for details (en / de).
Print
Pages: [
1
]
2
3
« previous
next »
OPNsense Forum
»
English Forums
»
Virtual private networks
»
How to get a second wireguard tunnel working?