What's new

Primary usb-wan DNS

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

noric

Senior Member
Hello,
my primary (and only) WAN is my 3G dongle. It looks there is no custom DNS setting available in the GUI with this setup. The fw versione is 380.70 and the router is an RT-AC68U.

How could I set a custom DNS with my setup? I've tried the following nvram entries:
Code:
usb_wan_dns1_x=8.8.8.8
usb_wan_dns2_x=8.8.4.4
usb_wan_dns=8.8.8.8 8.8.4.4
usb_wan_dnsenable_x=0
wan0_dns1_x=8.8.8.8
wan0_dns2_x=8.8.4.4
wan0_dns=8.8.8.8 8.8.4.4
wan0_dnsenable_x=0
wan_dns1_x=8.8.8.8
wan_dns2_x=8.8.4.4
wan_dns=8.8.8.8 8.8.4.4
wan_dnsenable_x=0

and the following entry has automatically changed too:
Code:
wan0_xdns=8.8.8.8 8.8.4.4

but after reboot my ISP's DNS is restored as default:
Code:
wan0_dns=62.13.173.92 62.13.173.93
wan_dns=62.13.173.92 62.13.173.93

Thanks
 
Any reason you're using such an old firmware? The latest is 384.9.

Reset to factory defaults and minimal and manual configuration is recommended.
 
Any reason you're using such an old firmware? The latest is 384.9.

Reset to factory defaults and minimal and manual configuration is recommended.
The firmware is very stable for me. And I have read on the internet that my problem is well known, but I haven't found a solution. Just some hints by @ColinTaylor here: https://www.snbforums.com/threads/dsl-ac68u-not-resolving-dns.40606/#post-341385

Anyway, I've done a factory reset a month ago and I haven't changed a lot of settings from default. The setup is quite clean.
 
If you haven't tried the latest firmware, how are you so sure that the newest firmware is not just as stable? :)

The easiest way may be that you need to put a command that runs after a reboot to set the DNS IP's wanted. Other members here can show you better than me how to do that.
 
What about using /jffs/scripts/dnsmasq.postconf to manually set your DNS?

Code:
#!/bin/sh

source /usr/sbin/helper.sh

# Remove default servers
pc_delete "servers-file=" "$1"
pc_delete "resolv-file=" "$1"
pc_append "no-resolv" "$1"
# Add google public IPv4
pc_append "server=8.8.8.8" "$1"
pc_append "server=8.8.4.4" "$1"
# Add google public IPv6
pc_append "server=2001:4860:4860::8888" "$1"
pc_append "server=2001:4860:4860::8844" "$1"

And use the command "server restart_dnsmasq" "service restart_dnsmasq" to apply.
 
Last edited:
I think @Dabombber has the solution. However I believe the pc_delete line needs to be changed as shown below. That is because the older firmware versions used resolv-file instead of servers-file.
Code:
# Remove default servers
pc_delete "resolv-file=" "$1"
(Or have both pc_delete lines then it should work with both old and new firmware.)
 
Yea, can't hurt to have both, edited my post.
Does the servers-file ever contain anything else other than the WAN DNS servers? If it does then removing it could cause problems.

(I can't check for myself as I don't run that firmware)
 
I'm on at AC86U, merlin 384.19. I have my WAN set to USB using an Android phone, Dual WAN is disabled. This works well and I have stable internet and can tunnel. But there is no ability in GUI to change DNS which is therefore controlled by my ISP. In order to set this, I have followed the above instructions as best I can, but I am missing something that may be obvious.

I am new to this area of configuration (scripts and postconf files) so I read the info on GitHub (https://github.com/RMerl/asuswrt-merlin.ng/wiki/User-scripts) and the section on postconf files, however I'm still unclear where I could be going wrong.

I have created a text file called dnsmasq.postconf in /jffs/scripts as suggested by Dabommber in post 5. (I've commented out the IPv6 lines which I don't use, and substituted 1.1.1.1 and 1.0.0.1 in place of the Google servers. Other than that it is typed out exactly as shown. The script seems to have run at reboot as I added a "touch" line which has created the file I named in it. But the nvram values for wan_dns and wan0_dns remain those of the ISP and not 1.1.1.1 as I would have expected.

Should I be referencing this script in one of the other files?

Also, I tried the command server restart_dnsmasq suggested but I get -sh: server: not found.
 
The script seems to have run at reboot as I added a "touch" line which has created the file I named in it. But the nvram values for wan_dns and wan0_dns remain those of the ISP and not 1.1.1.1 as I would have expected.
The script doesn't change any nvram variables, it modifies the dnsmasq configuration file. Check that the modifications have been applied successfully by looking at the file:
Code:
cat /etc/dnsmasq.conf
 
The servers I set appear at the bottom of my dnsmasq.conf as you suggest. The command now works!

Just to help me understand, what's the difference between the contents of etc/dnsmasq.conf and the values in nvram - don't they conflict at all?

Now I've reset, the nvram is still showing the address I've been allocated as the WAN in wan_dns and wan0_dns. Am I right to think that that's the interface where the DNS traffic must go, and dnsmasq.conf tells it that when it gets there, to bypass whatever the ISP has set and go on to 1.1.1.1?
 
When a service like dnsmasq starts up (e.g. at boot) the firmware reads any relevant variables from nvram and uses them to create the configuration file (e.g. /etc/dnsmasq.conf). It has to do it this way because the /etc filesystem only exists in memory and is lost when the router is rebooted. The dnsmasq process only uses it's config file, it doesn't directly access nvram variables.

Merlin's firmware allows users to modify the config file by inserting a "hook" after then config file has been generated but just before the dnsmasq process is started. This is what the dnsmasq.postconf script is doing.
 
When a service like dnsmasq starts up (e.g. at boot) the firmware reads any relevant variables from nvram and uses them to create the configuration file (e.g. /etc/dnsmasq.conf). It has to do it this way because the /etc filesystem only exists in memory and is lost when the router is rebooted. The dnsmasq process only uses it's config file, it doesn't directly access nvram variables.

Merlin's firmware allows users to modify the config file by inserting a "hook" after then config file has been generated but just before the dnsmasq process is started. This is what the dnsmasq.postconf script is doing.
Thanks a lot for this explanation. I had no idea the /etc file system was volatile! - a pretty fundamental piece of knowledge. This now makes much more sense.

Now to read up more on the dnsmasq process.
 

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