I'm playing around with a virtual network inside of VirtualBox 5.0.26 (with Guest Additions). I am using dnsmasq for dhcp and dns and the machines all apear to be allocated their network information correctly, however, I can only ping machines in the network using their hostnames, but not their fully qualified domain names and I can't figure out why.
My VirtualBox has 2 networks configured:
NAT Network [10.0.2.0/24], Supports DHCP
Host Only Network Adapter [192.168.62.1 / 255.255.255.0], No DHCP
In my Virtual Box network I have a couple of dummy machines: 2 Centos boxes with minimal installs + net-tools, bind-utils and dnsmasq; and an Ubuntu box:
- Minimal Centos 7 install + net-tools, bind-utils, dnsmasq - /etc/hostname => centos1 - /etc/hosts => 127.0.0.1 centos1.mytestnetwork.lab centos1 - /etc/resolv.conf # Generated by NetworkManager search home.local nameserver 10.1.10.10 #IP of legit DNS server nameserver 10.1.10.11 #IP of legit DNS server nameserver 192.168.62.10 # NOTE: the lic resolver may not support more than 3 nameservers # The nameservers listed below may not be recognized nameserver: 127.0.0.1 - /etc/resolv.conf.dnsmasq 127.0.0.1 - Primary NIC [enp0s3] connected to NAT Network configured for dhcp - Secondary NIC [enp0s8] connected to Host Only Network with static IP 192.168.162.10
- Minimal Centos 7 install + net-tools, bind-utils - /etc/hostname => centos2 - /etc/hosts => 127.0.0.1 localhost localhost.localdomain ::1 localhost localhost.localdomain - Primary NIC [enp0s3] connected to NAT Network configured for dhcp - Secondary NIC [enp0s8] connected to Host Only Network configured for dhcp.
- Ubuntu 14.04 LTS default install with default configuration
On Centos1, the content of my
/etc/dnsmasq.conf file is as follows:
resolv-file=/etc/resolve.conf.dnsmasq bogus-priv local=/mytestnetwork.lab/ domain=mytestnetwork.lab interface=enp0s8 no-hosts addn-hosts=/etc/hosts.dnsmasq expand-hosts dhcp-range=192.168.62.50,192.168.62.250,255.255.255.0,24h
Both machines appear to be allocated their IP and domain name correctly from dnsmasq when they boot up, so:
Centos2.MyTestNetwork.lab [192.168.162.51] Ubuntu1.MyTestNetwork.lab [192.168.162.52]
Both machines are listed in the
/var/lib/dnsmasq/dnsmasq.leases file as I would expect.
1471010530 00:00:27:d4:ce:8d 192.168.62.51 centos2 * 1471010650 00:00:27:6d:12:95 192.168.62.52 ubuntu1 *
Checking Centos2 and Ubuntu1's
/etc/resolv.conf files, I see Centos1's IP address listed in the nameserver list on both.
If I do an nslookup from either machine using just the host name, and tailing the
/sys/log/messages I see the dns request come into dnsmasq, nslookup lists the correct DNS server the IP address is resolved correctly. I can ping using just the hostname.
;; Got SERVFAIL reply from 10.1.10.11, trying next server ;; Got SERVFAIL reply from 10.1.10.10, trying next server Server: 192.168.62.10 Address: 192.168.62.10#53 Name: ubuntu1 Address: 192.168.62.52
If however, I do an nslookup using the fqdn, no dns request comes into dnsmasq and the machine cannot be pinged.
Server: 10.1.10.11 Address: 10.1.10.11#53 ** server can't find ubuntu1.mytestnetwork.lab: NXDOMAIN
I'm confused why it gives an NXDOMAIN in this case and doesn't try the next server until it finds the IP rather than give up at the first hurdle.