What's new

Need my rt-ax92u to resolve a certain address always to a certain IP

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

armand

Occasional Visitor
I need ap-gew4.spotify.com to resolve to 104.199.65.124 is there any way to make the router do that? It cannot be done one the device itself, so it needs to be done on the router
 
Assuming the client is using the router as its DNS server you could edit the hosts file on the router. But the change would be lost when the router was rebooted or changes are made in the GUI.
 
Log into the router using SSH or Telnet and append the required line to the end of the file:
Code:
cd /etc
echo "104.199.65.124 ap-gew4.spotify.com" >> hosts

Check that you've added it correctly by printing the contents of the hosts file:
Code:
cat hosts

Get the DNS server to reload the hosts file:
Code:
killall -s SIGHUP dnsmasq

Verify that it's working from a PC with the following command:
Code:
nslookup ap-gew4.spotify.com
 
Last edited:
how do I do that?
Download putty, https://www.putty.org/ make sure SSH is on in Administration - System (LAN Only), enter root (router) ip in putty, usually 192.168.1.1 and port, click connect, log in with router credentials, and have fun.
 
If you plan to do this on a regular basis, might not be a bad idea (for convenience purposes) to turn it into a one-liner w/ ssh (assuming you also are using public/private keypairs for ssh authentication).

Code:
ssh <user>@router.asus.com 'echo "104.199.65.124 ap-gew4.spotify.com" >> //etc//hosts'

On a Linux desktop, I would then turn it into an alias.

NOTE: You shouldn't need to restart DNSMasq. It actively monitors //etc//hosts for changes. At least I never had to do so when using Merlin (maybe OEM is different?) for my DNS monitoring utility, which changes that file in order to enable/disable the WAN connectivity check.

P.S. I had to use double forward slashes for the hosts file due to the forum NOT allowing me to reference it w/ single forward slashes (which is ridiculous). Either way will work for execution purposes.
 
Last edited:
NOTE: You shouldn't need to restart DNSMasq. It actively monitors //etc//hosts for changes. At least I never had to do so when using Merlin (maybe OEM is different?) for my DNS monitoring utility, which changes that file in order to enable/disable the WAN connectivity check.
I thought that as well but had to go back and add that to my original post because it wasn't doing that. The reason being that dnsmasq.conf contains no-poll. Maybe stock firmware is different.

An alternative to the restart is to send SIGHUP to the process:
Code:
killall -s SIGHUP dnsmasq
In fact, I'll go back and change that in my previous post. ;)
 
I thought that as well but had to go back and add that to my original post because it wasn't doing that. The reason being that dnsmasq.conf contains no-poll. Maybe stock firmware is different.

An alternative to the restart is to send SIGHUP to the process:
Code:
killall -s SIGHUP dnsmasq
In fact, I'll go back and change that in my previous post. ;)

Updated.

Code:
ssh <user>@router.asus.com 'echo "104.199.65.124 ap-gew4.spotify.com" >> //etc//hosts; killall -s SIGHUP dnsmasq'
 
thanks everyone, the command works, unfortunately it did not solve the problem. Afterwards my wifi speakers refuse to connect, usually this is solved with a reset of the router but than the host file addition is erased too
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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