DNS Forwarding question

Hello,
I have connected the lan of my parents (remote) and my own lan (local) via wireguard.
Every machine at remote can be reached via its IP address without problems.
But how to use their dns names, without defining every machine in my hostnames table?

I found this. about selective DNS forwarding. So I added the entry "dhcp.@dnsmasq[0].server='/dr.lan/192.168.1.1'" and restarted dnsmasq afterwards.

But when I try to ping a machine i.e. "TrueNAS.dr.lan" i get "bad address".

When I log in to the remote router I can ping ie. "TrueNAS.dr.lan". So DNS at the remote site seems to work fine.

uci show dhcp

dhcp.@dnsmasq[0]=dnsmasq                                                                                                                                               
dhcp.@dnsmasq[0].domainneeded='1'                                                                                                                                      
dhcp.@dnsmasq[0].localise_queries='1'                                                                                                                                  
dhcp.@dnsmasq[0].rebind_protection='1'                                                                                                                                 
dhcp.@dnsmasq[0].rebind_localhost='1'                                                                                                                                  
dhcp.@dnsmasq[0].expandhosts='1'                                                                                                                                       
dhcp.@dnsmasq[0].authoritative='1'                                                                                                                                     
dhcp.@dnsmasq[0].readethers='1'                                                                                                                                        
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'                                                                                                                          
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'                                                                                                      
dhcp.@dnsmasq[0].localservice='1'                                                                                                                                      
dhcp.@dnsmasq[0].ednspacket_max='1232'                                                                                                                                 
dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'                                                                                                                              
dhcp.@dnsmasq[0].local='/hr.lan/'                                                                                                                                      
dhcp.@dnsmasq[0].domain='hr.lan'                                                                                                                                       
dhcp.@dnsmasq[0].server='/dr.lan/192.168.1.1'                                                                                                                          
dhcp.lan=dhcp                                                                                                                                                          
dhcp.lan.interface='lan'                                                                                                                                               
dhcp.lan.dhcpv4='server'                                                                                                                                               
dhcp.lan.dhcpv6='server'                                                                                                                                               
dhcp.lan.ra='server'                                                                                                                                                   
dhcp.lan.ra_slaac='1'                                                                                                                                                  
dhcp.lan.ra_flags='managed-config' 'other-config'                                                                                                                      
dhcp.lan.start='200'                                                                                                                                                   
dhcp.lan.limit='250'                                                                                                                                                   
dhcp.lan.leasetime='1h'                                                                                                                                                
dhcp.lan.ra_management='1'                                                                                                                                             
dhcp.lan.dhcp_option='42,192.168.2.1' '6865i,66,https://192.168.2.12/OpenWrt/mitel/' '60,6865i,AastraIPPhone6865i'                                                     
dhcp.wan=dhcp                                                                                                                                                          
dhcp.wan.interface='wan'                                                                                                                                               
dhcp.wan.ignore='1'                                                                                                                                                    
dhcp.odhcpd=odhcpd                                                                                                                                                     
dhcp.odhcpd.maindhcp='0'                                                                                                                                               
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'                                                                                                                              
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'                                                                                                                     
dhcp.odhcpd.loglevel='4'                                                                                                                                               
dhcp.@domain[0]=domain                                                                                                                                                 
dhcp.@domain[0].name='R2S'                                                                                                                                             
dhcp.@domain[0].ip='192.168.2.1'                                                                                                                                       
dhcp.@domain[1]=domain                                                                                                                                                 
dhcp.@domain[1].name='NTP'                                                                                                                                             
dhcp.@domain[1].ip='192.168.2.1'                                                                                                                                       
dhcp.@domain[2]=domain                                                                                                                                                 
dhcp.@domain[2].ip='192.168.1.1'                                                                                                                                       
dhcp.@domain[2].name='R2S.dr.lan'                                                                                                                                      
dhcp.@host[0]=host                                                                                                                                                     
dhcp.@host[0].name='R2S'                                                                                                                                               
dhcp.@host[0].ip='192.168.2.1'                                                                                                                                         
dhcp.@host[0].mac='98:ab:c4:bf:39:7e'                                                                                                                                  
dhcp.@host[0].dns='1' 

Henning

  • Is 192.168.1.1 your parent's DNS server?
  • Your parent's network uses dr.lan?
  • Your devices use your OpenWrt's DNS?

