Candela Technologies Logo
Network Testing and Emulation Solutions

Using Custom DNS on LANforge with DNSmasq

Goal: Create a nameserver for your test network when no Internet access is available.

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.

Role of dnsmasq and how to combine it with Virtual Routers

The dnsmasq service provides BOTH DHCP and DNS services.

If the dhcp-range directive is present in the /etc/dnsmasq.conf file, then it will respond to DHCP requests.

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.

Typical Port Setup

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

Enable the DNS service on the port

You have now enabled DHCP in the virtual router.

Configure DNSmasq

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.


Hosts file /etc/hosts

# Loopback entries; do not change.
::1  localhost.localdomain localhost localhost6.loaldomain6 localhost6  localhost.localdomain localhost localhost4.localdomain4 localhost4 vm-6006-local lanforge.localnet lanforge.localdomain
###-LF-HOSTNAME-NEXT-###    vm-6006
# Custom hostnames:

Running DNSmasq:

Candela  Technologies, 2417 Main Street, Suite 201, Ferndale, WA 98248, USA | | +1.360.380.1618
Facebook | LinkedIn | Blog