4.3. Setting Up Name Services
Problem
Your LAN is going to have a combination of hosts with static IP addresses and DHCP clients that come and go, especially wireless clients. And, you want DHCP clients to automatically be entered into DNS so they can be accessed by hostname just like the hosts with static IP addresses.
Solution
You don't want much. Fortunately, you can have it all. Pyramid comes with dnsmasq, which handles DHCP and DNS, and automatically enters DHCP clients into DNS. This requires the clients to send their hostnames when they are requesting a DHCP lease. Windows clients do this by default. Most Linux clients do not, so go to Recipe 4.5 to learn about client configuration.
Now, we'll edit /etc/dnsmasq.conf on your
Pyramid box. First make the filesystem write able by running /sbin/rw. Copy this example, using your own
network name instead of alrac.net, whatever DHCP range you prefer, and
your own upstream nameservers:
pyramid:~# /sbin/rwpyramid:~# nano /etc/dnsmasq.confdomain-needed bogus-priv local=/alrac.net/ expand-hosts domain=alrac.net interface=br0 listen-address=127.0.0.1 #upstream nameservers server=22.33.44.2 server=22.33.44.3 dhcp-range=lan,192.168.1.100,192.168.1.200,12h dhcp-lease-max=100
Next, add all of your hosts that already have static IP addresses to /etc/hosts on your Pyramid box, using only their hostnames and IP addresses. At a minimum, you must have an entry for localhost and your Pyramid router:
## /etc/hosts 127.0.0.1 localhost 192.168.1.50 pyramid ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access