[CentOS] Erratic local hostname resolution with Dnsmasq

Nicolas Kovacs

info at microlinux.fr
Wed Jan 2 15:38:56 UTC 2019


Le 02/01/2019 à 16:09, Nicolas Kovacs a écrit :
> Of course I could add all these hosts to /etc/hosts, but as far as I 
> understand, this *should* work with the hosts appearing only in 
> /etc/dnsmasq.conf. Or have I overlooked something ? Any suggestions
> ?

>From what this *looks like* after experimenting, Dnsmasq isn't 100 %
able to read hostnames from dnsmasq.conf, and if I want complete local
resolution, I have to put each hostname - in long and short form - in
the servers' /etc/hosts file. In my case:

[root at nestor:~] # cat /etc/hosts
# /etc/hosts
127.0.0.1     localhost.localdomain localhost
192.168.2.1   nestor.microlinux.lan nestor
192.168.2.2   alphamule.microlinux.lan alphamule
192.168.2.3   bernadette.microlinux.lan bernadette
192.168.2.4   raymonde.microlinux.lan raymonde
192.168.2.5   amandine.microlinux.lan amandine
192.168.2.6   buzz.microlinux.lan buzz
192.168.2.7   balthazar.microlinux.lan balthazar
192.168.2.10  centosbox.microlinux.lan centosbox
192.168.2.11  susebox.microlinux.lan susebox
192.168.2.252 hp-officejet.microlinux.lan hp-officejet
192.168.2.253 nas.microlinux.lan nas
192.168.2.254 wifi.microlinux.lan wifi

In my case, this works perfectly, and I can resolve local hostnames on
the server and on each client.

So as far as I understand, the price to pay is only a small redundancy
between /etc/dnsmasq.conf and /etc/hosts.

Cheers,

Niki

-- 
Microlinux - Solutions informatiques durables
7, place de l'église - 30730 Montpezat
Site : https://www.microlinux.fr
Blog : https://blog.microlinux.fr
Mail : info at microlinux.fr
Tél. : 04 66 63 10 32



More information about the CentOS mailing list