Last updated on October 8, 2020 by Dan Nanni
If you are trying to set up a small private network in your home or company, you probably want to set up an internal DHCP/DNS server for your network.  dnsmasq comes in handy in that situation. Dnsmasq is a free lightweight DHCP server for Linux that can serve a small-scale network.  It supports static/dynamic DHCP leases and has DNS proxy functionality built in.
If you would like to install and set up dnsmasq on Linux, follow the instructions below.
dnsmasq on Linuxdnsmasq on CentOS, Fedora or RHEL:$ sudo yum install dnsmaq $ sudo chkconfig dnsmasq on
dnsmasq on Ubuntu or Debian:$ sudo apt-get install dnsmasq
Note that in Debian-based distributions, dnsmasq installed with apt-get will be set to start automatically upon boot, so you don't need to do anything for auto-start.
dnsmasqNow go ahead and configure dnsmasq as follows.
$ sudo vi /etc/dnsmasq.conf
domain=alice.com interface=eth0 dhcp-range=10.1.1.50,10.1.1.200,12h dhcp-host=82:5F:0A:13:5E:B0,10.1.1.100 dhcp-option=3,10.1.1.1
The above configuration can be descripbed as follows.
dnsmasq.dnsmasq is listening on.10.1.1.50 to 10.1.1.200), and optionally lease time (e.g., 12 hours).3 in the example specifies the default gateway returned by the DHCP server (e.g., 10.1.1.1).  Without it, the default gateway will be automatically set to the host where dnsmasq is running.Once you have configured /etc/dnsmasq.conf, you can restart dnsmasq as follows.
$ sudo service dnsmasq restart
$ sudo /etc/init.d/dnsmasq restart
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean