What's new

Assign separate DNS to one specific host?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

belltree

Occasional Visitor
I just purchased an RT-N16 today and ditched my ~5 year old router. What a breath of fresh air! Even more so now that I am upgraded to Asuswrt-Merlin.

There is one thing I want to achieve but I am unsure if it is possible. I want to assign separate DNS values (unblock-us) to one specific wireless host (Roku device) on my network. I do not want to use their DNS servers for anything other than the Roku device.

I have assigned a static IP but if it is possible to do it via mac address that would be good as well.

I am guessing that DNSmasq should be able to do this but I am unsure of the syntax or how to do it. Appreciate any advice/help. Thank you.
 
Last edited:
There is one thing I want to achieve but I am unsure if it is possible. I want to assign separate DNS values (unblock-us) to one specific wireless host (Roku device) on my network. I do not want to use their DNS servers for anything other than the Roku device.

I have assigned a static IP but if it is possible to do it via mac address that would be good as well.

I am guessing that DNSmasq should be able to do this but I am unsure of the syntax or how to do it. Appreciate any advice/help. Thank you.
Hi,

try this
I assume you already have enabled JFFS otherwise it's under administration -> system.
Make sure you also enable "JFFS partition at next boot" and reboot
Login via telnet,SSH
Execute these line's in terminal but change <mac> first :)
Code:
echo "dhcp-host=<mac>,net:red" > /jffs/configs/dnsmasq.conf.add
echo "dhcp-option=net:red,option:dns-server, 208.122.23.22, 208.122.23.23" >> /jffs/configs/dnsmasq.conf.add
 
Thanks very much. I connected via telnet and executed as below:

ASUSWRT RT-N16_3.0.0.4 Wed Jul 24 19:30:58 UTC 2013

admin@RT-N16:/tmp/home/root# echo "dhcp-host=##:##:##:##:##:##,net:red" > /jff
s/configs/dnsmasq.conf.add

admin@RT-N16:/tmp/home/root# echo "dhcp-option=net:red,option:dns-server, 208.
122.23.22, 208.122.23.23" >> /jffs/configs/dnsmasq.conf.add

admin@RT-N16:/tmp/home/root#

Is there any way to confirm that the settings have taken effect?
 
Thanks very much. I connected via telnet and executed as below:

Is there any way to confirm that the settings have taken effect?

Well after a second reboot you should be able to connect the websites you wanted. That's the whole purpose of using unblock-us dns servers isn't it? If netflix,etc was blocked it should work now only for your "roku" device.
 
Well after a second reboot you should be able to connect the websites you wanted. That's the whole purpose of using unblock-us dns servers isn't it? If netflix,etc was blocked it should work now only for your "roku" device.

Indeed. Sorry, I should have been more specific. To test unblock-us I initially manually assigned their dns addresses to the dhcp pool. But now that you have been so kind as to share the above process I will remove them.

I just wanted to be sure that the settings I inputted are in effect so the Roku does not revert to Canada or otherwise.

Also I assume that these settings would not survive a firmware upgrade and should be reapplied in such case. Correct?
 
Indeed. Sorry, I should have been more specific. To test unblock-us I initially manually assigned their dns addresses to the dhcp pool. But now that you have been so kind as to share the above process I will remove them.

I just wanted to be sure that the settings I inputted are in effect so the Roku does not revert to Canada or otherwise.

Also I assume that these settings would not survive a firmware upgrade and should be reapplied in such case. Correct?

Normally the JFFS partition survives a firmware upgrade but it's recommended to have a back up of your settings available, you never know what will happen :D
 
After rebooting you can:

cat /tmp/etc/dnsmasq.conf

and ensure the lines you want are in place...


ASUSWRT RT-N16_3.0.0.4 Wed Jul 26 19:30:58 UTC 2013
Admin@RT-N16:/tmp/home/root# cat /tmp/etc/dnsmasq.conf
pid-file=/var/run/dnsmasq.pid
user=nobody
resolv-file=/tmp/resolv.conf
no-poll
interface=br0
min-port=4096
no-negcache
cache-size=1500
dhcp-range=lan,192.168.1.2,192.168.1.254,255.255.255.0,86400s
dhcp-lease-max=253
dhcp-authoritative
dhcp-option=lan,3,192.168.1.1
dhcp-option=lan,6,208.122.23.22,0.0.0.0
dhcp-option=lan,44,192.168.1.1
read-ethers
addn-hosts=/etc/hosts.dnsmasq
dhcp-host=##:##:##:##:##:##,net:red
dhcp-option=net:red,option:dns-server, 208.122.23.22, 208.122.23.23
Admin@RT-N16:/tmp/home/root#

