What's new

Adding Unblock-Us DNS using DNSMasq

  • 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!

Hey thanks for all your hard work again. Not complaining at all here, just thought I'd mention that dnsmasq.conf.add files are still being deleted every time I reboot even with the latest 30_2 firmware.

Make sure you don't have anything clearing the content of your jffs partition (left over in a forgotten user script for example). I can't think of any reason for the directory to get erased at every reboot.
 
Automated script/applet for Tunlr and other DNS services?

Sorry to bring up an old topic.

I'm thinking that a script run at regular intervals, that updates the dnsmasq.conf.add file if required (as per Tunlr API and a text file with set domains) may be the best way to add entries for use with Tunlr.

I haven't done any Python scripting for many years, but willing to brush up on my skills for this project. I'm up for the challenge, as I see this as a great feature for those who'd like it. :)

First for some background info on research done
Now my questions
  1. Does Asuswrt-Merlin support Python scripts?
  2. If so, would the Python script be able to access the internet (if router is online of course) to be able to query the Tunlr API?
  3. Is it possible, and therefore advisable, to store the /jffs/configs directory on a USB flash drive? (I've tried to search for this, but nothing 100% conclusive)
  4. If all this isn't possible, would it be possible as an Entware/Optware package?
  5. Just thought of this... This may just be too difficult, but how hard would an applet similar to Astrill VPN be to create? This appears to be the ideal setup as it is user friendly to add and configure.
I'm looking at creating a domains.txt file that is also accessible on the internet for the script. That way it can be a easy for others to use the script too.

I'm thinking that the script would see if the DNS IP's or the domains.txt have any changes, and only then recreating the dnsmasq.conf.add file.

I'm hoping that if this project if feasible, and works well, then it may be adapted for use with other similar DNS providers.
 
4. Yes. Tested, working.

Here is an archive with all necessary stuff to make it work on Asuswrt-merlin.
 
Last edited:
4. Yes. Tested, working.

Here is an archive with all necessary stuff to make it work on Asuswrt-merlin.
Thanks, I'll have a look at it over the next day or so :)

Update
Just checked out the code at your link, and see you were able to get the existing Python script working with some modification and using the Python Entware package. This answers my 1st question.

I think I'll look at the following over the next day...
  • The update.sh script only seems to update the domains and DNS IP's from pre-set valules. I'll play with it a bit and see if I can answer my 2nd question, in effort to make the script more automated.
  • Also, I didn't realise that you could refer to a different file within the dnsmasq.conf.add file, that is awesome! :cool: I wonder if we can refer it to a file stored on USB, so to prevent excessive writes to the internal memory? (My 3rd question)
In the long run, I think I'd still like to wrap this all up in an applet accessable in the webgui, but that might be biting off more then I can chew ;)
 
Last edited:
The update.sh script only seems to update the domains and DNS IP's from pre-set valules. I'll play with it a bit and see if I can answer my 2nd question, in effort to make the script more automated.
The answer to #2 is: Yes, python script is able to access the internet, it updates Tunlr DNS servers via API that way. But there is no API to get the list of domains. That's why domains.txt is a static list, provided with code.

I wonder if we can refer it to a file stored on USB, so to prevent excessive writes to the internal memory? (My 3rd question)
  • There is no sense to update Tunlr's DNS too often. I think, once per week is optimal.
  • We can't place part of dnsmasq.conf on external drive because USB becomes ready later then dnsmasq starts.
  • We can't guess what comes first: internet connection or dnsmasq initialization, so /jffs/configs/dnsmasq_tunlr.conf must be always ready.

PS IMHO, we can avoid using Python, I think I can rewrite script to use /bin/sh only. If so, neither USB drive, nor Entware will be need.
 
The answer to #2 is: Yes, python script is able to access the internet, it updates Tunlr DNS servers via API that way. But there is no API to get the list of domains. That's why domains.txt is a static list, provided with code.
From what I could see in the code, it didn't obtain the DNS IP's via the API. Within makemasq.py file...
Code:
BYPASS_NAMESERVERS = ('69.197.169.9', '192.95.16.109')
And no reference within the python files of the API URL. That being said, I've already made some changes myself to add this functionality.
Also, from what I can tell on the Tunlr forums, there is no set list of domains as then it would make it easier for the geofencing teams to update their services to stop people using smartDNS's. To work around this, I've created a list here (RAW format).

  • There is no sense to update Tunlr's DNS too often. I think, once per week is optimal.
  • We can't place part of dnsmasq.conf on external drive because USB becomes ready later then dnsmasq starts.
  • We can't guess what comes first: internet connection or dnsmasq initialization, so /jffs/configs/dnsmasq_tunlr.conf must be always ready.
Sounds good. I was thinking of something like this to minimise writes...
IF [online domain list] <> [local domain list] OR [Tunlr DNS IP's via API] <> [Stored Tunlr DNS IP's] THEN perform update.
PS IMHO, we can avoid using Python, I think I can rewrite script to use /bin/sh only. If so, neither USB drive, nor Entware will be need.
Another great idea. I'll finish with the changes I'm working on, and that will be the next step to look into.
 
I did it all a little bit differently.

Instead of creating /jffs/scripts/services-start script, I made /jffs/configs/dnsmasq.conf.add

and added all my server entries in there

here is what the file looks like (all the entries were compiled from unblock-us forums and official how-tos:

Code:
server=/abc.com/208.122.23.22
server=/abc.com/208.122.23.23
server=/abc.com/184.106.242.193
server=/abcfamily.go.com/208.122.23.22
server=/abcfamily.go.com/208.122.23.23
server=/abcfamily.go.com/184.106.242.193
server=/abcnews.go.com/208.122.23.22
server=/abcnews.go.com/208.122.23.23
server=/abcnews.go.com/184.106.242.193
server=/adnxs.com/208.122.23.22
server=/adnxs.com/208.122.23.23
server=/adnxs.com/184.106.242.193
server=/adultswim.com/208.122.23.22
server=/adultswim.com/208.122.23.23
server=/adultswim.com/184.106.242.193
server=/aertv.ie/208.122.23.22
server=/aertv.ie/208.122.23.23
server=/aertv.ie/184.106.242.193
server=/akamaihd.net/208.122.23.22
server=/akamaihd.net/208.122.23.23
server=/akamaihd.net/184.106.242.193
server=/amazon.com/208.122.23.22
server=/amazon.com/208.122.23.23
server=/amazon.com/184.106.242.193
server=/atdmt.com/208.122.23.22
server=/atdmt.com/208.122.23.23
server=/atdmt.com/184.106.242.193
server=/au.tv.yahoo.com/208.122.23.22
server=/au.tv.yahoo.com/208.122.23.23
server=/au.tv.yahoo.com/184.106.242.193
server=/bbc.co.uk/208.122.23.22
server=/bbc.co.uk/208.122.23.23
server=/bbc.co.uk/184.106.242.193
server=/blinkbox.com/208.122.23.22
server=/blinkbox.com/208.122.23.23
server=/blinkbox.com/184.106.242.193
server=/blockbuster.com/208.122.23.22
server=/blockbuster.com/208.122.23.23
server=/blockbuster.com/184.106.242.193
server=/brightcove.com/208.122.23.22
server=/brightcove.com/208.122.23.23
server=/brightcove.com/184.106.242.193
server=/cbs.com/208.122.23.22
server=/cbs.com/208.122.23.23
server=/cbs.com/184.106.242.193
server=/channel4.com/208.122.23.22
server=/channel4.com/208.122.23.23
server=/channel4.com/184.106.242.193
server=/channel5.com/208.122.23.22
server=/channel5.com/208.122.23.23
server=/channel5.com/184.106.242.193
server=/chartbeat.com/208.122.23.22
server=/chartbeat.com/208.122.23.23
server=/chartbeat.com/184.106.242.193
server=/cinemanow.com/208.122.23.22
server=/cinemanow.com/208.122.23.23
server=/cinemanow.com/184.106.242.193
server=/cpxadroit.com/208.122.23.22
server=/cpxadroit.com/208.122.23.23
server=/cpxadroit.com/184.106.242.193
server=/cpxinteractive.com/208.122.23.22
server=/cpxinteractive.com/208.122.23.23
server=/cpxinteractive.com/184.106.242.193
server=/crackle.com/208.122.23.22
server=/crackle.com/208.122.23.23
server=/crackle.com/184.106.242.193
server=/ctv.ca/208.122.23.22
server=/ctv.ca/208.122.23.23
server=/ctv.ca/184.106.242.193
server=/cwtv.com/208.122.23.22
server=/cwtv.com/208.122.23.23
server=/cwtv.com/184.106.242.193
server=/demdex.net/208.122.23.22
server=/demdex.net/208.122.23.23
server=/demdex.net/184.106.242.193
server=/doubleclick.net/208.122.23.22
server=/doubleclick.net/208.122.23.23
server=/doubleclick.net/184.106.242.193
server=/foodnetwork.com/208.122.23.22
server=/foodnetwork.com/208.122.23.23
server=/foodnetwork.com/184.106.242.193
server=/fox.com/208.122.23.22
server=/fox.com/208.122.23.23
server=/fox.com/184.106.242.193
server=/fwmrm.net/208.122.23.22
server=/fwmrm.net/208.122.23.23
server=/fwmrm.net/184.106.242.193
server=/gamecenter.nhl.com/208.122.23.22
server=/gamecenter.nhl.com/208.122.23.23
server=/gamecenter.nhl.com/184.106.242.193
server=/go.com/208.122.23.22
server=/go.com/208.122.23.23
server=/go.com/184.106.242.193
server=/google-analytics.com/208.122.23.22
server=/google-analytics.com/208.122.23.23
server=/google-analytics.com/184.106.242.193
server=/hgtv.com/208.122.23.22
server=/hgtv.com/208.122.23.23
server=/hgtv.com/184.106.242.193
server=/hulu.com/208.122.23.22
server=/hulu.com/208.122.23.23
server=/hulu.com/184.106.242.193
server=/iheart.com/208.122.23.22
server=/iheart.com/208.122.23.23
server=/iheart.com/184.106.242.193
server=/imrworldwide.com/208.122.23.22
server=/imrworldwide.com/208.122.23.23
server=/imrworldwide.com/184.106.242.193
server=/itv.com/208.122.23.22
server=/itv.com/208.122.23.23
server=/itv.com/184.106.242.193
server=/kidlet.tv/208.122.23.22
server=/kidlet.tv/208.122.23.23
server=/kidlet.tv/184.106.242.193
server=/last.fm/208.122.23.22
server=/last.fm/208.122.23.23
server=/last.fm/184.106.242.193
server=/mlb.tv/208.122.23.22
server=/mlb.tv/208.122.23.23
server=/mlb.tv/184.106.242.193
server=/mog.com/208.122.23.22
server=/mog.com/208.122.23.23
server=/mog.com/184.106.242.193
server=/mtv.com/208.122.23.22
server=/mtv.com/208.122.23.23
server=/mtv.com/184.106.242.193
server=/mtvnservices.com/208.122.23.22
server=/mtvnservices.com/208.122.23.23
server=/mtvnservices.com/184.106.242.193
server=/mylifetime.com/208.122.23.22
server=/mylifetime.com/208.122.23.23
server=/mylifetime.com/184.106.242.193
server=/mytv.taiseng.com/208.122.23.22
server=/mytv.taiseng.com/208.122.23.23
server=/mytv.taiseng.com/184.106.242.193
server=/nbc.com/208.122.23.22
server=/nbc.com/208.122.23.23
server=/nbc.com/184.106.242.193
server=/nbcsports.msnbc.com/208.122.23.22
server=/nbcsports.msnbc.com/208.122.23.23
server=/nbcsports.msnbc.com/184.106.242.193
server=/netflix.com/208.122.23.22
server=/netflix.com/208.122.23.23
server=/netflix.com/184.106.242.193
server=/pandora.com/208.122.23.22
server=/pandora.com/208.122.23.23
server=/pandora.com/184.106.242.193
server=/pbs.com/208.122.23.22
server=/pbs.com/208.122.23.23
server=/pbs.com/184.106.242.193
server=/quantserve.com/208.122.23.22
server=/quantserve.com/208.122.23.23
server=/quantserve.com/184.106.242.193
server=/rdio.com/208.122.23.22
server=/rdio.com/208.122.23.23
server=/rdio.com/184.106.242.193
server=/rhapsody.com/208.122.23.22
server=/rhapsody.com/208.122.23.23
server=/rhapsody.com/184.106.242.193
server=/rte.ie/208.122.23.22
server=/rte.ie/208.122.23.23
server=/rte.ie/184.106.242.193
server=/rubiconproject.com/208.122.23.22
server=/rubiconproject.com/208.122.23.23
server=/rubiconproject.com/184.106.242.193
server=/scorecardresearch.com/208.122.23.22
server=/scorecardresearch.com/208.122.23.23
server=/scorecardresearch.com/184.106.242.193
server=/southparkstudios.com/208.122.23.22
server=/southparkstudios.com/208.122.23.23
server=/southparkstudios.com/184.106.242.193
server=/sportsnet.ca/208.122.23.22
server=/sportsnet.ca/208.122.23.23
server=/sportsnet.ca/184.106.242.193
server=/spotify.com/208.122.23.22
server=/spotify.com/208.122.23.23
server=/spotify.com/184.106.242.193
server=/tbs.com/208.122.23.22
server=/tbs.com/208.122.23.23
server=/tbs.com/184.106.242.193
server=/theplatform.com/208.122.23.22
server=/theplatform.com/208.122.23.23
server=/theplatform.com/184.106.242.193
server=/thewb.com/208.122.23.22
server=/thewb.com/208.122.23.23
server=/thewb.com/184.106.242.193
server=/tnt.tv/208.122.23.22
server=/tnt.tv/208.122.23.23
server=/tnt.tv/184.106.242.193
server=/trutv.com/208.122.23.22
server=/trutv.com/208.122.23.23
server=/trutv.com/184.106.242.193
server=/turntable.fm/208.122.23.22
server=/turntable.fm/208.122.23.23
server=/turntable.fm/184.106.242.193
server=/tv.com/208.122.23.22
server=/tv.com/208.122.23.23
server=/tv.com/184.106.242.193
server=/tv3.ie/208.122.23.22
server=/tv3.ie/208.122.23.23
server=/tv3.ie/184.106.242.193
server=/uk.eurosport.yahoo.com/208.122.23.22
server=/uk.eurosport.yahoo.com/208.122.23.23
server=/uk.eurosport.yahoo.com/184.106.242.193
server=/unblock-us.com/208.122.23.22
server=/unblock-us.com/208.122.23.23
server=/unblock-us.com/184.106.242.193
server=/universalsports.com/208.122.23.22
server=/universalsports.com/208.122.23.23
server=/universalsports.com/184.106.242.193
server=/usanetwork.com/208.122.23.22
server=/usanetwork.com/208.122.23.23
server=/usanetwork.com/184.106.242.193
server=/vevo.com/208.122.23.22
server=/vevo.com/208.122.23.23
server=/vevo.com/184.106.242.193
server=/video.pbs.org/208.122.23.22
server=/video.pbs.org/208.122.23.23
server=/video.pbs.org/184.106.242.193
server=/video.uk.msn.com/208.122.23.22
server=/video.uk.msn.com/208.122.23.23
server=/video.uk.msn.com/184.106.242.193
server=/vudu.com/208.122.23.22
server=/vudu.com/208.122.23.23
server=/vudu.com/184.106.242.193

Now it works on any device that is connected to my AC66U with no config needed on that device, as long as your dnsmasq assigns itself as primary dns to all the clients.

Great list but dont understand why do we have to add unblock-us domain swell
 
found this https://mediahint.com/ ....for those who cannot get the script to work
works on FF and Chrome

btw some sites listed in the dnsmasq.conf.add are not working...like cwtv.com and ctv.ca any ideas on that ? i used ryzhov_al's script
 
Last edited:
Hey, I followed your how-to (thanks first of all!!) and added your Tunlr script to the jffs scripts but somehow my Asus AC66U is still not using the Tunlr DNS. I was wondering if I have to change settings in the GUI of the router?

I have an Easybox modem/router combo (wireless off) which connects lan->wan to my Asus router (wireless on). I want to use my ISP DNS server for normal web browsing but need the Tunlr DNS server for watching Netflix on my Roku. Do I have to enable DNSmasq first or did I overlook sth in my setup that stops the script from working?

Thanks for your help!
 
I had trouble with dnsmasq after updating firmware. I suggest to reset your asus and re-apply your setting and see what's happening.

On the other hand, I had trouble with unblock-us or other related service. I created my own "unblock-us" kind of service. Here my post: http://forums.smallnetbuilder.com/showthread.php?t=13797 You need a vpn connection for sending some trafic in the US and an old router to manage the VPN connection. I use purevpn service. At the end, it's cheaper than unblock-us.

Basicly, my script update dnsmasq to return specific IP for each domain I want. After, It create a static route to send traffic for those IP to the old router managing the VPN, so that trafic goes by your vpn connection. I have all needed domaine for netflix, pandora, Hulu, nhl if someone ask. Like unblock-us, only specified domaine will goes by vpn and at the end, CDN server will send you directly the content and not by the vpn. An other possiblility, if you want a device to always use the vpn as gateway, you can modify dnsmask.conf and specify the ip of your old router as the gateway for the MAC address of your device. DHCP will manage the rest ;) . For exemple, Roku can't manage vpn, but using this strategy, it can!
 
Yes, just did this for tunlr.net dns. You need ad the options to dnsmasq.conf and restart dnsmasq. To do this automatically at every boot you can use the services-start script:

1. Enabele jffs in the router webui and restart.
2. ssh to the router and mkdir /jffs/scripts/
3. vi /jffs/scripts/services-start and paste:

#!/bin/sh
echo "server=/netflix.com/208.122.23.22" >> /tmp/etc/dnsmasq.conf
echo "server=/netflix.com/208.122.23.23" >> /tmp/etc/dnsmasq.conf
killall dnsmasq
dnsmasq -c 1500 --log-async -n

4. save and chmod +x /jffs/scripts/services-start
5. restart router

Best of luck.

What Jacobno is describing above is what I am attempting to do but I am having no luck getting it to work.
After completing steps 1-3 and saving the file I confirm that I have the content correct. Issuing cat /jffs/scripts/services-start displays the following:

#!/bin/sh
echo "server=/netflix.com/208.122.23.22" >> /tmp/etc/dnsmasq.conf
echo "server=/netflix.com/208.122.23.23" >> /tmp/etc/dnsmasq.conf
killall dnsmasq
dnsmasq -c 1500 --log-async -n



I then do steps 4 and 5 describe above but I am sure nothing is happening. When I cat /tmp/etc/dnsmasq.conf none of the above data is present in the file. I know it isnt working because when I connect to netflix it is still the Canadian site.


I have magaed to get it working for just my roku by
echo "dhcp-host=<roku-mac>,set: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



But I need this to work for anyone/thing connected to the router that want to access netflix



Some please point me in the right direction
 
Last edited:
Update:

Omg why do I always make things so difficult for myself. All that was needed was:

echo "server=/netflix.com/208.122.23.22" >> /jffs/configs/dnsmasq.conf.add
echo "server=/netflix.com/208.122.23.23" >> /jffs/configs/dnsmasq.conf.add
reboot

and it works like a charm :)
 