/off: i dont believe this has anything related to your problem but this is likely wrong, 66,xxx or 60,xxx is the correct format as i know.

1 Like

probably a more related question: where did you ping? on the router itself or from a client pc? as the router may not use dnsmasq depending on your resolv.conf setup.

@lleachii
Yes, yes, yes. You are right.

@grrr2
I never assumed that the dhcp options for my phones will prohibit dns request to my parents lan. Since this part is working fine.

i never said it is the root cause, simply observed that syntax is incorrect. but if ip phones work in spite, that's cool.

Does pinging r2s.dr.lan work?

Yes, I can ping R2S.dr.lan

 PING R2S.dr.lan (192.168.1.1): 56 data bytes                                                                                                                        
64 bytes from 192.168.1.1: seq=0 ttl=64 time=9.630 ms 

I can ping "TrueNAS" by ip

PING 192.168.1.101 (192.168.1.101): 56 data bytes                                                                                                                  
64 bytes from 192.168.1.101: seq=0 ttl=63 time=7.428 ms 

But not via DNS

ping: bad address 'TrueNAS.dr.lan' 

Could it be that wireguard is causing the problem? And not DNS?

???

Something is seriously wrong here!

Did you configure an IP address as a domain name?

Sorry
I have changed the ip address range, while testing.
In meantime I did a reboot.
IP address ranges are clean now again. But the problem still exists.

uci set dhcp.@dnsmasq[0].localservice='0'; uci commit dhcp; service dnsmasq restart

After I set logqueries to 1

uci set dhcp.@dnsmasq[0].logqueries='1'

I got this:

Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 7 127.0.0.1/58932 query[A] TrueNAS.dr.lan from 127.0.0.1
Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 7 127.0.0.1/58932 forwarded TrueNAS.dr.lan to 2a00:6020:100::1
Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 8 ::1/58932 query[A] TrueNAS.dr.lan from ::1
Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 9 127.0.0.1/58932 query[AAAA] TrueNAS.dr.lan from 127.0.0.1
Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 9 127.0.0.1/58932 forwarded TrueNAS.dr.lan to 2a00:6020:100::1
Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 10 ::1/58932 query[AAAA] TrueNAS.dr.lan from ::1
Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 7 127.0.0.1/58932 reply TrueNAS.dr.lan is NXDOMAIN
Fri Mar 18 16:17:09 2022 daemon.info dnsmasq[28831]: 9 127.0.0.1/58932 reply TrueNAS.dr.lan is NXDOMAIN

Seems that the dns request is forwared to my provider :frowning:
So I decided to change dns servers from provider dns to fixed ones.

uci add_list dhcp.@dnsmasq[0].server="8.8.8.8"
uci add_list dhcp.@dnsmasq[0].server="8.8.4.4"
uci add_list dhcp.@dnsmasq[0].server='/dr.lan/192.168.1.1'

Looks better now, but still no answer.
I'm missing a clearly hint in OpenWrt docu, that "Selective DNS forwarding" is de facto unusable without specifying dedicated forwarding servers !
The text "this can be combined ..." points to a complete wrong direction.

Fri Mar 18 16:24:07 2022 daemon.info dnsmasq[32095]: 9 127.0.0.1/47044 query[A] TrueNAS.dr.lan from 127.0.0.1
Fri Mar 18 16:24:07 2022 daemon.info dnsmasq[32095]: 9 127.0.0.1/47044 forwarded TrueNAS.dr.lan to 192.168.1.1
Fri Mar 18 16:24:07 2022 daemon.info dnsmasq[32095]: 10 ::1/47044 query[A] TrueNAS.dr.lan from ::1

So I decided to test all combinations of dhcp.@dnsmasq[0].localservice=0/1 and dhcp.@dnsmasq[0].localuse=0/1
But still no name resolution.

Finaly I figured out, that on both sides some settings are required, to get it work...

on both sites

uci set dhcp.@dnsmasq[0].localservice='0'
uci set dhcp.@dnsmasq[0].rebind_protection='1'
uci add_list dhcp.@dnsmasq[0].server="8.8.8.8"
uci add_list dhcp.@dnsmasq[0].server="8.8.4.4"

on each site (with domain/IP of remote site)

uci add_list dhcp.@dnsmasq[0].rebind_domain='dr.lan'
uci add_list dhcp.@dnsmasq[0].server='/dr.lan/192.168.1.1'

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.