SYS‐255 Lab 4 DHCP - aljimenez28/champlain GitHub Wiki
Install and configure an ISC DHCP server on Rocky Linux to provide dynamic IP addresses to Windows clients.
Verify operation with logs, Wireshark captures, and lease-time changes.
- Used PuTTY from AD01 to SSH into the Rocky Linux VM:
sudo yum install dhcp
sudo -i # elevate to root
-
Backed up the default config:
cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak
-
Opened the config file:
sudo vi /etc/dhcp/dhcpd.conf -
Final working configuration:
default-lease-time 3600; max-lease-time 14400;subnet 10.0.5.0 netmask 255.255.255.0 { option routers 10.0.5.2; option subnet-mask 255.255.255.0; option domain-name "alejandra.local"; option domain-name-servers 10.0.5.5; range 10.0.5.101 10.0.5.125; }
-
Validate syntax:
sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf -
Start and enable service:
sudo systemctl start dhcpd sudo systemctl status dhcpd sudo systemctl enable dhcpd
sudo firewall-cmd --add-service=dhcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-all # confirm 'dhcp' is listed
-
On wks01, set the network adapter to Obtain an IP address automatically.
-
Verified lease with:
ipconfig /all-
Received IP
10.0.5.101, Gateway10.0.5.2, DHCP Server10.0.5.3.
-
sudo cat /var/log/messages | grep -i wks01-alejandra
-
Confirmed the DHCPOFFER, DHCPREQUEST, and DHCPACK messages.
-
Captured the 4-message DHCP handshake (Discover, Offer, Request, Ack) on WKS01 during
ipconfig /releaseandipconfig /renew.
| Problem | Cause | Solution |
|---|---|---|
| Unit dhcp.service not found | Used wrong service name | Correct service name is dhcpd |
| Job for dhcpd.service failed… expecting left brace | Used ( instead of { in subnet declaration | Edited config to use { |
| range declaration not allowed here | Missing closing brace/semicolon | Added } and ; |
| Permission denied when viewing config | File owned by root | Ran commands with sudo |
| Lease times not updating | Needed to add lease lines outside subnet | Added default-lease-time and max-lease-time at top of file |
-
Always run
sudo dhcpd -t -cf /etc/dhcp/dhcpd.confbefore starting the service to catch syntax errors. -
Every line inside the subnet block needs a semicolon.
-
Use sudo for reading or editing
/etc/dhcp/dhcpd.conf. -
Remember to open the firewall and reload rules or clients will not receive offers.
-
Verify client leases with
ipconfig /alland server logs withgrep.
This lab reinforced the importance of careful syntax in configuration files and the value of testing (dhcpd -t) before starting a service.
It also highlighted common DHCP troubleshooting steps such as checking logs, firewall rules, and lease times on both server and client sides.