What's new

DNSmasq is not attaching domain name to hostnames

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

bgvaughan

Occasional Visitor
All domain names and IP addresses are falsified to protect pre-adolescent Minecraft enthusiasts. I'm currently using the firmware 3.0.0.3.178.15 (Merlin build).

I've been using manually assigned IPs via DHCP on my router for some time. Recently, I assigned a domain name to my router on the "LAN - DHCP Server" screen, in the field, "RT-N66U's Domain Name". From what I can tell, DHCP is correctly informing clients of the domain name, "example.com", and nodes are using that domain name as their default search domain. E.g., the first lines of /etc/resolv.conf on my Fedora Linux box are:
# Generated by NetworkManager
domain example.com
search example.com

However, it looks like DNSMasq is not attaching the domain name to hostnames. I noticed that "hostname -A" returns only the hostname for my Linux box, "fedora", while "hostname -f" returns "fedora.example.com". If I understand properly, "hostname -f" checks local files first, and correctly combines my hostname with the default search domain to produce a FQDN, but "hostname -A" goes through DNS resolution for each IPv4 address on a network interface.

Querying the router's DNS, via "dig -x 192.168.1.2 @192.168.1.1", and through "host" and "nslookup", only gets my hostname, "fedora", not "fedora.example.com". "fedora" can be resolved to 192.168.1.2, but "fedora.example.com" cannot be resolved. The same goes for other nodes on my LAN: DNS on the router always treats the bare hostname as the FQDN, and any search involving the domain name fails.

Here's /etc/dnsmasq.conf from the router:
pid-file=/var/run/dnsmasq.pid
resolv-file=/tmp/resolv.conf
expand-hosts
min-port=4096
dhcp-range=192.168.1.2,192.168.1.254,255.255.255.0,86400s
dhcp-lease-max=253
dhcp-authoritative
dhcp-option=3, 192.168.1.1
dhcp-option=15,example.com
dhcp-option=44,0.0.0.0
read-ethers

From what I can make out from the documentation for DNSMasq, there should probably be a line, "domain=example.com", so that "expand-hosts" causes DHCP to append the domain name to hostnames for DNS. "dhcp-option=15,example.com", I think, causes the domain name to be sent to DHCP clients, so that it's used as a search domain. I'm not sure if that would be redundant with "domain=example.com", or if the two would conflict.

I tried adding "domain=example.com", and that didn't seem to change the results with DNS resolution. Nor did it after I executed "killall -s SIGHUP dnsmasq" on the router. Rebooting the router resets /etc/dnsmasq.conf, so the line I added wasn't there. I assume a reboot would also reset /etc/hosts on the router, so I haven't tried editing it to include the FQDNs for my LAN nodes.

So I'm at wits' end. Is there a bug, a misconfiguration, or am I missing something?
 
I did some limited digging into this back when I first got my RT-N66U, but never fully researched it back then. I found some documentation claiming there was a bug with the Windows resolver, and that you should append a trailing dot at the end of the request for it to properly resolve (i.e. "nslookup computername."). I wasn't convinced by that explanation, but never really got back into investigating this more in depth.

Asus changed a lot of things related to dnsmasq in build 220, so it might be worth taking another look at this using 220 as a starting point (in case they resolved the issue with that build).
 
So the problem I've described is the result of a workaround for some Windows bug? That'd explain it, and may be justifiable anyway. This is a SOHO router, and I imagine most users aren't at all concerned with FQDNs within their LAN.
 
I've upgraded to the current Merlin build, 3.0.0.4.220.17, and my domain name is now being correctly attached to hostnames.
 
Asus rewrote a lot of the dnsmasq handling in 220, that's probably what fixed it.
 
Good thing they fixed it. I found a workaround when I was running the older versions of the ASUS firmware. Here's what I did, if for whatever reason anyone is still running it. I read through the ASUS dnsmasq code and found that manually setting wan_domain in the nvram will populate the domain= option in dnsmasq.conf. So:

# nvram set wan_domain=example.com

results in:

domain=example.com

Being put in dnsmasq.conf.
 
I may be having this problem too, but I apologize for my ingorance if not. Thanks so much for the effort on Asus-Merlin

