DNS Issue with Static IP on LAN Interface

Hello

I am facing a DNS issue. I have openwrt with a single LAN Interface on br-lan.
When the Interface IP addressing is set to DHCP client , the OpenWRT router can perform DNS queries to the DHCP assigned servers.
When a Static IP address is set on the LAN interface and manually setting the DNS servers Network> Interfaces > Edit > Advanced Settings > Use Custom DNS , router cannot perform any query to DNS servers. Seems that ignoring the set DNS servers.

config interface 'lan'
option proto 'static'
option device 'br-lan'
option ipaddr '192.168.x.x'
option netmask '255.255.255.0'
option gateway '192.168.x.x'
list dns '8.8.8.8'

The only workaround is to manually change the /etc/resolv.conf to point a DNS server other that the 127.0.0.1 , which file after any network change is overridden.
I have testing on multiple H/W with 24.10.1 with same behavior.
Any idea ? Is it a bug ?

Regards

No need to redact private IP addresses (RFC1918) , redacting those makes it difficult to give proper support.

The gateway must be the address of the next hop and not of the router otherwise it wont work

It can help if you show your configs, please connect to your OpenWRT device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button

Remember to redact keys, passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall
ip route show
1 Like

My guess is that you are fighting dnsmasq .
Since you want to set a manual dns server and mentions resolv.conf , i guess you don't need dnsmasq.

I also had 127.0.0.1 in resolv.conf , until i disabled dnsmasq

System --> Startup
image

I'm a newbie too, and don't know if dhcp-server is dependant on dnsmasq too.
But in my setup i don't need either, and disabled both.

If you set upstream DNS to 127.0.0.1, you're telling dnsmasq to query itself.

The disable of the dnsmaq was the cure.
Thanks

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