It looks like I am good to go. Thanks very much to both of you. :)
 
Possibly a silly question but what is the difference between "net:red" and "set:red"? I see the latter in a lot example command lines for dnsmasq but I have not seen the former anywhere.
 
Last edited:
Possibly a silly question but what is the difference between "net:red" and "set:red"? I see the latter in a lot example command lines for dnsmasq but I have not seen the former anywhere.

From the dnsmasq manpage:

This system evolved from an earlier, more limited one and for backward compatibility "net:" may be used instead of "tag:" and "set:" may be omitted. (Except in dhcp-host, where "net:" may be used instead of "set:".)

Basically, net: is an older syntax which has been replaced by set: (for dhcp-host) and tag: (for dhcp-option).

So, the equivalent configuration would be:

Code:
dhcp-host=##:##:##:##:##:##,set:red
dhcp-option=tag:red,option:dns-server, 208.122.23.22, 208.122.23.23
 
From the dnsmasq manpage:



Basically, net: is an older syntax which has been replaced by set: (for dhcp-host) and tag: (for dhcp-option).

So, the equivalent configuration would be:

Code:
dhcp-host=##:##:##:##:##:##,set:red
dhcp-option=tag:red,option:dns-server, 208.122.23.22, 208.122.23.23

Thank you. To change to this I disabled, then renabled the JFFS partition and also formatted it.

I then run the below:

echo "dhcp-host=##:##:##:##:##:##,set:red" > /jffs/configs/dnsmasq.conf.add
echo "dhcp-option=tag:red,option:dns-server, 208.122.23.22, 208.122.23.23" >> /jffs/configs/dnsmasq.conf.add

But afterward it seems no change appears when I run the command "cat /tmp/etc/dnsmasq.conf". Am I doing something wrong? This is how I did it the very first time and it appeared correctly.
 
Thank you. To change to this I disabled, then renabled the JFFS partition and also formatted it.

I then run the below:

But afterward it seems no change appears when I run the command "cat /tmp/etc/dnsmasq.conf". Am I doing something wrong? This is how I did it the very first time and it appeared correctly.

There's no need to reenable or reformat the JFFS partition at this point... Simply running those two commands and rebooting should do the trick. Did you reboot again?
 
Thank you. To change to this I disabled, then renabled the JFFS partition and also formatted it.

I then run the below:



But afterward it seems no change appears when I run the command "cat /tmp/etc/dnsmasq.conf". Am I doing something wrong? This is how I did it the very first time and it appeared correctly.

Hi,

R u sure the dns rules are not accidentally deleted? :D
Check with this command.
What Vince says must normally also work, dnsmasq is recent enough to do that

Code:
cat /jffs/scripts/dnsmasq.conf.add
 
Hi,

R u sure the dns rules are not accidentally deleted? :D
Check with this command.
What Vince says must normally also work, dnsmasq is recent enough to do that

Code:
cat /jffs/scripts/dnsmasq.conf.add

Yes, I must have borked it somehow as I am getting "No such file or directory". This is even after a fresh format of jffs. I guess it does not help that I am not very linux savvy. :confused:
 
Last edited:
Yes, I must have borked it somehow as I am getting "No such file or directory". This is even after a fresh format of jffs. I guess it does not help that I am not very linux savvy. :confused:

Try:

cat /jffs/configs/dnsmasq.conf.add

(instead of scripts)
 
Yes, I must have borked it somehow as I am getting "No such file or directory". This is even after a fresh format of jffs. I guess it does not help that I am not very linux savvy. :confused:

sorry my mistake :eek:
Code:
cat /jffs/configs/dnsmasq.conf.add # live vince said
I was tired
 
Hey guys—hope you don't mind me jumping into this thread. I'm trying to set a range of DHCP IPs to use a specific pair of DNS servers via Dnsmasq and I'm having trouble with the setting the range. If I set it individually, via a device's MAC address, it works, but I'd like to set it via an IP range instead.

My router has a DHCP IP range of 192.168.10.10–192.168.10.60

My Dnsmasq entries are as follow:

dhcp-range=net:red,192.168.10.10,192.168.10.60
dhcp-option=net:red,6,206.248.154.170

But, any devices within that range use the routers default DNS server and not 206.248.154.170.

Again, if I also add the following...

dhcp-host=##:##:##:##:##:##,net:red

...that specific devices gets the custom DNS server, but since I won't know the MAC addresses of all the devices, I'm hoping to do this via IP range. Any ideas what I'm doing wrong?

Thanks!
Kristin.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top