dnsmasq clients
DNS/DHCP clients for home/office network using dnsmasq.
2022-09-21 Ubuntu 22.04, macOS 15.5-6, Raspbian OS bullseye, Android 12
Assumes client already configured to use DHCP. This means there are no manual overrides – any, such as favoured public name servers in lieu of those inherited from access point's ISP (e.g. cloudflare 1.1.1.1 or google 8.8.8.8), must be removed, to allow our DHCP server to control all fields.
macOS client
Good news! it works seamlessly. Just strip /etc/hosts
of
extraneous material.
graham:~ sudo vi /etc/hosts # IP address db
/etc/hosts
replace content
# hosts - map IP address to hostname
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 ip6-localhost
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
- Identify your interface from the listing. We assume en0.
Verifying in detail:
graham:~ ipconfig getpacket en0 # inspect new DHCP setting op = BOOTREPLY htype = 1 flags = 0 hlen = 6 hops = 0 xid = 0xaaa9a6da secs = 1 ciaddr = 0.0.0.0 yiaddr = 192.168.99.39 siaddr = 192.168.99.20 giaddr = 0.0.0.0 chaddr = f4:d4:88:88:cb:d6 sname = file = options: Options count is 12 dhcp_message_type (uint8): ACK 0x5 server_identifier (ip): 192.168.99.20 lease_time (uint32): 0x15180 renewal_t1_time_value (uint32): 0xa8c0 rebinding_t2_time_value (uint32): 0x12750 subnet_mask (ip): 255.255.255.0 broadcast_address (ip): 192.168.99.255 domain_search (dns_namelist): {home.arpa} domain_name (string): home.arpa domain_name_server (ip_mult): {192.168.99.20, 1.1.1.1} router (ip_mult): {192.168.99.1} end (none): graham:~ cat /etc/resolv.conf # # macOS Notice # # This file is not consulted for DNS hostname resolution, address # resolution, or the DNS query routing mechanism used by most # processes on this system. # # To view the DNS configuration used by this system, use: # scutil --dns # # SEE ALSO # dns-sd(1), scutil(8) # # This file is automatically generated. # search home.arpa nameserver 192.168.37.20 nameserver 1.1.1.1 graham:~ scutil --dns DNS configuration resolver #1 search domain[0] : home.arpa nameserver[0] : 192.168.99.20 nameserver[1] : 1.1.1.1 flags : Request A records reach : 0x00020002 (Reachable,Directly Reachable Address) … …Android client
Good news (somewhat)! It works without making changes… except that it still confines you to google's walled garden e.g. name server fixed at 8.8.8.8. That means the android device passes through the local network without seeing any of the local devices.
Verify by checking IP address is as expected.
Ubuntu & bullseye clients
Firstly dispense with systemd-resolved as dnsmasq replaces it
and they collide on maintaining /etc/resolv.conf
.
/etc/hosts
replace content
# hosts - map IP address to hostname 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 ip6-localhost fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
- Ignore transient error message about name server problem.
Verifying in detail:
graham:~ cat /var/lib/dhcp/dhclient.leases # inspect new DHCP setting lease { interface "wlan0"; fixed-address 192.168.99.25; option subnet-mask 255.255.255.0; option routers 192.168.99.1; option dhcp-lease-time 86400; option dhcp-message-type 5; option domain-name-servers 192.168.99.20,1.1.1.1; option dhcp-server-identifier 192.168.99.20; option domain-search "home.arpa."; option dhcp-renewal-time 43200; option broadcast-address 192.168.99.255; option dhcp-rebinding-time 75600; option host-name "ironbark"; option domain-name "home.arpa"; renew 2 2022/09/20 23:34:33; rebind 3 2022/09/21 08:46:19; expire 3 2022/09/21 11:46:19; } graham:~ cat /etc/resolv.conf # Generated by resolvconf domain home.arpa nameserver 192.168.99.20 nameserver 1.1.1.1