← Back to blog
bpdubuntu
Setting Up a DHCP and DNS Server with Dnsmasq on Ubuntu
3 November 2025bpd · ubuntu
Automate Your Network Configuration
Once you have a router, you need a way to automatically assign IP addresses to the computers on your private network. The ‘Ubuntu System Administration Guide’ shows how to set up a DHCP and DNS server using a single, lightweight tool called `dnsmasq`.
What Dnsmasq Does
- DHCP Server: It listens for requests from new devices on the network and assigns them an IP address from a predefined range. It also tells them the address of the router (gateway) and the DNS server.
- DNS Server: It handles DNS queries for your local network. You can configure it to resolve custom local domain names (e.g., pointing `nas.local` to your network storage device) and forward all other requests to a public DNS server like Google’s or Cloudflare’s.
By installing and configuring `dnsmasq` on your Ubuntu router, you create a fully functional and self-contained network for your home or small office.
This post is based from content of the book Ubuntu System adminstration guide. And the book can be found here https://www.amazon.com/stores/Mattias-Hemmingsson/author/B0FF5CQX13