Intention to use OpenDNS as the DNS server


Kiwi8

Forum Guru
Member
Hello!

I intend to use the two OpenDNS servers as the first two DNS servers to refer too.

I had also taken a look at this thread and know where to add them in:
http://www.linksysinfo.org/forums/showthread.php?t=54916

But I do not understand how to add in my ISP's DNS servers too as is the current case, as the backup in case it fails. My ISP's DNS servers might change, so how can I set my router such that it will query the ISP for the DNS servers' IP address?

Thanks in advance.
 
Under Advanced -> DHCP/ DNS, tick the box for "Use Received DNS With Static DNS". But doing that defeats the filtering & blocking features of OpenDNS if those are important to you.
 
in the textarea under Advanced -> DHCP/ DNS, add this line:

strict-order

Yeah, but the problem is, my ISP gives me 3 DNS servers, so I can't put the two OpenDNS servers into the fields in the basic settings page, as that will leave only 1 0.0.0.0 for my ISP to give me only 1 DNS server. But if I put the OpenDNS servers into the configuration page, it'll be ranked behind the 3 ISP DNS servers.
 
Yeah, but the problem is, my ISP gives me 3 DNS servers, so I can't put the two OpenDNS servers into the fields in the basic settings page, as that will leave only 1 0.0.0.0 for my ISP to give me only 1 DNS server. But if I put the OpenDNS servers into the configuration page, it'll be ranked behind the 3 ISP DNS servers.

If you know the DNS servers provided by your ISP, couldn't you add a startup script with a sleep up front to write your own /etc/resolv.dnsmasq file with all the entries you want?
 
If you know the DNS servers provided by your ISP, couldn't you add a startup script with a sleep up front to write your own /etc/resolv.dnsmasq file with all the entries you want?

Possible... but I would prefer to obtain the necessary servers from the ISP via DHCP, just in case they change the server IP addresses.
 
Possible... but I would prefer to obtain the necessary servers from the ISP via DHCP, just in case they change the server IP addresses.

I understand, just don't know how to do it, maybe a feature request. If you have "Use Received DNS With Static DNS" ticked on the Advanced -> DHCP / DNS page then you can periodically check the Basic -> DDNS page to see what servers are listed towards the bottom to see if anything has changed.

*Edit: Now that I think about it, if the data is there to check visually then you should be able to find it and use it in a script. Did a quick look at the nvram variables and wan_get_dns looks like it contains the ISP supplied DNS entries so just parse that in your script to create the /etc/resolv.dnsmasq you want.

I'm not much of a script writer but if you wanted to quick and dirty try this out, the below should work. Untick "Use Received DNS With Static DNS" so you just have OpenDNS entries in /etc/resolv.dnsmasq and this should add the ISP provided ones, this assumes that 3 are being provided as you previously stated. Might want to go check, do a "nvram get wan_get_dns" and see how many entries there are. If only two, as in my case, then remove the 3rd line. Put a sleep in front of it if you want to save it as a startup script. Not sure how long the sleep needs to be, maybe start with 5 and increase if it doesn't work. Actually, just tested it and I had to bump it to 10 for it to work as an Init script. Maybe it's a better fit for "WAN Up" than Init, maybe doesn't matter, not sure.

*Note, seems to not work correctly with Tomato 1.21, changes get removed
Code:
echo "nameserver" `nvram get wan_get_dns|cut -d " " -f 1`>>/etc/resolv.dnsmasq
echo "nameserver" `nvram get wan_get_dns|cut -d " " -f 2`>>/etc/resolv.dnsmasq
echo "nameserver" `nvram get wan_get_dns|cut -d " " -f 3`>>/etc/resolv.dnsmasq
 
Seems to be working OK here so far. Set it up this way here as well, to get the benefit of OpenDNS but the fallback of my ISP if needed. As I said, I'm not much of a script writer and somebody else here can probably come up with a more elegant way. But hey, if it works, that's what counts, :-D Lemme know if it works for you or not.
 
Thanks, it seems to work here too. :)

Good to hear.

FYI, I put mine under the WAN-Up tab and added some checking to make sure the DNS servers don't get added more than once. My ISP provided DNS servers both start with 68.67 so I just check and don't add them if there are already two entries matching that in the /etc/resolv.dnsmasq file.

Code:
if [ `grep -c 68.87 /etc/resolv.dnsmasq` -lt 2 ]; then echo "nameserver" `nvram get wan_get_dns|cut -d " " -f 1`>>/etc/resolv.dnsmasq ;fi
if [ `grep -c 68.87 /etc/resolv.dnsmasq` -lt 2 ]; then echo "nameserver" `nvram get wan_get_dns|cut -d " " -f 2`>>/etc/resolv.dnsmasq ;fi
 

Back
Top