0

Nextdns CLI bypassed by DNS53 queries + Android DoT problem

Hi,

 

I have an Asus router with Merlin on it. I installed nextdns cli, which works beautifully. On the other hand, I noticed that explicit queries to a DNS53 dns, bypass nextdns CLI. For instance: 

[xxx@xxxxx ~]$ nslookup google.com 8.8.8.8
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.215.174
Name:   google.com
Address: 2a00:1450:4003:803::200e

Indeed, these queries don't appear in nextdns logs.

 To solve this problem, I tried to activate DNS Director in Merlin, but doing so nextdns DoT on my android phone doesn't work anymore when I'm at home (obviously, as DNS Director blocks port 853).

Is there a way to avoid plain dns queries to bypass nextdns CLI without relying on DNS Director (or using it)?

 

Thanks a lot in advance.

13 replies

null
    • Calvin_Hobbes
    • 2 wk ago
    • Reported - view

    You need a firewall rule to block outbound traffic to port 53.  
     

    OTOH, users can always use DOH which uses port 443 (https)

      • Eb_Na
      • 2 wk ago
      • Reported - view

        Thanks. I ended resorting to a couple iptables rule on my router. but I'd like if there was a cleaner solution.

      • Calvin_Hobbes
      • 2 wk ago
      • Reported - view

       how could it be possible to have a cleaner solution?  There’s no magic wand to block DOH.   That’s one of the reasons for DOH.

      • Eb_Na
      • 2 wk ago
      • Reported - view

       I didn't say anything about blocking DoH. My problem is with plain DNS on port 53, which bypasses nextdns CLI and using  DNS Director on my router (to avoid this byoass) breaks DoT on my phone in LAN. My phone, Android, doesn't support DoH natively.

      By "cleaner" I just meant some workaround using the router UI.

      • Charlestephen
      • 2 wk ago
      • Reported - view

       Ideally, you’d want a DNAT rule that remaps any DNS queries on port 53 not directed to your router to go to your router. This is what I did, but I am running a fairly robust networking solution that allows that. To block DoT, turn on DNS redirector. DoH is nearly impossible to block without querying major known public DNS providers, recording the IPs, then blocking their IPs (I also do this—I’m currently blocking about 5000 public DoH provider IPs).

      • Eb_Na
      • 2 wk ago
      • Reported - view

       

      > You’d want a DNAT rule that remaps any DNS queries on port 53 not directed to your router to go to your router.

       

      I ended up doing this. But IMHO nextdns CLI shout set these rules automatically, upon activation.

      • Calvin_Hobbes
      • 2 wk ago
      • Reported - view

       the nslookup example you gave is intentionally bypassing your router.  I figured you were trying to prevent users from getting around NextDNS to reach hosts that you want to block and/or log.   If you want devices on your network to use NextDNS, then configure your clients to use your router’s DNS service by using  DHCP or manual configuration.  I’m confused on what you want to accomplish.   

      • Eb_Na
      • 2 wk ago
      • Reported - view

        My clients are already configure like you say and they all use NEXTDNS. I just wanted to check if a simple DNS53 query could bypass nextdns CLI (which is the case). Anyway, I somewhat solved the problem with iptables on my router.

      • Charlestephen
      • 2 wk ago
      • Reported - view

       Meant to comment here instead of responding to the entire post. But yeah, that would be fairly tricky for NextDNS to implement using their command line tool because of all the different hardware it needs to work on and it wouldn’t be able to respect control guis like I have that tell me what firewall rules are implemented. Plus, they definitely have more pressing concerns (like updating their super old lists).

      • Charlestephen
      • 2 wk ago
      • Reported - view

       Ah, I have sort of the reverse. I configured NextDNS on my router and then implemented DNS DNAT redirection rules so all port 53 standard DNS requests to any server that is not my router are automatically redirected to my router with the resultant response seemingly coming from the expected server (that is, if the client sent it to 1.1.1.1, it comes back as if the response were from 1.1.1.1) and the client is none the wiser. I have furthermore blocked DNS over TLS requests with a firewall rule blocking the port.

      More comprehensively, I’ve blocked most public DNS over HTTPS server’s IP addresses (besides my specific NextDNS servers) that I could find online. I used some publicly available DoH server lists that are fed into a script to get the resultant IPs, which said scripts pushes into a firewall rule on my router. Im currently blocking about 7,000 IPs from returning DoH results to clients inside my network (excepting the firewall, which is where the script is run). Ive set this up as a cron job on my router so that it will automatically update IP addresses as they change or as the feeder lists get new results due to additional servers being added to their lists.  Its not perfect, but its fairly robust and blocks the obvious/easiest/most likely DoH providers while also blocking a lot of not so obvious/easiest/likely results as well. Its almost certainly overkill but I was really getting annoyed with the number of requests devices on my network were making to random DNS servers I never set up for them to use. Plus, I want the requests to be logged so I have an audit trail.

      • Eb_Na
      • 2 wk ago
      • Reported - view

       Hagezi has a pretty comprehensive blocklist to avoid bypass. It would be nice if nextdns devs implemented this in their list of lists.

      https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/doh-vpn-proxy-bypass.txt

    • Charlestephen
    • 2 wk ago
    • Reported - view

    That’s a fairly difficult thing to do give that its a command line tool and it has to interface with dozens of different router types. Plus, the version of router I use has a web interface, so if NextDNS even could feasibly make a DNAT rule for my router, it wouldn’t be updated in the gui and I wouldn’t know about it, somewhat breaking functionality on my reasonably expensive setup.

    • Eric.9
    • 2 wk ago
    • Reported - view

    I set up a DNS masquerade on my router.  So any traffic sent over 53/853 is rerouted to my router.  Helps with IoT devices hardcoded with 8.8.8.8 etc.

Content aside

  • 2 wk agoLast active
  • 13Replies
  • 103Views
  • 4 Following