Im facing extreme difficulties setting up a custom DNS for RUT241. Im fiddling with a unit and I would need it all clients connected to router use our company DNS server.
Problem is, that there are 3 different places to configure the DNS and I’m not sure to what they affect (and it seems like non of them are working as I think).
1st way is from LAN → Edit interface → Advanced → DNS
2nd way if from WAN → Edit interface → Advanced → Use custom DNS
3rd way is the DNS section in network → DNS forwarding
I’ve tried to setup the DNS to each of these individually and all together but no matter what - the client can’t use the dns. When trying to ping I get unknown host, nslookup just gives “server: router-ip Address: router-ip#53”.
If I SSH into the router and try to ping the host, I just get “bad address” - If I do nslookup for the host on the router, I get “server: 127.0.0.1 Address: 127.0.0.1#53”
Dnsmasq is used on RutOS to provide DNS and DHCP functionality. By default, it works as a DNS forwarder. It receives DNS queries and forwards them to the configured DNS servers. So you can add the DNS server to the list of DNS servers either on the LAN interface or WAN.
If you are using DHCP, you can also push your DNS server (option 6) to the DHCP clients. Then, DHCP clients will use the specified DNS server for their DNS queries. Please take a look at these forum posts here and here.
I’ve previously I tried setting the DNS to LAN / WAN interface. On the client the reported used DNS were the router (192.168.1.1) and I could not resolve the host from client.
You (and one of the links you gave) mentioned using the option 6 in DHCP advanced configuration. If I understood correctly, using this option would “push” the DNS to the client.
Question being - would it push the DNS specified in the LAN setting, or is it pushing the IP specified in the free field next to the “6” field?
EDIT:
Just so I got it all wrapped around my head correctly:
DNS set on LAN: All LAN clients going trough this interface should use the specified DNS
DNS set on WAN: All traffic heading out using this interface should use the specified DNS
DNS forwarding: All trafic should be redirected to the specified DNS
Almost correct. Basically, the device can use any of those DNS servers (usually it sends DNS query to all DNS servers at the same time, and when it receives a response, it picks the one that it thinks is the best). As mentioned in the other posts, you can check what DNS servers are used via cat /tmp/resolv.conf.d/resolv.conf.auto command. If you have DNS server on the WAN interface configured, then if this interface is up, the DNS server will be in the list and can be used.
The device uses these DNS servers to forward DNS queries. The LAN clients will see RUT as the DNS server because they send DNS queries to it, but RUT forwards them to the servers in its list. If you want the end devices to have a specific DNS server in their configurations, then you can use option 6 where you can speficy the DNS server to push to the DHCP clients in LAN. If you push the server to the clients, they will see this server in the IP settings (ipconfig / ifconfig).
So it should be correct? Yet still, if I try to ping the service using the DNS name on the client, I get unknown host.
Also trying to ping the host straight from the router fails (bad address). Pinging using the services IP works both from the router and from the client.
EDIT:
If I use the option -6 in DHCP to push the DNS to DHCP clients, it works. Client gets the 10.180.14.50 as its DNS and the ping using the DNS name goes through.
But why the LAN/WAN method is not working? And which one is preferable? Idea is to have a template made from this unit that could be easily replicated to other units reliably.
Not sure in your specific case why, but could you please navigate to Network → DNS and disable 'Rebind protection '? With rebind protection, the router discards upstream responses that return a private address. Let me know if this helps.