This is just a follow up post on the matter described above. I got bored and decided to sort it all out once and for all. There might be a "better" way to do it but since I know so little of the inner workings I came up with this.
The steps in short detail are:
- Setup dnsmasq to run DHCP
- Stop dhcpd
- Prevent dhcpd from ever starting again
- Restart dnsmasq
- ?????
- Profit!
First is to setup a custom config file that will get loaded by dnsmasq when it starts.
Edit
/etc/dnsmasq/dnsmasq.d/custom.conf put the following with applicable changes in it:
# Add the domain to simple names (without a period) in /etc/hosts in the same way as for DHCP-derived names.
expand-hosts
#Prevent dnsmasq from forwarding any queries for the domain local.
local=/local./
# Define the domain name.
domain=local
#dhcp-leasefile=<path>
#Use the specified file to store DHCP lease information
dhcp-leasefile=/var/lib/dhcp/dhcpd.dnsmasq.leases
#enable the dhcp server with a range:
dhcp-range=br0,192.168.1.100,192.168.27.200,12h
#DHCP Options by number and values.
dhcp-option=3,192.168.1.1 #Default route
# Enable pxe booting, define the boot file, and next-server
#dhcp-boot=/pxelinux.0,,192.168.1.150
#Define static addresses.
#dhcp-host=MAC,hostname,1.1.1.1
Next, stop the dhcpd server:
After it's stopped, edit
/etc/init.d/dhcpd, we'll change the script so that it will immediately exit with error code 0 before actually starting any services:
#!/bin/sh
exit 0
#DHCPd is disabled because dnsmasq can handle DHCP just as well,
#however, it doesn't offer any connectivity (Dynamic DNS) from DHCPd.
#So dhcpd is configured to run DHCP instead.
You can choose to leave out the note about the reason for the exit 0. In addition to the feature limitations mentioned above, this is done to prevent the service from ever starting. Endian configures the firewall to actually block the DHCP packets from getting out to the network. With this fact, if the DHCP server is "disabled" in the web interface, dnsmasq won't be able to serve DHCP to the network. so it must be "Enabled" on the applicable interface in the web interface, even though having it "Enabled" will actually do nothing, and start no services. If someone "Disables" it on the web interface, it will prevent dnsmasq from serving to the network.
Next, restart the dnsmasq service
/etc/init.d/dnsmasq restart
Check out
/var/log/messages for warnings or errors from dnsmasq and make sure that everything started OK. If that's the case, you should have DHCP working now, along with Dynamic DNS lookup to the hostnames registered in DHCP.
You can test this feature by using nslookup:
>nslookup maxim
Server: efw.local
Address: 192.168.1.1
Name: maxim.local
Address: 192.168.1.130
"efw" is the hostname of the endian firewall.
"local" is the name of the domain.
"maxim" is the hostname of this machine.
The IP address is resolved correctly.