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 10.45.0.1.

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.

/etc/dnsmasq.conf

domain=lanforge.com
expand-hosts
local=/local/
local=/0.45.10.in-addr.arpa/
log-dhcp
log-queries
interface=eth1

Hosts file /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

Running DNSmasq:


Candela  Technologies, 2417 Main Street, Suite 201, Ferndale, WA 98248, USA
www.candelatech.com | sales@candelatech.com | +1.360.380.1618
Facebook | LinkedIn | Blog