Isolated testbeds still regularly require their DUTs to resolve hostnames. The dnsmasq
package on Linux provides this feature. Requires release 5.4.6 or later.
The dnsmasq service provides BOTH DHCP and DNS services.
This setting is NOT governed by the Netsmith -> Virtual Router -> Modify -> DCHP setting. You can accidentally leave DNSmasq running in DHCP serving mode and use Chamber View test scenarios that also create a new DHCP service in a virtual router. LANforge does not track the status of DNSmasq like it does the dhcpd process it starts in a virtual router. You can end up running two DHCP services if you are not careful
The two modes you would configure are:
We suggest configuring DNSmasq in a DNS-only mode most of the time.
If you are crafting a test scenario where you are providing DHCP as an upstream port, create a Virtual Router and drag your upstream port into it. You will probably want a static IP on the port. For this example, we will use eth1
with address 10.45.0.1
.
You have now enabled DHCP in the virtual router.
The /etc/dnsmasq.conf
file controls the behavior of the DNSmasq service. The configuration below will serve entries out of /etc/hosts
. This example is configured to run on interface eth1.
/etc/dnsmasq.conf
domain=lanforge.com expand-hosts local=/local/ local=/0.45.10.in-addr.arpa/ log-dhcp log-queries interface=eth1
/etc/hosts
# Loopback entries; do not change. ::1 localhost.localdomain localhost localhost6.loaldomain6 localhost6 127.0.0.1 localhost.localdomain localhost localhost4.localdomain4 localhost4 vm-6006-local 192.168.1.101 lanforge.localnet lanforge.localdomain ###-LF-HOSTNAME-NEXT-### 192.168.45.94 vm-6006 4585-f38.bitratchet.net # Custom hostnames: 10.45.0.1 www.lanforge.com lanforge.com
dnsmasq --test
.sudo systemctl restart dnsmasq.service
.