# dnsmasq issues -- not resolving all hostnames

## MarcusXP

Hi guys,

I set-up dnsmasq on a Gentoo VM for a small network in our office.

It is serving as DHCP server and (hopefully) as DNS server (which is not working properly at the moment).

Windows hosts do not resolve any hosts.

On the box where dnsmasq is installed (and another Gentoo box that I've tried from), it is resolving *some* of the hosts, but not all.

/etc/dnsmasq.conf

```

interface=eth0

dhcp-range=192.168.32.10,192.168.35.254,255.255.252.0,24h

dhcp-option=3,192.168.32.1

dhcp-option=6,192.168.32.2

#dhcp-option=6,192.168.32.2,172.16.136.10,172.16.136.13

conf-file=/etc/dnsmasq.conf.static

no-hosts

addn-hosts=/etc/dnsmasq.conf.hosts
```

Some of the hosts being resolved are found in /etc/dnsmasq.conf.static (where I defined the static DHCP host assignment) - but as I said, not all of those hosts are being resolved.

I tried defining some hosts in /etc/hosts and /etc/dnsmasq.conf.hosts but they are not being recognized.

Any advices?

thank you very much!

----------

## MarcusXP

I get some inconsistent results, for example:

Gentoo box running dnsmasq cannot resolve (ping) hostname "agent-td1" nor "esxi-32-185":

```
AT-QA-DHCP ~ # ping agent-td1

ping: unknown host agent-td1

AT-QA-DHCP ~ # ping esxi-32-185

ping: unknown host esxi-32-185

AT-QA-DHCP ~ #
```

Another Gentoo box can ping second hostname but not first one.. and both are located in the dhcp.conf.static file on the DHCP server.

```
AT-QA-Stor ~ # ping agent-td1

ping: unknown host agent-td1

AT-QA-Stor ~ # ping esxi-32-185

PING esxi-32-185 (192.168.32.185) 56(84) bytes of data.

64 bytes from ESXi-32-185 (192.168.32.185): icmp_req=1 ttl=64 time=0.691 ms

64 bytes from ESXi-32-185 (192.168.32.185): icmp_req=2 ttl=64 time=0.185 ms

64 bytes from ESXi-32-185 (192.168.32.185): icmp_req=3 ttl=64 time=0.186 ms

^C

--- esxi-32-185 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 1998ms

rtt min/avg/max/mdev = 0.185/0.354/0.691/0.238 ms

```

From a Windows machine:

```

C:\Users\Administrator>ping agent-td1

Pinging agent-td1 [192.168.32.146] with 32 bytes of data:

Reply from 192.168.32.146: bytes=32 time<1ms TTL=128

Reply from 192.168.32.146: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.32.146:

    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Control-C

^C

C:\Users\Administrator>ping esxi-32-185

Ping request could not find host esxi-32-185. Please check the name and try again.
```

Moreover, from the Windows box, the "nslookup" command can resolve the name, but if I ping the name, it is not resolved... WHY IS THAT ?!

```
C:\Users\Administrator>nslookup esxi-32-185

Server:  AT-QA-DHCP

Address:  192.168.32.2

Name:    esxi-32-185

Address:  192.168.32.185
```

I'm puzzled...

----------

## MarcusXP

is there anyone that can help please?

----------

## your_WooDness

Hi,

you should check the /etc/hosts and /etc/resolv.conf files of the DNS clients. Best would be that /etc/hosts only contains entries for localhost, /etc/resolv.conf should be same everywhere or better should be written by dhcp client. But check if there are search pathes added.

Another file that affects name lookups is /etc/nsswitch, which should have the following hosts entry

```
hosts:      files dns
```

/etc/dnsmasq.conf.hosts should contain the fqdn and short names for the hosts. 

If you DNS query fails, please do a reverse lookup as well: nslookup <ip-address>

w00d

----------

