Community discussions

MikroTik App
 
thj81
just joined
Topic Author
Posts: 6
Joined: Fri Apr 05, 2024 8:35 am

Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 8:42 am

Hello,

I have my own Private DNS instance (AdGuard Home) which I NAT over Mikrotik and port 853. On my phone under Private DNS I have my domain that points to Mikrotik WAN address. It is working correctly until I enable Back to Home connection on my phone. I get a message that Private DNS address is not reachable.

How can I debug and resolve this? I would appreciate all the help.

Firewall rules:
add action=accept chain=input comment="DNS over TLS" dst-port=853 protocol=\
    tcp
add action=accept chain=forward comment="DNS over TLS" dst-port=853 protocol=\
    tcp
NAT rules:
add action=dst-nat chain=dstnat comment="AdGuard DNS over TLS" disabled=yes \
    dst-address=!192.168.28.0/24 dst-address-type="" dst-port=853 protocol=\
    tcp to-addresses=192.168.28.21 to-ports=853
add action=dst-nat chain=dstnat comment="AdGuard DNS over TLS" dst-address=\
    !192.168.28.0/24 dst-address-type="" dst-port=853 protocol=tcp \
    src-address-list=T2_supernet to-addresses=192.168.28.21 to-ports=853
add action=dst-nat chain=dstnat comment="AdGuard DNS over TLS" dst-address=\
    !192.168.28.0/24 dst-address-type="" dst-port=853 protocol=tcp \
    src-address-list="Ekonomska statika" to-addresses=192.168.28.21 to-ports=\
    853
Thank you.
 
TheCat12
Member Candidate
Member Candidate
Posts: 189
Joined: Fri Dec 31, 2021 9:13 pm

Re: Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 9:52 am

Does at least one of the address lists contain the BTH subnet address? If not, add it
 
thj81
just joined
Topic Author
Posts: 6
Joined: Fri Apr 05, 2024 8:35 am

Re: Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 10:04 am

Does at least one of the address lists contain the BTH subnet address? If not, add it
I have added BTH subnet 192.168.216.0/24 to T2_supernet access list. Sadly it did not help.
 
TheCat12
Member Candidate
Member Candidate
Posts: 189
Joined: Fri Dec 31, 2021 9:13 pm

Re: Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 10:20 am

Then try and add the DNS server in the BTH App config:

Create/Select Tunnel -> ⋮ -> DNS Server
 
thj81
just joined
Topic Author
Posts: 6
Joined: Fri Apr 05, 2024 8:35 am

Re: Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 10:24 am

Then try and add the DNS server in the BTH App config:

Create/Select Tunnel -> ⋮ -> DNS Server
Ha. I have remove the IP 192.168.261.1 under DNS server in my tunnel settings on the phone and Private DNS started working and I can see AdGuard catching the domain resolving. Is this correct way? To remove "optional" DNS server from tunnel config? Does it make sense?
 
TheCat12
Member Candidate
Member Candidate
Posts: 189
Joined: Fri Dec 31, 2021 9:13 pm

Re: Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 10:26 am

Yes, it makes a lot of sense and in your case it's the correct way. After all it says it's optional :)
 
thj81
just joined
Topic Author
Posts: 6
Joined: Fri Apr 05, 2024 8:35 am

Re: Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 10:33 am

But why it did not access my Private DNS domain if I set the DNS to Mikrotik BTH IP address (192.168.216.1)? All DNS resolving goes over Private DNS address and if tunnel has DNS set to BHT address it should still resolve it. Sorry. Just want to understand the changes I make :).
 
TheCat12
Member Candidate
Member Candidate
Posts: 189
Joined: Fri Dec 31, 2021 9:13 pm

Re: Private DNS behind NAT and Back to Home VPN

Fri Apr 05, 2024 10:47 am

I assume there is a conflict between the Private DNS you've set up and the one in the BTH settings because both point to the server (one through WAN and one through the WG subnet) and when you connect to BTH, it is as if you're on the LAN level so one connection to WAN and one to LAN would result in the aforementioned conflict

Who is online

Users browsing this forum: No registered users and 14 guests