• Notice regarding image hosts and attachments. See here.

OPNsense DNS failover problem

Associate
Joined
18 Dec 2008
Posts
800
I am having a problem with OPNsense WAN failover.

I have an EE and VM internet connections, primary is EE.

The EE connection went down briefly but connection did not failover.

It turns out OPNsense is using my VM connection for DNS despite it being the secondary network.

Since the VM connection was still OK my firewall did not fail over despite not being able to download webpages

How do I force OPNsense to use DNS on the EE connection?

I need Unbound DNS overrides to work as part of any solution.
 
Last edited:
Screenshot From 2026-08-30 11-07-38.webp
AI suggests I remover WAN_GW(Virgin media) from DNS Server on this page) would this be correct?

Does the order on which the DNS server are listed decide when each DNS is used?

Tried it did not work :-(
 
Last edited:
I have never used this product but I wouldn't remove your primary WAN DNS entries.

Surely the logic should properly attempt to use the DNS servers configured with their respective gateways. If the gateway is unavailable it should ultimately hit the failover entries.

Is there any official documentation?

Im also a little confused...surely with the EE connection down the use of your VM DNS is exactly what you want to occur?

Are you saying the WAN didn't failover because the DNS server was still contactable via VM?

You need to establish what the failover logic is and whether it is configurable. I suspect the configured DNS servers might be a red herring here as arguably DNS is independent to your WAN being available.

Edit:

This guide - https://chrisbeckman.dev/posts/opnsense-multi-wan-failover

Suggests you need to set a monitor address for each WAN gateway and also talks about configurable thresholds for failover. It also makes some recommendations for certain settings. I would review your configuration there first before turning to DNS.
 
Last edited:
I agree with you that should be how it works, but a system called dpinger decides which WAN is more stable directing all DNS traffic through VM Gateway.

Actual internet data still comes through the EE Gateway and downloads and ping are just fine

I have tried a couple of AI hallucination fixes that did not work,

1) Poisoning the VM Gateway monitoring IP with a rubbish DNS provider to make the EE connection look more better/stable.
2) Setting up a firewall rule to send DNS queries through the GatewayGroup, but that broke DNS and I had to remove it.

Its annoying as I didn't have this problem (or realise it was a problem) before my switch to EE

The thought has just occurred to me that maybe rebooting the VM hub might trigger dpinger to switch.

I will report back soon
 
I agree with you that should be how it works, but a system called dpinger decides which WAN is more stable directing all DNS traffic through VM Gateway.

What trigger have you configured and at what thresholds?

Have you read the official documentation? (https://docs.opnsense.org/manual/how-tos/multiwan.html)

Inparticular your WAN needs the 'Mark Gateway as Down' option unset along with the other configuration requirements.(Firewall Rules for DNS and specific config for your unbound)
 
Last edited:
I am using packetloss as threshold Gateway down was unchecked and it appeared to work just fine when I configured it for originally for Zen Internet.

It appears that dpinger is my problem as it is not using the monitor IP to check if gateway is live making it default to VM gateway.

Turning off the VM hub actually worked until it rebooted then it defaulted back to VM gateway instantly.

much later on...

I do not know why but it started to work properly with DNS going over my EE gateway and it now has a (active) besides its name in gateways menu whereas it used to only show on my beside my Virgin Media gateway name.

dpinger still reports the wrong monitor IP addresses, but at least it works now.

Completely out of my depth lol

I have asked for help on the OPNsense forums to see if anyone there can shine some light on what was going on.
 
Why not just run Unbound on OPNsense (and possible even AdGuard home in front of that) then your DNS is agnostic of connection. Then just set the gateway pinger to use the first address in a tracert (**Edit:Clarification** the first one after the gateway IP) for each WAN connection?
 
Last edited:
Might be related but I know that OPNSense will not gracefully fail back when a link comes back up (you need to clear the state table)
 
Why not just run Unbound on OPNsense (and possible even AdGuard home in front of that) then your DNS is agnostic of connection. Then just set the gateway pinger to use the first address in a tracert (**Edit:Clarification** the first one after the gateway IP) for each WAN connection?
Thank you, I am only familiar with the overrides in Unbound not sure how to work that.

Might be related but I know that OPNSense will not gracefully fail back when a link comes back up (you need to clear the state table)
I think you are right about the state table, must have inadvertently reset it playing around with gateway settings causing DNS to start working on the correct WAN.

Not sure if the DNS problem is related to the failover issue or just some odd routing anomaly I came across while looking for a solution.

dpinger is actually working correctly after all. I discovered ssh terminal does not wrap around text so I was missing the end of the lines doh.
 
Last edited:
Might be related but I know that OPNSense will not gracefully fail back when a link comes back up (you need to clear the state table)

This does ring a bell but it's been donkey's years since I administrated OPNsense / pfsense - that said I'm no network engineer (tbh quite frankly my weakest skill and I find it boring)

I recall -
Failover worked
but fallback fails ... I think I did a bodge job by writing a script to bump down and up the interfaces when a fallback is required. Effectively this would have cleared the state table too but good to know that it's the state table that's at fault that should give you enough data to identify which state is blocking the fail back. (I would see if it's the health check itself !)
Good luck man, rather you than me :cry:
 
Last edited:
Back
Top Bottom