Lab 4: DHCP - Hsanokklis/2023-2024-Tech-journal GitHub Wiki
Objectives
Install and configure Linux DHCP service on dhcp01.hannelore.local
SSH from AD01 --> DHCP01
Disable IE Enhanced Security Configuration
- Go to Server manager
- Go to local servers
- make turn off IE Enhanced Security Config
Chrome and Edge are not installed on the ad01 server, so if I wanted to download chrome I would have to get internet explorer set up which is in the program files for the C drive.
SSH to dhcp01 from ad01
Install DHCP services
Use the yum update manager to install DHCP with you elevated user
Succesfully installed the DHCP package
Configuring DHCP Services
**execute command sudo -i
- open the dhcp config files in vim with command **vi /etc/dhcp/dhcpd.conf
once in vim, press "i" to go to insert mode to be able to type
VIM helpful commands!
https://www.computerhope.com/unix/uvi.htm
https://www.cyberciti.biz/faq/how-do-i-save-changes-in-vim/
- vi filename or vim vim filename
Goes into the file
-
h --> left
-
j --> down
-
k --> up
-
l --> right
-
Esc
Cancel any command you've started typing
- Return
complete certain commands and execute them
- Delete
interrupts anything that the editor has been doing and brings you back to the default state of the editor
- :w
will write the contents to save them
- :q
This will quit vi
- i
will allow you to start typing in vi
** Copy word for word the command below into Vim**
The copied commands
- Press esc and then use :w to write the commands
- cat the file to make sure it actually saved the configurations
Start DHCP Services
Understanding the systemd command
https://www.linux.com/training-tutorials/understanding-and-using-systemd/
- systemctl is how you stop, stop and status services
Start DHCP
- systemctl start dhcpd
Check the DHCP status
the dhcpD means it’s a Daemon, which is Linux speak for Service https://en.wikipedia.org/wiki/Daemon_(computing)
- Use command systemctl status dhcpd
Enabling the service to start at boot
- command systemctl enable dhcpd
Configuring the Firewall to allow incoming DHCP requests
The default configuration on CentOS is to enable the firewall and allow both ICMP and SSH requests in. The DHCP server will not work until we enable the firewall. We will be using firewalld and the firewall-cmd utility to make this happen. The “firewall-cmd --list-all” option shows the default firewall that allows dhcpv6-client (not to be confused with dhcp server) and ssh. We will add the dhcp service (as opposed to its ports).
- Command firewall-cmd --list-all
The --permanent flag is important. If you fail to add this, the next time you reboot, your changes will be lost. Make sure you reload the firewall to invoke the change. List all the rules and make sure your dhcp service has been added.
- firewall-cmd --add-service=dhcp --permanent
- firewall-cmd --reload
- firewall-cmd --list-all (you should see that there is an additional dhcp in the services section
Windows 10 DHCP Client
As a privileged user, you will now re-configure networking on WKS01 to use dynamic addressing rather than static addresses
You can run any linux command on windows powershell
- Go to Ethernet0 and to IPv4 settings
- Select "Obtain an IP address automatically" for both sections
Deliverable 1: Take a snapshot of the results of ipconfig /all. Note the DHCP server of 10.0.5.3 should be there, your IP address should be the first IP address in the scope you set earlier. Your domain name, netmask and gateway should also be set correctly.
Deliverable 2. Log back into dhcp01 and find the DHCP log associated with wks01's request for DHCP information. Take a snapshot similar to the one below. The IP address, the workstation name, the layer 2 address should all match between deliverables 1 and 2.
Wireshark
Run a capture session against WKS01's Ethernet0 adapter.
As an administrative power user (-adm), release the current DHCP release and then renew it on WKS01. Your objective: Capture the four DHCP messages between client and server.
-
release your current DHCP release using the following command ipconfig /release
-
renew your configuration with ipconfig /renew
- ipconfig to see all the addresses
Deliverable 3. Provide a screenshot that shows the 4 Key DHCP Messages.
Deliverable 4. Figure out how to change the default lease time given to dhcp clients to 1 hour with a max lease time of four hours. Provide a screenshot displaying the new configuration, along with the shot confirming the change.
The red marks the default lease time
Reconfigured conf file with new lease set
Source used: https://linuxhint.com/dhcp_server_centos8/
TROUBLESHOOTING: I had to do the command systemctl restart dhcp to get the lease times to actually apply. Then I had to go to my workstation and do ipconfig /release and ipconfig /renew to actually get the lease times to show up
Deliverable 5. Tech Journal Entry - Explore 3 other items related to DHCP, and dig into their related Wireshark captured packets.
The DORA process
DHCP is used to get an IP address for the client from the server. DHCP does this with packet exchanges. This process is called the DORA process.
- DHCP Discover
- DHCP Offer
- DHCP Request
- DHCP ACCEPT
Here is an example of the DORA process in wireshark
DHCP Renewal Process
Once the DHCP lease is up the client will need to renew the lease. To do this the client has to send 2 DHCP frame to get the new IP address.
- DHCP Request
This will be the same as a normal DHCP request packet but the client IP address will have the clients current IP. The client can just renew its current address so it doesn't need to be assigned another one.
- DHCP ACK
This packet is an acknowledgement of the DHCP request
Source used: https://linuxhint.com/explain-dhcp-using-wireshark/
DHCP(BOOTP) Statistics
This information field gives information of the DHCP packets in your capture.
- ACK --> shows acknowledged requests send to the DHCP server
- Active Lease Query --> Requests on lease for a limited time period and expires after timeout
- Bulk Lease Query --> shows requests on lease for IP addresses that have been provided with an IP address for a certain time period in bulk
- Decline --> declined requests
- Discover --> Discover nearby configuration device to send request for IP address
- Force Renew --> Used when a temp IP is about to expire but the session is still active.
- Inform --> info about success, failure, timeout time etc.
- Lease Active --> shows active requests acknowledged by the server
- Lease Query Done --> shows queries that are completed
- Lease Query Status --> shows status of queries like done, unknown, unassigned etc.
- Lease Unassigned --> shows unassigned queries
- Lease Unknown --> queries that do not reach the server
- Lease Query -->lists queries that interact with DHCP server
- NAK --> Negative Acknowledgement, shows queries that are not acknowledged
- Offer --> response to the discover query for providing IP addresses
- Release --> the temporary Ips are released once they are no longer needed in a session
- Request --> used to make a request for a temporary IP address
- TLS --> Transport Layer Security, used in encrypting data sent over the internet.
Source used: https://www.geeksforgeeks.org/dhcp-bootp-statistics-in-wireshark/