The Windows PowerShell cmdlet below will query a remote Dynamic Host Configuration Protocol (DHCP) server and provide the lease duration of each IPv4 scope.
Get-DhcpServerv4Scope -ComputerName HOSTNAME | Select ScopeID, LeaseDuration
The Windows PowerShell cmdlet below will query a remote Dynamic Host Configuration Protocol (DHCP) server and provide the lease duration of each IPv4 scope.
Get-DhcpServerv4Scope -ComputerName HOSTNAME | Select ScopeID, LeaseDuration
You may use the following Microsoft Windows PowerShell cmdlet to view the last one hundred lines of a Microsoft Windows Server DHCP server log for a particular Internet Protocol (IP) address. This may be useful when you are troubleshooting DHCP errors in Microsoft Windows Server.
Get-Content DhcpSrvLog-Mon.log | Select -Last 100 | Select-String -Pattern “X.X.X.X” -encoding ASCII
You may use the following commands to export and import a Dynamic Host Configuration Protocol (DHCP) configuration for a server utilizing Microsoft Windows Server 2012 R2.
netsh dhcp server dump > dhcpconfig.dmp
netsh exec dhcpconfig.dmp
Enjoy!
You may use the following commands to configure a DHCP server on a Cisco router. The router in this example is a non-ISR 1720 Cisco router being run on Graphic Network Simulator 3 (GNS3). This configuration will name the pool of Internet Protocol (IP) addresses as Marketing, assign an IP address, subnet mask, default gateway, Domain Name System (DNS) server, DHCP lease and excluded IP addresses 172.16.2.1-172.16.2.99.
router-1#config t
Enter configuration commands, one per line. End with CNTL/Z.
router-1(config)#ip dhcp pool Marketing
router-1(dhcp-config)#network 172.16.2.0 255.255.0.0
router-1(dhcp-config)#default-router 172.16.1.1
router-1(dhcp-config)#dns-server 172.16.3.1
router-1(dhcp-config)#lease 8 0 0
router-1(dhcp-config)#exit
router-1(config)#
router-1(config)#ip dhcp excluded-address 172.16.2.1 172.16.2.99
router-1(config)#
You can see that I started in privileged mode and moved the command prompt to global configuration mode to configure the DHCP settings. I named the pool “Marketing” for this example. Additionally, the “default-router” setting is the IP address of the router’s interface that the hosts will connect to. Lastly, the lease command is configured in days, hours then minutes (so the configured lease is for exactly eight days).
I hope this post proves helpful to you!
Copyright © 2024, Noel Alvarez. Proudly powered by WordPress. Blackoot design by Iceable Themes.