dnsmasq

dnsmasq is a tool for configuring a DNS server for your local network.

A DNS server translates a url into an IP address.

For your local network, you may have a development box hosting sites you want to access by url from another computer on the network.

dnsmasq can help by providing DNS mapping for local host names.

For this to work, we set up dnsmasq on the development box and configure network settings on other computers to use the dev box IP for DNS.

First, install dnsmasq.

For Linux: sudo apt install dnsmasq

For FreeBSD: sudo pkg install dnsmasq

Next configure settings in /etc/dnsmasq.config.

For FreeBSD, it's in /usr/local/etc/dnsmasq.config.

Copy your ISP's DNS server IP, or use a public nameserver.

server=8.8.8.8

*There is more to config, I'll update this when I have it figured out.

In /etc/resolv.conf, it should only have 127.0.0.1 as the nameserver, this will use dnsmasq.

Configure urls to respond to in /etc/hosts.

Start dnsmasq: sudo service dnsmasq start

At this point, the dev box can ping hosts configured in /etc/hosts and also access the internet. dnsmasq is supplying the local host DNS, and using the configured nameserver for lookups.

To get other computers to use the devbox's dnsmasq as DNS, configure the network settings.

In Linux Mint, there is an option in the wifi connection's IPv4 settings to use Automatic (DHCP) addresses only, which gets the IP address assigned from the router but allows manual configuration.

Mint network settings for dnsmasq

I was also able to configure manual DNS settings on my iPhone to access websites on the dev box.

Level
Topics