[CentOS] Erratic local hostname resolution with Dnsmasq

Thu Jan 3 14:05:39 UTC 2019
Leon Fauster <leonfauster at googlemail.com>

Am 02.01.2019 um 16:09 schrieb Nicolas Kovacs <info at microlinux.fr>:
> 
> My local server is running CentOS 7. The machine has two NICs and is
> acting as a gateway. For DHCP and DNS, I'm using Dnsmasq. I have a
> strange little problem with local hostname resolution. Before going into
> more details, here's my configuration.
> 
> [root at nestor:~] # ifconfig
> enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>        inet 192.168.0.2  netmask 255.255.255.0  broadcast 192.168.0.255
>        ether 2c:27:d7:15:54:a1  txqueuelen 1000  (Ethernet)
>        RX packets 17122  bytes 17596130 (16.7 MiB)
>        RX errors 0  dropped 0  overruns 0  frame 0
>        TX packets 13426  bytes 2144915 (2.0 MiB)
>        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
>        device interrupt 18  memory 0xfe8e0000-fe900000
> 
> enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>        inet 192.168.2.1  netmask 255.255.255.0  broadcast 192.168.2.255
>        ether 00:22:64:8a:4c:c2  txqueuelen 1000  (Ethernet)
>        RX packets 6597320  bytes 9692134059 (9.0 GiB)
>        RX errors 0  dropped 0  overruns 0  frame 0
>        TX packets 534283  bytes 57365155 (54.7 MiB)
>        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
>        device interrupt 16  memory 0xfe9e0000-fea00000
> 
> [root at nestor:~] # cat /etc/hostname
> nestor
> 
> [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.252 hp-officejet.microlinux.lan hp-officejet
> 192.168.2.253 nas.microlinux.lan nas
> 192.168.2.254 wifi.microlinux.lan wifi
> 
> [root at nestor:~] # cat /etc/resolv.conf
> # /etc/resolv.conf
> nameserver 127.0.0.1
> 
> [root at nestor:~] # cat /etc/dnsmasq.conf
> # /etc/dnsmasq.conf
> domain-needed
> bogus-priv
> interface=enp3s0
> dhcp-range=192.168.2.100,192.168.2.200,24h
> local=/microlinux.lan/
> domain=microlinux.lan
> expand-hosts
> # Cloudflare
> server=1.1.1.1
> server=1.0.0.1
> # Google
> #server=8.8.8.8
> #server=8.8.4.4
> no-resolv
> # Google
> dhcp-host=D4:85:64:B2:B2:1B,alphamule,192.168.2.2
> dhcp-host=00:1E:C9:43:A7:BF,bernadette,192.168.2.3
> dhcp-host=00:1D:09:15:4A:D8,raymonde,192.168.2.4
> dhcp-host=00:1E:C9:42:84:7B,amandine,192.168.2.5
> dhcp-host=B8:CA:3A:D6:5A:43,1C:3E:84:32:7E:87,buzz,192.168.2.6
> dhcp-host=90:E6:BA:CF:04:8F,64:70:02:9A:AC:93,balthazar,192.168.2.7
> dhcp-host=08:00:27:00:00:01,centosbox,192.168.2.10
> dhcp-host=08:00:27:00:00:02,susebox,192.168.2.11
> dhcp-host=10:62:E5:D4:95:60,hp-officejet,192.168.2.252
> dhcp-host=00:11:32:26:63:A5,nas,192.168.2.253
> 
> Now here's the problem. Some of the hostname are correctly resolved,
> while others are not. 
> ...




DHCP names are registered in DNS when the clients are "online" ...

--
LF