dnsmasq
dnsmasq is free software providing services such as Domain Name System (DNS) caching, Dynamic Host Configuration Protocol (DHCP) server, and many more.
Setup a Dynamic Host Configuration Protocol (DHCP) server
The following are the steps to setup a DHCP server with dnsmasq:
Setup a static IP address on the machine acting as the DHCP server
The steps to configure a static IP address are outlined in the networking.service sub-section under this section (https://jarrettgxz-sec.gitbook.io/networking-concepts/networking-tools/services/networking.service)
Configure the DHCP server settings from the /etc/dnsmasq.conf file
a) Open up /etc/dnsmasq.conf on a text editor
b) Add the following lines at the bottom
Replace iface, dhcp_start_range, dhcp_end_range and lease_time with the appropriate values
The iface value used should match the one that have been configured from part 1 (static IP address allocation)
c) Save the file
Restart the dnsmasq daemon
Example
Setup a machine as a DHCP server on the interface eth0, with the static IP address of 88.88.88.88
, and a DHCP pool range of 88.88.88.0
to 88.88.88.87
. The lease time will be set to 24 hours.
Connecting to the DHCP server
Simply connect a physical ethernet adapter from the client interface to the interface on the DHCP server machine that was configured.
Subsequently, verify if the client interface have been successfully configured with an IP address from the DHCP range. Perform the following on the client machine — a few troubleshooting steps will be outlined too.
Linux
Look for the paragraph where the client interface is configured (eg. eth0)
The IP address displayed after inet should be within the DHCP pool range defined in the DHCP server configurations, and the state should be UP.
Troubleshooting on Linux
The following actions can be taken to resolve any issues:
Reset the lease and request for a new IP address via a DHCP query:
Reset the client network interface
Restart the networking.service daemon
Windows
Look for the paragraph where the client interface is configured (eg. Ethernet 8)
The IPV4 address value displayed should be within the range of the DHCP pool range defined in the DHCP server configuration. The default gateway, DHCP server and DNS server entries should be the IP address of the DHCP server.
Troubleshooting on Windows
Reset the lease and request for a new IP address via a DHCP query:
Last updated