Last edited:
I had trouble with dnsmasq after updating firmware. I suggest to reset your asus and re-apply your setting and see what's happening.

On the other hand, I had trouble with unblock-us or other related service. I created my own "unblock-us" kind of service. Here my post: http://forums.smallnetbuilder.com/showthread.php?t=13797 You need a vpn connection for sending some trafic in the US and an old router to manage the VPN connection. I use purevpn service. At the end, it's cheaper than unblock-us.

Basicly, my script update dnsmasq to return specific IP for each domain I want. After, It create a static route to send traffic for those IP to the old router managing the VPN, so that trafic goes by your vpn connection. I have all needed domaine for netflix, pandora, Hulu, nhl if someone ask. Like unblock-us, only specified domaine will goes by vpn and at the end, CDN server will send you directly the content and not by the vpn. An other possiblility, if you want a device to always use the vpn as gateway, you can modify dnsmask.conf and specify the ip of your old router as the gateway for the MAC address of your device. DHCP will manage the rest ;) . For exemple, Roku can't manage vpn, but using this strategy, it can!

i am still trying to figure out how to get ryzhov_al script to work. my asus is connected wan to lan with a seperate modem. i am not sure what settings in the asus gui i have to put in the categories wireless, lan and wan? right now it is set to automatic ip under wan connection type and wan dns settings is set to automatically connect to dns server. in lan settings the dhcp server is enabled. still it is not using tunlr when i go to netflix.com.

