What's new

Proper local DNS name resolution possible?

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

busch09

Regular Contributor
Hi,

is there a way to force dnsmasq to assign a new hostname based on mac address without having to maintain the hostname in two files/locations (dnsmasq.conf.add and hosts.dnsmasq?

Is there a way to retain domain .home but not have to add the whole FDQN each time ? Eg resolve http://inf-dlink-cam1? would that be adding address=//127.0.0.1?

In order to get
a) static Ips for my devices
b) turn "Hangzou Industrial Conglomerate" into "Cam1-backyard"

names resolve fine with http://inf-dlink-cam1.home

I have added to dnsmasq.conf.add:
address=/home/127.0.0.1
address=/home/::1
addn-hosts=/jffs/configs/hosts.dnsmasq
dhcp-option=42,0.0.0.0
dhcp-option=option6:information-refresh-time,6h
dhcp-host=B0:C5:54:31:31:5F,INF-DLINK-Cam1,192.168.1.184,20m
dhcp-host=5C:96:9D:84:F2:B7,PC-Macpro2012,192.168.1.60,20m

hosts.dnsmasq:
192.168.1.60 . PC-Macpro2012
192.168.1.184 . INF-DLINK-CAM1

System startup log looks ok (fwd slash removed):
May 4 22:05:06 custom_config: Appending content of jffs configs dnsmasq.conf.add.
May 4 22:05:06 dnsmasq[313]: started, version 2.80-32-g28cfe36 cachesize 1500
May 4 22:05:06 dnsmasq[313]: compile time options: IPv6 GNU-getopt no-RTC no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset no-auth DNSSEC no-ID loop-detect no-inotify no-dumpfile
May 4 22:05:06 dnsmasq[313]: warning: interface pptp* does not currently exist
May 4 22:05:06 dnsmasq[313]: asynchronous logging enabled, queue limit is 5 messages
May 4 22:05:06 dnsmasq-dhcp[313]: DHCP, IP range 192.168.1.100 -- 192.168.1.254, lease time 1d
May 4 22:05:06 dnsmasq[313]: using local addresses only for domain home
May 4 22:05:06 dnsmasq[313]: read etc hosts - 5 addresses
May 4 22:05:06 dnsmasq[313]: read jffs configs hosts.dnsmasq - 2 addresses
May 4 22:05:06 dnsmasq[313]: using local addresses only for domain home
May 4 22:05:06 custom_config: Appending content of jffs configs avahi-daemon.conf.add.
 

Attachments

  • upload_2019-3-5_13-4-36.png
    upload_2019-3-5_13-4-36.png
    15.2 KB · Views: 429
  • upload_2019-3-5_13-7-48.png
    upload_2019-3-5_13-7-48.png
    37.8 KB · Views: 279
Hi,

is there a way to force dnsmasq to assign a new hostname based on mac address without having to maintain the hostname in two files/locations (dnsmasq.conf.add and hosts.dnsmasq?

Is there a way to retain domain .home but not have to add the whole FDQN each time ? Eg resolve http://inf-dlink-cam1? would that be adding address=//127.0.0.1?

In order to get
a) static Ips for my devices
b) turn "Hangzou Industrial Conglomerate" into "Cam1-backyard"

names resolve fine with http://inf-dlink-cam1.home

I have added to dnsmasq.conf.add:
address=/home/127.0.0.1
address=/home/::1
addn-hosts=/jffs/configs/hosts.dnsmasq
dhcp-option=42,0.0.0.0
dhcp-option=option6:information-refresh-time,6h
dhcp-host=B0:C5:54:31:31:5F,INF-DLINK-Cam1,192.168.1.184,20m
dhcp-host=5C:96:9D:84:F2:B7,PC-Macpro2012,192.168.1.60,20m

hosts.dnsmasq:
192.168.1.60 . PC-Macpro2012
192.168.1.184 . INF-DLINK-CAM1

System startup log looks ok (fwd slash removed):
May 4 22:05:06 custom_config: Appending content of jffs configs dnsmasq.conf.add.
May 4 22:05:06 dnsmasq[313]: started, version 2.80-32-g28cfe36 cachesize 1500
May 4 22:05:06 dnsmasq[313]: compile time options: IPv6 GNU-getopt no-RTC no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset no-auth DNSSEC no-ID loop-detect no-inotify no-dumpfile
May 4 22:05:06 dnsmasq[313]: warning: interface pptp* does not currently exist
May 4 22:05:06 dnsmasq[313]: asynchronous logging enabled, queue limit is 5 messages
May 4 22:05:06 dnsmasq-dhcp[313]: DHCP, IP range 192.168.1.100 -- 192.168.1.254, lease time 1d
May 4 22:05:06 dnsmasq[313]: using local addresses only for domain home
May 4 22:05:06 dnsmasq[313]: read etc hosts - 5 addresses
May 4 22:05:06 dnsmasq[313]: read jffs configs hosts.dnsmasq - 2 addresses
May 4 22:05:06 dnsmasq[313]: using local addresses only for domain home
May 4 22:05:06 custom_config: Appending content of jffs configs avahi-daemon.conf.add.
If you're looking at the network list. You can click them change the name and click outside the text box.

