From Fedora Project Wiki
Description
dnsmasq is a lightweight, easy to configure DNS forwarder, DHCP server, and TFTP server. It is designed to provide DNS and, optionally, DHCP, to a small network.This test case ensures that the dnsmasq
package is working as expected. It is designed to verify that dnsmasq
can successfully function as a DNS forwarder and a DHCP server.
Setup
- Install the version of Fedora that is to be tested on a bare metal or virtual system.
- Install the
dnsmasq
package using the command:sudo dnf install dnsmasq
.
How to test
- Open a terminal window.
- Configure
dnsmasq
to act as a DNS forwarder: - Edit the
/etc/dnsmasq.conf
file to set up DNS forwarding. For example, add a line such asserver=8.8.8.8
. - Restart the
dnsmasq
service with the command:sudo systemctl restart dnsmasq
. - Test the DNS forwarding by querying a domain name, e.g.,
dig example.com @localhost
. - Configure
dnsmasq
to act as a DHCP server: - Edit the
/etc/dnsmasq.conf
file to set up the DHCP range and other DHCP options. For example, add lines such asdhcp-range=192.168.1.50,192.168.1.150,12h
. - Restart the
dnsmasq
service with the command:sudo systemctl restart dnsmasq
. - Test the DHCP server by requesting an IP address from another machine or a virtual machine in the same network.
Expected Results
- The
dnsmasq
package installs without error. - The DNS queries are successfully forwarded to the specified DNS server and responses are received.
- The DHCP server successfully assigns IP addresses to clients in the specified range, and the clients can use these IP addresses to communicate in the network.
- The
dnsmasq
service starts without errors and the status can be checked withsudo systemctl status dnsmasq
.
Optional
- Test
dnsmasq
in different network configurations and scenarios (e.g., multiple subnets, different ranges of DHCP addresses). - Test the TFTP server functionality of
dnsmasq
. - Check the logs (usually in
/var/log/
) for any unexpected errors or warnings. - Test the behavior when upstream DNS servers are unreachable.
- Test
dnsmasq
's performance under load, e.g., when many clients are making DNS queries or requesting DHCP leases at the same time.