Redirect dns request from wan router to OpenWrt dnsmasq

Is there any way to forward dns requests from my wan router to openwrt(lan) which is running dnsmasq dns server?

1 Like

You can set up DNS forwarding on the upstream router, or offer custom DNS with DHCP.
Or specify the downstream router as an exclusive DNS provider for the upstream one.
Another way is to move the DHCP/DNS roles from the upstream router to the downstream.


firewall/routing rule, if there's such an option.

or modify the DHCP settings to point to your DNS instead of the ISPs.

If not possible, disable the DHCP in the router, and use your OpenWRT device as the DHCP,
pointing to itself as DNS, and the main router as default gateway.

Bleh, vgaetera beat me to it :slight_smile:

1 Like

I need to be able to reach hostname provided by openwrt from the devices connected to my main router.

i don't see a/the problem ?


If I put openwrt ip as dns server in the main router than internet stop working.

Disable peer DNS and specify public/ISP resolvers as an upstream provider on OpenWrt:

Make sure you upstream firewall zone accepts DNS traffic.

If the issue persists, collect the diagnostics and post it to redacting the private parts:

uci show network; uci show dhcp; uci show firewall; \
ip address show; ip route show; ip rule show; iptables-save; \
head -v -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*

I am not able to configure it.
Pastbin link

1 Like

What exactly are you unable to configure?

1 Like

Actually, your OpenWrt config looks correct.
Make sure you specify as the only resolver on the upstream router.

Thank you. Finally the problem is solved.
Actually I was putting lan ip) on upstream router but after using client ip), everything is working smoothly.

1 Like

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