Cannot resolve hostnames in OpenWRT shell

Hi, I have a problem with OpenWRT: if I ping a domain in the shell, it replies "bad address: mydomain.com", if, instead, I ping an ip directly, for example 1.1.1.1, it replies. What can I do to fix? Thank you!

define one of more DNSes.

1 Like

Where should I define it? In /etc/resolv.conf it has localhost as nameserver and in /etc/config/network in WAN interface I have cloudflare as DNS

adding it to resolv.conf should be enough, but the entry will be lost during a reboot.

what's in /tmp/resolv.conf.d/resolv.conf.auto

what's the mode of the device ? router ? AP ?

in /tmp/resolv.conf.d/resolv.conf.auto i have this:

# Interface lan
nameserver 10.0.0.4 (ip of pi-hole)
# Interface wan
nameserver 1.1.1.1
nameserver 1.0.0.1

The openwrt act as a router.

then it should work, can you resolve any other DNS name, like google.com ?

no, it always says bad address

ok,

post the output of
nslookup google.com and perhaps also
nslookup google.com 10.0.04 and
nslookup google.com 1.1.1.1

1 Like

here it is