dnsmasqis a lightweight, easy-to-configure DHCP and DNS server. I’ll demonstrate how to set updnsmasqas both a DHCP and DNS server on a Linux system.
| Procedure |
Procedure
| Network Card Configuration : |
Network Card Configuration
| |

The physical interface eth1 is used to set up DHCP and DNS services.
| |
Restart the networking to apply the settings.
| |
| DNSMASQ Configuration : |
DNSMASQ Configuration
Install dnsmasq:
| |

Configure dnsmasq:
The main configuration file for dnsmasq is /etc/dnsmasq.conf. Open this file with a text editor:
| |
Add or modify the following lines to configure dnsmasq as a DHCP and DNS server. Replace the placeholders with appropriate values for your network.
| |
Also, can save the file in a folder (/etc/dnsmasq.d) which end in .conf .
For example:
| |
Configure local DNS entries (optional):
If you want to add custom DNS entries for your local network, you can create a new file called /etc/hosts.dnsmasq and add the entries in the following format:
| |
For example:
| |
Then, add the following line to /etc/dnsmasq.conf to use /etc/hosts.dnsmasq for local DNS resolution:
| |
Start and enable dnsmasq:
| |
- /var/lib/misc/dnsmasq.leases: creating file
- /var/lib/misc/dnsmasq.leases: correcting owner
- Starting dnsmasq …
| |
- service dnsmasq added to runlevel default
| Perform client PC testing |
Perform client PC testing
Clients should receive IP addresses and DNS settings automatically when they connect, and any custom local DNS entries you configured should resolve correctly.
| |

Now, dnsmasq should be running as a DHCP and DNS server on network.
| Related |
