What's new

how to redirect all URLs ending in .dev.local to my local server?

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

vesper8

New Around Here
Hi guys,

Been trying to figure this out on my own but can't seem to get it to work.

I'm using the Asus RT-AC66U with 3.0.0.4.374.32 merlin build (thanks for your awesome firmwares!).

My setup is straightforward. I have my ISP modem in bridge mode connected to the router's WAN port and then on my local network 4 computers. I use the DHCP server to assign specific IPs to each computer. One of my computers is my development debian server. Its hostname is "DEV".

I access my development websites by adding .dev.local to the url. So for example http://www.mytestdomain.com.dev.local will do a lookup on my debian server and then nginx picks the ball up from there and it works.

Currently I get this done by manually editing the hosts file on my work computer and pointing each website address manually to the debian's server static ip.

I'd like to get rid of this step and simply have all URLs ending in .dev.local automatically do a lookup on the debian server without having to add new entries to my hosts file on my work computer.

So far I've tried adding "local" as the domain name in the LAN / DHCP config section where it says "RT-AC66U's Domain Name".

Since my server's hostname is already "dev" then I thought this might be enough.

But going to http://www.mytestdomain.com.dev.local doesn't work and I can't ping that domain either it says "cannot resolve, unknown host".

I was about to run the command "dnsmasq -b" on the router but haven't done that yet because frankly I don't properly understand what that does. But apparently it's a feature which is enabled by default on WRT firmwares but not on the asus or merlin builds? I read this on this forum somewhere.

Can someone explain how to get this to work please?

Thanks much!
 
Ok so from my mac mini I can both "ping dev" as well as "ping dev.local" and there's nothing in my mac's hosts file that assists this.. so the router is doing the name resolution correctly as far as that's concerned.

But I still can't "ping www.mywebsite.com.dev.local" or "ping www.mywebsite.com.dev"

And it shouldn't matter but I do have matching nginx vhosts for both those domains. It works if I add entries to the hosts file.

What am I missing? Anyone?

Also, I updated to Asuswrt-Merlin 3.0.0.4.374.33 Beta 1.
 
Ok so from my mac mini I can both "ping dev" as well as "ping dev.local" and there's nothing in my mac's hosts file that assists this.. so the router is doing the name resolution correctly as far as that's concerned.

But I still can't "ping www.mywebsite.com.dev.local" or "ping www.mywebsite.com.dev"

And it shouldn't matter but I do have matching nginx vhosts for both those domains. It works if I add entries to the hosts file.

What am I missing? Anyone?

Also, I updated to Asuswrt-Merlin 3.0.0.4.374.33 Beta 1.


Have you tried to create a custom /jffs/config/dnsmasq.conf.add or hosts.add file ?

see RMerlin's https://github.com/RMerl/asuswrt-merlin/wiki/Custom-config-files

then add either of the following option directives..taken from the DNSMASQ wiki

The solution is to use the companies nameserver for private domains within the company, and dnsmasq allows this. Assuming that internal company machines are all in the domain internal.myco.com and the companies nameserver is at 192.168.10.1 then the option server=/internal.myco.com/192.168.10.1 will direct all queries in the internal domain to the correct nameserver. You can specify more than one domain in each server option. If there is more than one nameserver just include as many server options as is needed to specify them all.

Local domains.
Sometimes people have local domains which they do not want forwarded to upstream servers. This is accomodated by using server options without the server IP address. To make things clearer local is a synonym for server. For example the option local=/localnet/ ensures that any domain name query which ends in .localnet will be answered if possible from /etc/hosts or DHCP, but never sent to an upstream server.

Regards,
 
thank you!!

Here's what I did to get it to work.

I enabled the JFFS partition, I formatted it, rebooted.
Then I enabled SSH and SSHd into the router.
I added a new file called dnsmasq.conf.add in /jffs/configs/
I added this one line in the file:
address=/.dev.local/192.168.0.167

Rebooted the router.. and voila! It works perfectly now!

Thanks for the tip!
 

Similar 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