This makes them appear to what you defined in most places. If that helps.
 
is there a way to force dnsmasq to assign a new hostname based on mac address without having to maintain the hostname in two files/locations (dnsmasq.conf.add and hosts.dnsmasq?
Just set it up in LAN - DHCP Server. There's no need to manually edit files.

Is there a way to retain domain .home but not have to add the whole FDQN each time ? Eg resolve http://inf-dlink-cam1? would that be adding address=//127.0.0.1?
If your router's domain name is configured as ".home" then there's nothing else to do, assuming your network is setup correctly. You definitely don't want to add address=.

In order to get
a) static Ips for my devices
b) turn "Hangzou Industrial Conglomerate" into "Cam1-backyard"
The "Clients Name" is not the same as a DNS host name.
 
  • Do not manage hosts.dnsmasq. Not sure what the period as second field could be.
  • Do you have a "domain=home" line in dnsmasq.conf.add?
  • What is this "dhcp-option=option6:information-refresh-time,6h"?
  • The correct syntax of dhcp-host is MAC, IP address, host, lease
  • A twenty minute lease?
 
Last edited:
Researching this problem for myself I've found this info in RFC 6762 thanks to this answer on serverfault. TL;DR - the only recommended solution is registering your own domain name.

Some network operators setting up private internal networks
("intranets") have used unregistered top-level domains, and some may
have used the ".local" top-level domain. Using ".local" as a private
top-level domain conflicts with Multicast DNS and may cause problems
for users. Clients can be configured to send both Multicast and
Unicast DNS queries in parallel for these names, and this does allow
names to be looked up both ways, but this results in additional
network traffic and additional delays in name resolution, as well as
potentially creating user confusion when it is not clear whether any
given result was received via link-local multicast from a peer on the
same link, or from the configured unicast name server. Because of
this, we recommend against using ".local" as a private Unicast DNS
top-level domain. We do not recommend use of unregistered top-level
domains at all, but should network operators decide to do this, the
following top-level domains have been used on private internal
networks without the problems caused by trying to reuse ".local." for
this purpose:

.intranet.
.internal.
.private.
.corp.
.home.
.lan.

So basically there's no safe/reserved TLD's for anyone to use freely on their intranet. Best option is to pay to register a domain name, or worst option is to use an unregistered TLD for free, ideally a TLD from that list above. You could argue that it's safer to use one from that list simply because many in the IT community relies on them and would push-back against anybody attempting to register them. If you instead opted to invent a TLD domain suffix for your intranet use then it could be registered in future, which you might not discover until after your network goes weird.
 
@Zonkd This was already discussed here. Note the part called Safe Private Domains.

That said, I don't think this is the actual problem the OP was talking about. Although that's hard to know as he posted a series of questions and when people took the time to answer he didn't even bother to acknowledge them. :rolleyes:
 
@ColinTaylor Haha, well I shared same problem as OP and goal was not manually editing dnsmasq.conf.add and hosts.dnsmasq to assign NAS hostname via DHCP. Half way through typing my question to post here I felt like I'd researched enough to answer my own question. So instead I posted what I'd learned so far, feeling confident I'd be informed if I'd missed anything. I can always count on you to point me in the right direction ;) I didn't spot that awesome thread post by @sfx2000. Damn comprehensive. I was going to use .lan but now I know it's better to use .home :)

So I've already tested it works but may as well check with you to be sure: is the correct method of pushing the .home domain across my LAN via DHCP by filling .home into the field "RT-ACxxx's Domain Name" on Advanced DHCP content web page? Looking at dnsmasq.conf it looks like that adds entries domain and local?

Code:
admin@RT-AC68U:/tmp/etc# cat dnsmasq.conf
domain=home
local=/home/

LfKCpVL.png
 
I was going to use .lan but now I know it's better to use .home :)
Personally I use "home.lan". I believe @john9527 does as well.

is the correct method of pushing the .home domain across my LAN via DHCP by filling .home into the field "RT-ACxxx's Domain Name" on Advanced DHCP content web page?
Your screenshot is correct. That field should contain "home", but not ".home" as you wrote.
 
You just need to make sure that you don't use a reserved TLD. .local for instance should not be used.
 
I'm a nosy panda, always itching to ask why? Is .lan just a personal preference for you guys? As I said, I was originally planning to use .lan. If it's safe to do so, then I'd still like to.

Can use it for now - but ICANN can always make this a public TLD at some point...
 
Researching this problem for myself I've found this info in RFC 6762 thanks to this answer on serverfault. TL;DR - the only recommended solution is registering your own domain name.

Safe Private Domains - as per ICANN agreement - these can safely be used without conflict with public TLD's

.home
.corp
.mail
While RFC6762 suggests that "private", "internal", "intranet", and "lan" - the verbiage is 'should', ICANN has only agreed to the TLD's mentioned above
 

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