- Create a certificate-signed RDP shortcut via Group Policy - Fri, Aug 9 2019
- Monitor web server uptime with a PowerShell script - Tue, Aug 6 2019
- How to build a PowerShell inventory script for Windows Servers - Fri, Aug 2 2019
If you're going to follow along, I'll be assuming you have a few things in place. I'm expecting you're on a network with at least one Windows Server 2016 online and you've already installed the DHCP server role. I'll also assume you have all the appropriate rights to create and modify DHCP scopes in your environment.
Creating new DHCP scopes
Let's first run through adding a scope and adjusting some of its settings. To get started, I'll launch the DHCP administrative tool on my Windows Server. If I expand out one of my DHCP servers, I can also expand on IPv4 and see that I do not currently have any scopes set up.
So, to create a scope, we're going to right-click on IPv4 and select the option for New Scope. This launches the New Scope Wizard, so we click on Next and give our scope a descriptive name. I'll be boring here and call it Corporate and then specify the start and end IP addresses this scope will be handing out.
You may need to whip out a subnet calculator at this point as I did. I'm not handing out addresses at the beginning or end of the subnet. This is just in case I need to set up some static addresses and have them be outside the DHCP range so that my DHCP server isn't going to hand them out.
Then if there are other addresses we want to exclude, we can specify them here on the Add Exclusions and Delay options for the New Scope Wizard. I'm adding in another range from 10.3.1.1 to .20 so that I have some addresses there.
On the next screen, we can set the lease duration indicating how long to bind that address for. I don't like the long leases of eight days, so I'm going to bump this down to one.
After setting the exclusions, we can then configure the other DHCP options in the next few screens, like router (default gateway for clients) and the DNS domain. I usually use the .1 address for the router, but it can be any IP address in the network you'd like. In my case, the DNS domain is my Active Directory domain. For my DNS servers, you can see 10.2.2.2 and 10.2.2.3.
Once you've specified the DNS servers, you can then specify WINS servers (which I have none of) and finally activate the DHCP scope on the last step. Activation makes the scope live and will begin handing out IP addresses.
Modifying DHCP scopes
Once I click the Finish button, this creates the scope for us. At this point, you can now see that under IPv4, I have an additional scope. Right next to the scope, inside of the square brackets, you see 10.3.0.0. This is the scope's ID, and if we click on the scope, we get all of these other options below it as well, so we can look at the address pool. These are the addresses it hands out, so you can see the start and end IP addresses as well as the exclusion we set up. Looking at the leases would usually show us a list of all the addresses this scope has handed out. There aren't any yet.
So if we want to edit some of the settings for the scope, we can right-click on the scope and select the Properties option. We can change the name here if we want. We can also change the start and end IP, and we can change the lease duration. So for instance, if I thought one day wasn't long enough, I could change this to two days or as many days as I wanted. Then I'm going to click Apply.
If I wanted it to stop handing out IP addresses, it's just a matter of right-clicking on the scope and selecting the option to Deactivate. Then, of course, it asks us if we're sure. Why, yes, we are this time. Then to reactivate it, it's just a right-click and Activate.
Then, of course, we can also look at some of this scope's statistics. So if we wanted to see how many addresses it handed out, we don't want to go through and hand-count them all or how many addresses are available. This is where that option is; right-click on it and select the Display statistics option. So this is how you create and edit the basic settings of a scope on a Microsoft DHCP server.
Subscribe to 4sysops newsletter!
At this point, you have an activated DHCP scope set up and tuned to your custom specifications!