I would like to use mikrotik as dns server for my network.
The DNS server is configured with 2 remote DNS servers.
10.21.1.1 is the primary DNS Server behind a site-to-site IPSec Tunnel.
192.168.0.2 is secondary DNS Server. I would like to use this DNS Server as fallback when VPN-tunnel is down (not accessible).
But sometimes mikrotik useses the secondary DNS server before primary DNS server.
Is this a bug?
How can i solve my use case?
DNS doesn’t behave that way - at least not in the spec. When you give a list of resolvers, then a DNS client may (and usually will) float between both of them at random. It’s considered to be a load sharing mechanism.
No - because the Mikrotik resolver is intended to be a simple caching proxy resolver. Some people use it as a light-weight authoritative DNS server, but it really isn’t built for that job. (I wish it would add static entries for DHCP clients, especially in an IPv6 world)
The static host name feature exists so that you can place a few strategic entries, especially for captive portals. It works okay even with a decent list of static host names, but don’t lose sight of the fact that this is NOT a DNS server - just a caching proxy. If you want to keep two of them synchronized, then you need to add the data to both of them separately. There is no mechanism in ROS for automatic sync. Again, it’s not an actual DNS server.
This would be perfect for my branch office with an IPSEC vpn, except I cant get the router itself to route packets over the VPN so the script always things host is down, anyone have some clues how to do that, tried a mangle rule but no luck.
(that layer7 solution mentioned suffers same limitation)
Replace 192.168.0.0/24 with remote subnet and bridge-lan with your lan interface/bridge name.
This will not fix your L7 problem as locally initiated connections will never be dstnatted and connections from LAN already have the correct source address. You may post your L7 solution for further review (with network overview and expected behavior).
You are notracking your ipsec traffic, but not allowing them in filter. Established/related traffic will no pick up traffic because of notrack.
Either add an allow for ipsec-policy=in or remove the notrack rules to enable connection tracking for ipsec traffic.
Also add a default drop rule on in-interface=pppoe-out1 in forward chain for security reasons.