OpenWRT meets OpenDNS

To make whole home network use OpenDNS I need to change only 3 files on my OpenWRT router.

First step – resolv.conf

Create /etc/resolv.conf.opendns with OpenDNS servers addresses, eg:


Make sure /etc/resolv.conf defines as a name server.

Second step – dnsmasq

In /etc/config/dhcp set resolvfile variable:

option resolvfile '/etc/resolv.conf.opendns'

Restart dnsmasq with:

# /etc/init.d/dnsmasq restart

Third step – /etc/hotplug.d/iface

This step is only needed if you have a dynamic IP address and you want to use advanced OpenDNS features (like content filters or statistics).

Create file /etc/hotplug.d/iface/40-opendns with command similar to this:


case "${ACTION:-ifup}" in
                logger -t opendns `curl -k -u username:password`

Note that you need curl built with (libopen)ssl.

Test hotplug script with:

# ifdown wan
# ifup wan

Then check log with:

# logread | tail

If script work you will see a message like:

Jan  4 01:13:27 hurricane user.notice opendns: good

Finally go to OpenDNS. If everything is fine you should find green “You’re using OpenDNS!” in the right corner. In “Dashboard > Networks” you should find entry for NetworkName with your current IP and message “(your current IP)”.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.