DNS not resolving local addresses

Hi, I'm configuring my GL-AR750S as a travel router. For test purposes, it's WAN port is currently connected to my LAN. IP and DNS are provided by DHCP. Internet connection works. Resolving local addresses (provided by the local DNS) does not work:

root@OpenWrt:/etc# ping gateway.example.com
ping: bad address 'gateway.example.com'

nslookup output is strange in that it provides the local IP plus an error message:

root@OpenWrt:/etc# nslookup gateway.example.com 192.168.1.102
Server:		192.168.1.102
Address:	192.168.1.102#53

Name:      gateway.example.com
Address 1: 192.168.1.117
*** Can't find gateway.example.com: No answer

All other devices in my local network (Windows, MacOS, iOS, Linux, TVs) also use 192.168.1.102 as their DNS as well and have no problems resolving internal addresses.

Additional information on the network config:

root@OpenWrt:/etc# uci show network; uci show dhcp; ifstatus wan; cat /tmp/resol
v.conf.auto
network.loopback=interface
network.loopback.device='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fd97:6241:a239::/48'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='eth0.1'
network.lan=interface
network.lan.device='br-lan'
network.lan.proto='static'
network.lan.ipaddr='192.168.168.1'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.wan=interface
network.wan.device='eth0.2'
network.wan.proto='dhcp'
network.wan6=interface
network.wan6.device='eth0.2'
network.wan6.proto='dhcpv6'
network.@switch[0]=switch
network.@switch[0].name='switch0'
network.@switch[0].reset='1'
network.@switch[0].enable_vlan='1'
network.@switch_vlan[0]=switch_vlan
network.@switch_vlan[0].device='switch0'
network.@switch_vlan[0].vlan='1'
network.@switch_vlan[0].ports='2 3 0t'
network.@switch_vlan[1]=switch_vlan
network.@switch_vlan[1].device='switch0'
network.@switch_vlan[1].vlan='2'
network.@switch_vlan[1].ports='1 0t'
network.trm_wwan=interface
network.trm_wwan.proto='dhcp'
network.trm_wwan.metric='100'
network.trm_wwan6=interface
network.trm_wwan6.device='@trm_wwan'
network.trm_wwan6.proto='dhcpv6'
network.wg0=interface
network.wg0.proto='wireguard'
network.wg0.private_key='xxx'
network.wg0.addresses='10.7.0.2'
network.@wireguard_wg0[0]=wireguard_wg0
network.@wireguard_wg0[0].description='wireguard'
network.@wireguard_wg0[0].public_key='xxx'
network.@wireguard_wg0[0].allowed_ips='0.0.0.0/0'
network.@wireguard_wg0[0].route_allowed_ips='1'
network.@wireguard_wg0[0].endpoint_host='gateway.example.com'
network.@wireguard_wg0[0].persistent_keepalive='25'
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].filterwin2k='0'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].nonegcache='0'
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].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='100'
dhcp.lan.limit='150'
dhcp.lan.leasetime='12h'
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.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'
{
	"up": true,
	"pending": false,
	"available": true,
	"autostart": true,
	"dynamic": false,
	"uptime": 1996,
	"l3_device": "eth0.2",
	"proto": "dhcp",
	"device": "eth0.2",
	"updated": [
		"addresses",
		"routes",
		"data"
	],
	"metric": 0,
	"dns_metric": 0,
	"delegation": true,
	"ipv4-address": [
		{
			"address": "192.168.1.27",
			"mask": 24
		}
	],
	"ipv6-address": [
		
	],
	"ipv6-prefix": [
		
	],
	"ipv6-prefix-assignment": [
		
	],
	"route": [
		{
			"target": "0.0.0.0",
			"mask": 0,
			"nexthop": "192.168.1.1",
			"source": "192.168.1.27/32"
		}
	],
	"dns-server": [
		"192.168.1.102"
	],
	"dns-search": [
		"example.com"
	],
	"neighbors": [
		
	],
	"inactive": {
		"ipv4-address": [
			
		],
		"ipv6-address": [
			
		],
		"route": [
			
		],
		"dns-server": [
			
		],
		"dns-search": [
			
		],
		"neighbors": [
			
		]
	},
	"data": {
		"hostname": "gl-ar750s-lan",
		"leasetime": 7200,
		"ntpserver": "192.168.1.100"
	}
}
cat: can't open '/tmp/resolv.conf.auto': No such file or directory

Anything I could tweak in my config to get this working?

Thanks!

This might be due to the rebind protection, try either
uci set dhcp.@dnsmasq[0].rebind_protection='0'; uci commit dhcp; /etc/init.d/dnsmasq reload

or

uci add_list dhcp.@dnsmasq[0].rebind_domain='example.com'; uci commit dhcp; /etc/init.d/dnsmasq reload

3 Likes

That did it, thanks!

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