We are using nfs4 on a home ubuntu/linux (12.04.1) network with several media/backup servers. I've had to change my wife and my uids (user numbers) to be the same on all the machines to avoid nfs4 changing owner and group to "nobody:nobody" in the case of a mismatch between the user name (uname) and uid. I did not expect this issue when originally installing, let each user get uid 1000, thus we both had this ujid on our desktops and laptops, but the servers have (or did) uid 1000 for my uid. nfs4 is picky about this.

I've spent weeks researching this and most people gave up and synchronized unique uids/unames across all the machines in a SO/HO like ours. I did this and now owner/group information is being handled properly however I changing uid broke our desktops due to my inexperience and they need reinstallation soon. (Not so bad as 12.04.02 LTS is due out very shortly and a clean install would not hurt, still 6 machines :().

The way it seems to deal with this properly is to set up idmapd on all clients and servers to have the same FQDN listed in /etc/idmapd.conf:

Code:
$cat idmapd.conf 
 
[General]
Verbosity=7
Pipefs-Directory=/var/lib/nfs/rpc_pipefs
Domain=your.domainhere.com
 
[Mapping]
Nobody-User=nobody
Nobody-Group=nobody
...

Aparently this local.domain does not actually have to match the real DNS domain but when the nfs4 servers asks the client for the users domain, it must match what the nfs4 server understands the domain (from its idmapd.conf) file. Now I tried leaving the line as

Code:
Domain=localdomain
but no joy there.

We have an Asus RT-N66u router doing dhcp and I've just installed the current beta of Asus-Merlin on it, enabled the jffs file system, and put our local domain name in it. I used ssh (thanks again for that!) to see our local domain in the /etc/dnsmasq.conf file so perhaps the jffs is not needed.

Is this enough to get the router providing dnsmasq service so that the machines on the network with pick up a local domain name? I assume I will need to reboot or at least restart network services on all the machines.

I did look into setting up one of our servers (with a friend who is an IT admin) to provide dhcp/dnsmasq services but that looked overly complicated for our situation (and most SO/HO people). It would mean that server going down would bring down dhcp/dnsmasq. I think the router would be better to handle those services with the enhanced ability in Asus-Merlin or Perhaps DD-Wrt. ( prior to this, I was running Tomato on an old WRT54G).

I just stumbled upon the availability of dnsmasq service in Asus-Merlin and Wrt and this has seemed to be possibly the root issue. While I have a work around, I don't know what else might be bugged by this improper setup.

Any suggestions?

cheers.

PS. We are moving large virtual disk image files (20-40G) and lossless media so samba became too slow and nsf4 is performing very well with real transfer speeds over 110MB/s consistently for hundreds of gigabytes at a time.

References:

http://www.novell.com/support/kb/doc.php?id=7005060
http://ubuntuforums.org/showthread.php?t=2053834
http://dfusion.com.au/wiki/tiki-index.php?page=Why+NFSv4+UID+mapping+breaks+with+AUTH_UNIX
 
Just a note: /etc/dnsmasq.conf gets automatically generated by the firmware at every reboot. If you want persistent changes, you will have to use a custom config file (see the Wiki for more info on them).
 
Thanks for quick reply.

I see in the auto generated /etc/dnsmasq.conf the line
Domain=my.real.local.domain.com #actual domain obscured

It is getting this from the Router setup where I put our domain in as the Routers domain. To my limited understanding this is correct so I don't know what I need to put in a custom addition to
/etc/dnsmasq.conf
to get the Router supplying dnsmasq service to all the dhcp clients.

is there a command to see who and what is happening with dnsmasq on the net? Sorry this is an area I'm pretty confused about, but I want to understand it.

To make this more complicated, there is a bug in recent Ubuntu versions where
Code:
$ hostname -d
$ hostname -f

do not report the domain out, even if the client knows what it is! I'm not home so can't link to the bug. The bug maintainer assigned the status as not needing fixing due to limited impact!

I would be happy just with the Asus RT-N66u handling dhcp and dnsmasq service on the net. I could not find a straight forward how to with searching. I assume I would manually set the same domain in my static ip machines but that is not a router issue.

cheers
 

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