Lab 04: DHCP Configuration on Rocky Linux - abubakeralokozay/SYS-255-01-System-Administration-and-network-services GitHub Wiki

Step 1: Install DHCP Services Update the system and install the DHCP package: bash Copy Edit sudo dnf install -y dhcp-server Step 2: Configure the DHCP Service Open the DHCP configuration file using vim or nano: bash Copy Edit sudo vi /etc/dhcp/dhcpd.conf Add the following configuration (modify yourname.local accordingly): pgsql Copy Edit option domain-name "yourname.local"; option domain-name-servers 10.0.5.5; default-lease-time 3600; # 1 hour lease max-lease-time 14400; # 4 hours max lease

subnet 10.0.5.0 netmask 255.255.255.0 { range 10.0.5.50 10.0.5.100; option routers 10.0.5.2; option broadcast-address 10.0.5.255; } Save and exit (Esc + :wq in vim). Step 3: Start and Enable DHCP Service Start the DHCP service: bash Copy Edit sudo systemctl start dhcpd Enable the service at boot: bash Copy Edit sudo systemctl enable dhcpd Check the service status: bash Copy Edit sudo systemctl status dhcpd Step 4: Configure Firewall Allow DHCP traffic: bash Copy Edit sudo firewall-cmd --permanent --add-service=dhcp sudo firewall-cmd --reload Verify firewall settings: bash Copy Edit sudo firewall-cmd --list-all Step 5: Configure DHCP Client (WKS01) On WKS01, set the network adapter to obtain an IP address dynamically. Run: powershell Copy Edit ipconfig /all Capture a screenshot showing DHCP information from dhcp01 (Deliverable 1). Step 6: Locate DHCP Logs SSH into dhcp01 and check logs: bash Copy Edit sudo cat /var/log/messages | grep wks01-yourname Capture a screenshot showing the DHCP lease transaction (Deliverable 2). Step 7: Capture DHCP Packets in Wireshark Run a Wireshark capture on WKS01’s Ethernet0 adapter. Release and renew the DHCP lease: powershell Copy Edit ipconfig /release ipconfig /renew Apply the display filter in Wireshark: ini Copy Edit udp.port == 67 || udp.port == 68 Capture the 4 Key DHCP Messages (Discover, Offer, Request, Acknowledge) and take a screenshot (Deliverable 3). Deliverable 4: Changing the Default Lease Time To change the default lease time:

Open the configuration file: bash Copy Edit sudo vi /etc/dhcp/dhcpd.conf Modify these values: lua Copy Edit default-lease-time 3600; max-lease-time 14400; Restart the DHCP service: bash Copy Edit sudo systemctl restart dhcpd Verify: bash Copy Edit sudo cat /var/lib/dhcpd/dhcpd.leases | grep lease Capture a screenshot of the updated configuration and confirmation (Deliverable 4). Deliverable 5: Tech Journal Entry DHCP Exploration Here are three additional DHCP-related concepts, along with how they appear in Wireshark.

  1. DHCP Renewal Process After 50% of the lease time, the client attempts to renew the lease. Wireshark Filter: ini Copy Edit dhcp.option.dhcp == 3 Expected Packets: DHCP Request: Client requests renewal from the DHCP server. DHCP Acknowledge: Server confirms renewal.
  2. DHCP NAK (Negative Acknowledgment) If a client requests an invalid IP, the server responds with a DHCP NAK. Wireshark Filter: ini Copy Edit dhcp.option.dhcp == 6 Expected Packet: DHCP NAK: Server rejects the client's lease request.
  3. DHCP Inform Message Used when a client already has an IP but requests additional configuration settings. Wireshark Filter: ini Copy Edit dhcp.option.dhcp == 8 Expected Packet: DHCP Inform: Client asks for additional settings.