Diani
October 6, 2021, 7:40am
#1
Hello
I have installed OpenWRT 21.02 and cannot ping www.google.com from the router. A look at the /etc/resolv.conf file
shows that this is a link to /tmp/resolv.conf. It only says here:
search lan
nameserver 127.0.0.1
nameserver :: 1
I can temporarily save the file with the contents of /tmp/resolv.conf.d/resolv.conf.auto
# Interface office
nameserver 217.237.151.161
nameserver 8.8.8.8
nameserver 8.8.4.4
# Interface wan
nameserver 217.0.43.129
nameserver 217.0.43.145
# Interface wan_6
nameserver 2003: 180: 2: a000: 0: 1: 0: 53
nameserver 2003: 180: 2: b000: 0: 1: 0: 53
fill up, then the name resolution continues until the next reboot of the router.
What can I set on the router so that the correctly configured /tmp/resolv.conf.d/resolv.conf.auto is seen by the router as the default?
The entry /etc/resolv.conf “nameserver 127.0.0.1 ” says that the router itself acts as a DNS server, but somehow it doesn't work that well.
Best regards
DianiBeach
did you set a static IP on the WAN interface ?
If you did, you need to specify the DNSes manually ...
in /etc/config/network
my wan interface is configured as
config interface 'wan'
option device 'eth1'
option proto 'dhcp'
option peerdns '0'
list dns '8.8.8.8'
list dns '8.8.4.4'
It's the last 3 lines that make the difference .... these should then show up in /tmp/resolv.conf.d/resolv.conf.auto
for wan6
config interface 'wan6'
.......
option peerdns '0'
list dns '2001:4860:4860::8888'
list dns '2001:4860:4860::8844'
Of course, I'm using google DNS - you set your values as you wish
Diani
October 6, 2021, 8:02am
#4
Thanks for your feedbacks.
I have done your suggests like
config interface 'wan'
option device 'wan'
option type 'bridge'
option proto 'pppoe'
option username 'xxxxxxxxxxxx'
option password 'xxxxxxxxx'
option ipv6 'auto'
option peerdns '0'
list dns '8.8.8.8'
list dns '8.8.4.4'
config interface 'wan6'
option device 'wan'
option proto 'dhcpv6'
option type 'bridge'
option peerdns '0'
list dns '2001:4860:4860::8888'
list dns '2001:4860:4860::8844'
Now the DNS name resolution runs from the connected clients, but not from the router self.
Does this exist on the WAN interface settings page, I only run APs with openwrt, and remove the WAN interfaces
What's in /tmp/resolv.conf.d/resolv.conf.auto
Diani
October 6, 2021, 8:09am
#8
/tmp/resolv.conf.d/resolv.conf.auto
# Interface office
nameserver 217.237.151.161
nameserver 8.8.8.8
nameserver 8.8.4.4
# Interface wan
nameserver 8.8.8.8
nameserver 8.8.4.4
# Interface wan_6
What's the output of
uci show dhcp.@dnsmasq[]
frollic
October 6, 2021, 8:27am
#10
is that relevant, this is a on router issue, not client ?
Diani
October 6, 2021, 8:29am
#11
jaromanda:
uci show dhcp.@dnsmasq []
# uci show dhcp.@dnsmasq[]
dhcp.cfg01411c=dnsmasq
dhcp.cfg01411c.domainneeded='1'
dhcp.cfg01411c.localise_queries='1'
dhcp.cfg01411c.rebind_protection='1'
dhcp.cfg01411c.rebind_localhost='1'
dhcp.cfg01411c.local='/lan/'
dhcp.cfg01411c.domain='lan'
dhcp.cfg01411c.expandhosts='1'
dhcp.cfg01411c.authoritative='1'
dhcp.cfg01411c.readethers='1'
dhcp.cfg01411c.leasefile='/tmp/dhcp.leases'
dhcp.cfg01411c.resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.cfg01411c.localservice='1'
dhcp.cfg01411c.ednspacket_max='1232'
Diani
October 6, 2021, 8:31am
#12
Yes, that only affects the router. It is also required for the NTP time server. And for the updates of course.
opkg update
fails in this case.
frollic
October 6, 2021, 8:33am
#13
is your /etc/resolv.conf a softlink ?
I still use 19.07, might be different in 21.02.
lrwxrwxrwx 1 root root 16 Jan 19 2021 resolv.conf -> /tmp/resolv.conf
I assume pinging (for instance 8.8.8.8) works, but name resolution fails ?
Diani
October 6, 2021, 8:36am
#14
It's the same like 19.07, it's a link
lrwxrwxrwx 1 root root 16 Sep 1 00:20 /etc/resolv.conf -> /tmp/resolv.conf
The pings over IP addresses runs well, only the name resolution fails on the router.
Well, that looks fine - if you run
netstat -pant | grep "dnsmasq"
can you see dnsmasq listening to 127.0.0.1
and ::1
?
1 Like
frollic
October 6, 2021, 9:07am
#16
What does network.wan
look like in your device, compared to Setting DNS on my PPPoE WAN - #3 by ajaffarali ? ?
Well, there's your problem - of course, I have no idea why dnsmasq would not be listening on localhost
1 Like
Diani
October 6, 2021, 9:32am
#19
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='fd49:8bd1:464e::/48'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='lan1' 'lan2' 'lan3' 'lan4'
network.@bridge-vlan[0]=bridge-vlan
network.@bridge-vlan[0].device='br-lan'
network.@bridge-vlan[0].vlan='1'
network.@bridge-vlan[0].ports='lan1' 'lan2'
network.@bridge-vlan[1]=bridge-vlan
network.@bridge-vlan[1].device='br-lan'
network.@bridge-vlan[1].vlan='2'
network.@bridge-vlan[1].ports='lan3' 'lan4'
network.office=interface
network.office.device='br-lan.1'
network.office.proto='static'
network.office.netmask='255.255.255.0'
network.office.ip6assign='60'
network.office.ipaddr='192.168.0.1'
network.office.dns='217.237.151.161' '8.8.8.8' '8.8.4.4'
network.home=interface
network.home.device='br-lan.2'
network.home.proto='static'
network.home.ipaddr='192.168.1.1'
network.home.netmask='255.255.255.0'
network.home.ip6assign='60'
network.@device[1]=device
network.@device[1].name='wan'
network.@device[1].macaddr='c6:41:1e:33:b4:3b'
network.wan=interface
network.wan.device='wan'
network.wan.type='bridge'
network.wan.proto='pppoe'
network.wan.username='xxxxxxxxxxxxx'
network.wan.password='xxxxxxxxx'
network.wan.ipv6='auto'
network.wan.peerdns='0'
network.wan.dns='8.8.8.8' '8.8.4.4' '217.237.151.161'
network.wan6=interface
network.wan6.device='wan'
network.wan6.proto='dhcpv6'
network.wan6.type='bridge'
network.wan6.peerdns='0'
network.wan6.dns='2001:4860:4860::8888' '2001:4860:4860::8844'
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].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
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].nonwildcard='0'
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.wan.ra_flags='none'
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.office=dhcp
dhcp.office.interface='office'
dhcp.office.start='100'
dhcp.office.limit='150'
dhcp.office.leasetime='12h'
dhcp.office.dhcp_option='192.168.0.1' '217.237.151.161' '8.8.8.8' '8.8.4.4' '1.1.1.1'
dhcp.office.ra='server'
dhcp.office.dhcpv6='server'
dhcp.office.dns='2606:4700:4700::1111' '2001:4860:4860::8888'
dhcp.office.ra_flags='none'
dhcp.home=dhcp
dhcp.home.interface='home'
dhcp.home.start='100'
dhcp.home.limit='150'
dhcp.home.leasetime='12h'
dhcp.home.dhcp_option='192.168.0.1' '217.237.151.161' '8.8.8.8' '8.8.4.4' '1.1.1.1'
dhcp.home.ra='server'
dhcp.home.dhcpv6='server'
dhcp.home.dns='2606:4700:4700::1111' '2001:4860:4860::8888'
dhcp.home.ra_flags='none'
lrwxrwxrwx 1 root root 16 Sep 1 00:20 /etc/resolv.conf -> /tmp/resolv.conf
-rw-r--r-- 1 root root 47 Oct 6 10:40 /tmp/resolv.conf
-rw-r--r-- 1 root root 48 Oct 6 10:18 /tmp/resolv.conf.ppp
/tmp/resolv.conf.d:
-rw-r--r-- 1 root root 183 Oct 6 10:18 resolv.conf.auto
==> /etc/resolv.conf <==
search lan
nameserver 127.0.0.1
nameserver ::1
==> /tmp/resolv.conf <==
search lan
nameserver 127.0.0.1
nameserver ::1
==> /tmp/resolv.conf.d <==
head: /tmp/resolv.conf.d: I/O error
==> /tmp/resolv.conf.ppp <==
nameserver 217.0.43.129
nameserver 217.0.43.145
Diani
October 6, 2021, 10:30am
#21
# /etc/init.d/dnsmasq restart
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: no lease, failing
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: no lease, failing
and here the syslog
# cat /tmp/log/syslog
Wed Oct 6 11:41:15 2021 user.notice dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Wed Oct 6 11:41:15 2021 user.notice dnsmasq: Allowing 127.0.0.0/8 responses
Wed Oct 6 12:29:39 2021 daemon.crit dnsmasq[9104]: bad dhcp-option at line 32 of /var/etc/dnsmasq.conf.cfg01411c
Wed Oct 6 12:29:39 2021 daemon.crit dnsmasq[9104]: FAILED to start up
Wed Oct 6 12:29:44 2021 daemon.crit dnsmasq[9163]: bad dhcp-option at line 32 of /var/etc/dnsmasq.conf.cfg01411c
Wed Oct 6 12:29:44 2021 daemon.crit dnsmasq[9163]: FAILED to start up
Wed Oct 6 12:29:49 2021 daemon.crit dnsmasq[9164]: bad dhcp-option at line 32 of /var/etc/dnsmasq.conf.cfg01411c
Wed Oct 6 12:29:49 2021 daemon.crit dnsmasq[9164]: FAILED to start up
Wed Oct 6 12:29:54 2021 daemon.crit dnsmasq[9166]: bad dhcp-option at line 32 of /var/etc/dnsmasq.conf.cfg01411c
Wed Oct 6 12:29:54 2021 daemon.crit dnsmasq[9166]: FAILED to start up
1 Like