any ideas?
 
To my talented friends. Can anyone confirm they have this working for mlb.tv and a roku? I have the following in my dnsmasq.conf.add file but still no dice.

server=/mlb.tv/208.122.23.23
server=/mlb.mlb.com/208.122.23.23
server=/unblock-us/208.122.23.23

Also have the .22 address in there. Can anyone tell me how to figure out what other servers the roku app might be connecting to so I can redirect them in dnsmasq? Thanks
 
To my talented friends. Can anyone confirm they have this working for mlb.tv and a roku? I have the following in my dnsmasq.conf.add file but still no dice.

server=/mlb.tv/208.122.23.23
server=/mlb.mlb.com/208.122.23.23
server=/unblock-us/208.122.23.23

Seems right to me except I don't understand why you have
server=/unblock-us/208.122.23.23
Not needed as far as I know. I use "unblock-us" as well but for netflix and amazon. All I have for those is

server=/netflix.com/208.122.23.22
server=/netflix.com/208.122.23.23
server=/netflix.net/208.122.23.22
server=/netflix.net/208.122.23.23
server=/amazon.com/208.122.23.22
server=/amazon.com/208.122.23.23"
 
Seems right to me except I don't understand why you have
server=/unblock-us/208.122.23.23
Not needed as far as I know. I use "unblock-us" as well but for netflix and amazon. All I have for those is

server=/netflix.com/208.122.23.22
server=/netflix.com/208.122.23.23
server=/netflix.net/208.122.23.22
server=/netflix.net/208.122.23.23
server=/amazon.com/208.122.23.22
server=/amazon.com/208.122.23.23"
Well I just did what the others above us did. If you look back on those long lists that users created they include unblock-us.com. Could this possibly be causing the problem?
 

Similar threads

Latest threads

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