SYS‐255 Lab 4 DHCP - aljimenez28/champlain GitHub Wiki

Objective

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.


Key Steps & Commands

1. Connect to DHCP Server

2. Install and Prepare DHCP

sudo yum install dhcp
sudo -i                     # elevate to root
  • Backed up the default config:

    cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak
    

3. Edit DHCP Configuration

  • 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; }

4. Test & Start the Service

  • 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
    

5. Configure Firewall

sudo firewall-cmd --add-service=dhcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-all   # confirm 'dhcp' is listed

6. Configure Client

  • On wks01, set the network adapter to Obtain an IP address automatically.

  • Verified lease with:

    ipconfig /all
    
    • Received IP 10.0.5.101, Gateway 10.0.5.2, DHCP Server 10.0.5.3.

7. Verify Server Logs

sudo cat /var/log/messages | grep -i wks01-alejandra
  • Confirmed the DHCPOFFER, DHCPREQUEST, and DHCPACK messages.

8. Wireshark Capture

  • Captured the 4-message DHCP handshake (Discover, Offer, Request, Ack) on WKS01 during ipconfig /release and ipconfig /renew.


Problems & Solutions

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

Important Tips

  • Always run sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf before 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 /all and server logs with grep.


Reflection

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.

⚠️ **GitHub.com Fallback** ⚠️