What's new

AC68U: routing server name in WAN and LAN

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

gjf

Senior Member
Hi!

I am using AC68U router with latest Merlin firmware.
I am using DDNS service so my router is known as xxx.linkpc.net
The problem is as follows.
I am using different programs to connect to router in LAN as well as when connecting distanlty (from WAN). It is not very convenient to use either "Distand" settings or "Local" settings in these programs.
Is it possible to setup the router in such way so it will ressolve "xxx.linkpc.net" for LAN users as "192.168.0.1" (router IP) - overcoming a real IP from DNS in world? In this case I can use xxx.linkpc.net as server name in every program and it will make this setting universal both for LAN and WAN connections.
 
Hello gjf,

You can use the "hosts" file for that via SSH/telnet.

To check the actual file content:
Code:
cat /etc/hosts

To add a new line: (pay attention, you need to use ">>", a single ">" will erase the actual content)
Code:
echo "192.168.0.1 xxx.linkpc.net" >> /etc/hosts

To check that it is working:
Code:
ping xxx.linkpc.net

Note 1: All clients need to use this router as DNS server.
Note 2: If it doesn't work, restart the DNS server with "killall dnsmasq", then start again running "dnsmasq".
Note 3: If the client resolve that external IP, try to flush the DNS cache, running at the client computer: "ipconfig /flushdns" (if it is a windows box)
Note 4: Try to reboot the router and check if this configuration will persists. I believe that you will need to put that at a startup-script (the /etc/hosts will not persist after a reboot)
 
Last edited:
  • Like
Reactions: gjf
Thanks for your answer!
I wonder why router has no a special setting in firmware for that.
 
... is this not the "loopback" functionality you are lookinf for ?
On my 87U with 378.53, I am always using my DDNS names to access my devices (e.g ip cams), and even when I am on my LAN, it works without any need to do specific config ....
 
... is this not the "loopback" functionality you are lookinf for ?
On my 87U with 378.53, I am always using my DDNS names to access my devices (e.g ip cams), and even when I am on my LAN, it works without any need to do specific config ....
Nope. Sure I can put xxx.linkpc.net as Router name in LAN IP setting, but when I try to ping xxx.linkpc.net it shows external IP, not LAN one.
 
Thanks for your answer!
I wonder why router has no a special setting in firmware for that.

Because it's usually a bad idea to have two resolvers return different results. And this is a very niche, specific case that the vast majority of users wouldn't want to use, as this is what the NAT loopback is designed to transparently address.

You can easily provide your own custom IPs simply by creating a custom hosts.add config file. See the Wiki for more info:

https://github.com/RMerl/asuswrt-merlin/wiki/Custom-config-files
 
I wonder about these records in my /etc/hosts:

Is "192.168.0.1 Router.MyDomain Router" correct syntax? I think it should be presented in two lines:

Yes, it's. the "router" is a alias. (http://man7.org/linux/man-pages/man5/hosts.5.html)
For example, if I have the FQDN "server.domain.com" and internally the hostname is "server", so a single line will do the job.

Please, note that the RMerlin's post is better, because the change will be persistent (using custom hosts.add config file).
 

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