Understood, I didnt realize that if I had static entries they would be ignored if I set gw dhcp dns-server to none.
It is not clear to me HOW static entries are then advertised to devices:???
In other words what is the difference between
dns-server=no-server
/ip dns
set servers=10.44.44.1,1.1.1.1
AND
dns-server=no-server
/ip dns
set allow-remote-requests servers=10.44.44.1,1.1.1.1
AND
dns-server=no-server
/ip dns static
add address=10.44.44.1 type=A
add address=1.1.1.1 type=A
Why does the first one work, no advertisement by gateway DNS to the users and with dynamic servers in IP DNS works but in the third case case Static Servers dont. And does the second case mirror the first case except allow the router to cache results??
+++++++++++++++++++++++++++++++++++++++
Secondly, my concern was to apply knowledge of a simple case of one subnet with two choices local internet or wireguard internet and ensuring that while on wireguard internet NO DNS leakage occurred through local WAN. Also the scenario requested a manual switch of one choice to the other.
So I settled on:
/routing table
add fib name=useWG
/routing rules { order of rules is important }
add action=lookup-only-in-table src-address=192.168.88.0/24 dst-address=192.168.88.0 table=main comment=“ensures local traffic not affected”
add action=lookup-only-in-table src-address=192.168.88.0/24 table=useWG
/ip route
add dst-address 0.0.0.0/0 gateway=isp-gateway-ip routing-table=main
add dst-address=0.0.0.0/0 gateway=wg0 routing-table=useWG
add check-gateway=ping dst-address=10.10.30.1 gateway=wgO routing-table=main { informs router as to the availability of WG server IP }
/routing table
add fib name=useWG
/routing rules { order of rules is important }
add action=lookup-only-in-table src-address=192.168.88.0/24 dst-address=192.168.88.0 table=main comment=“ensures local traffic not affected”
add action=lookup-only-in-table src-address=192.168.88.0/24 table=useWG[/i]
+++++++++++++++++++++++++++++++
To manually select users go from wireguard to local WAN for internet ( assumes wg is working fine), simpley DISABLE WIREGUARD INTERFACE.
To manually select users go from local WAN to wireguard for internet simply ENABLE WIREGUARD INTERFACE.
Besides that to ensure DNS does not leak ADD two rules
/ip firewall nat
add chain=dstnat action=dst-nat src=address=192.168.88.0/24 dst-port=53 protocol=udp to-address=wireguard-provided-DNS-IP
add chain=dstnat action=dst-nat src=address=192.168.88.0/24 dst-port=53 protocol=tcp to-address=wireguard-provided-DNS-IP
Note: If the wireguard-provided-dns-ip is not within the wireguard subnet, then an additional route would be required.
add dst-address=wireguard-provided–dns- ip gateway=wg0 routing-table=main
So in addition to enabling and disabling the interface, when selecting WG for the LAN one has to also enable the two dstnat rule and vice versa
Happy you asked?? 