Skip to content

Instantly share code, notes, and snippets.

@githubfoam
Last active February 20, 2024 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save githubfoam/85bd84a8bee080e353e87c95bae97873 to your computer and use it in GitHub Desktop.
Save githubfoam/85bd84a8bee080e353e87c95bae97873 to your computer and use it in GitHub Desktop.
DHCP Cheat Sheet
---------------------------------------------------------------------------------------------------------------------
#ChatGPT
Detecting DHCP issues and misconfigurations requires careful examination of DHCP server settings and network behavior. Here are steps to help you find and address DHCP misconfigurations:
1. Check DHCP Server Logs:
Review the logs on the DHCP server for any error messages or warnings related to IP address assignments, conflicts, or lease expirations.
2. IP Address Conflicts:
Identify IP address conflicts by checking for duplicate IP addresses assigned to different devices. DHCP servers typically log conflicts, or you can use tools like arp -a on Windows or show arp on network devices.
3. Lease Duration:
Check the DHCP lease duration settings. If leases are too short, devices may frequently request new addresses, potentially leading to ARP miss attacks.
4. Subnet Configuration:
Ensure that the DHCP server is configured with the correct subnet information, including subnet masks and gateways. Misconfigurations can result in devices receiving IP addresses from the wrong subnet.
5. IP Address Range:
Verify that the DHCP server's IP address range is appropriately sized and does not overlap with statically assigned addresses or addresses used by other DHCP servers.
6. Examine DHCP Server Settings:
Review the DHCP server settings for any unusual configurations. Pay attention to options like DNS server assignments, gateway settings, and any other custom options.
7. DHCP Server Redundancy:
If you have multiple DHCP servers, ensure they are correctly configured for redundancy. Misconfigurations in failover setups can lead to conflicts.
8. Client Request Behavior:
Analyze how DHCP clients behave when requesting IP addresses. Look for patterns of rapid, repeated requests that may indicate issues.
9. Check for Rogue DHCP Servers:
Verify that there are no rogue DHCP servers on the network. Unauthorized DHCP servers can cause conflicts and disruptions.
10. DHCP Snooping:
bash
Copy code
- If your network switches support it, enable DHCP snooping to prevent unauthorized DHCP servers. DHCP snooping can also log and report any suspicious DHCP activity.
11. Stale Lease Cleanup:
css
Copy code
- Periodically clean up stale leases on the DHCP server. Old or unused leases can contribute to IP address conflicts.
12. Validate DNS and Gateway Information:
vbnet
Copy code
- Confirm that DNS server and gateway information provided by the DHCP server is accurate. Incorrect information can lead to network connectivity issues.
13. Review DHCP Scope Options:
sql
Copy code
- Check DHCP scope options for any misconfigurations, especially options that may affect ARP behavior, such as the default gateway.
14. Monitor DHCP Traffic:
css
Copy code
- Use network monitoring tools to capture and analyze DHCP traffic. Look for anomalies, high request rates, or unexpected behavior.
15. Collaborate with IT Teams:
vbnet
Copy code
- Collaborate with server administrators and other IT teams to ensure that DHCP settings align with the overall network and server configurations.
By systematically reviewing these aspects of your DHCP configuration and behavior, you can identify and address misconfigurations that might lead to ARP miss attacks or other network issues. Regular audits and monitoring help maintain the stability and reliability of the DHCP service. If needed, involve DHCP server specialists or vendor support for further assistance.
---------------------------------------------------------------------------------------------------------------------
#ChatGPT
On Windows Server 2016 Datacenter, you can review DHCP server logs using the Event Viewer. Here's how you can check for error messages or warnings related to IP address assignments, conflicts, or lease expirations:
Using Event Viewer:
Open Event Viewer:
Press Win + X and select "Event Viewer" from the menu.
Navigate to DHCP Server Logs:
In the left pane of Event Viewer, expand "Windows Logs" and select "System."
In the right pane, you'll see a list of events. You can filter these events to show only DHCP-related events.
Filter DHCP Events:
Click on the "Filter Current Log..." option in the Actions pane on the right.
Set Filters:
In the Filter Current Log window, under the "Event sources" dropdown, select "Dhcp-Server."
You can set specific filters for Event IDs related to DHCP events, such as Event ID 10 for lease assignments.
Review Events:
After applying the filter, you'll see a list of DHCP-related events. Look for events with Event IDs indicating IP address assignments, conflicts, or lease expirations.
Details Pane:
Click on an individual event to see detailed information in the bottom pane. This information will include details about the DHCP activity, such as the IP address assigned, lease duration, and any conflicts.
Using PowerShell:
You can also use PowerShell to query DHCP server events. Open PowerShell as an administrator and use the following command:
powershell
Copy code
Get-WinEvent -LogName 'Microsoft-Windows-DHCP Server Events/Operational' -MaxEvents 50 | Format-List
This command retrieves the last 50 events from the DHCP Server Events log. You can modify the -MaxEvents parameter as needed.
Example PowerShell Command to Filter DHCP Lease Events:
powershell
Copy code
Get-WinEvent -LogName 'Microsoft-Windows-DHCP Server Events/Operational' -FilterXPath "*[System[Provider[@Name='Microsoft-Windows-DHCP Server'] and (EventID=10)]]" | Format-List
This command filters events to show only DHCP lease-related events (Event ID 10). Adjust the Event ID or other parameters as needed.
Reviewing DHCP events in the logs will provide insights into IP address assignments, conflicts, and lease expirations on your Windows Server 2016 DHCP server.
---------------------------------------------------------------------------------------------------------------------
#Gemini
Here's how to review the logs on a Windows Server 2016 Data Center edition for any error messages or warnings related to IP address assignments, conflicts, or lease expirations:
Method 1: Event Viewer
Open Event Viewer. You can do this by searching for "eventvwr.msc" in the Start menu or pressing Windows key + R, typing "eventvwr.msc", and pressing Enter.
Expand Applications and Services Logs.
Expand Microsoft.
Expand Windows.
Expand DHCP-Server
Additionally, you can filter by Event ID:
Event ID 4190: DHCP server failed to assign an address because there are no more available in the scope.
Event ID 4191: DHCP server encountered an error while processing a DHCP request.
Event ID 4198: DHCP lease has expired.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment