I would like to announce you that iSiek’s forum about Microsoft Windows services has been launched!
I hope you would participate in building new IT community on this forum. I hope we would be able to help each other.
You are invited! I encourage you to register your account for free and start posting your issues or try to help others.
Just some simple forum’s rules
- Forum is free of charge. It is maintained from ads.
- To contribute in community, free registration is required
- Write posts in English
- Check forums if similar problem does not exist
- Use appropriate forum to post issue
- Do not spam
- Use external services to attach images/logs and place only link to them
- Be polite and do not use vulgarism
- If you do not want to help, do not answer
Be a part of this new community and make family atmosphere here.
I hope we will make this IT world better!
Forum address is http://kpytko.pl/forum
Author: Krzysztof Pytko
Today, I would like to introduce new feature of DHCP role in Windows Server 2008 R2. This feature is called “Split-Scope“.
This is great improvement in that role for DHCP administrators. In earlier Windows Server versions, administrators needed to calculate by themselves how to split DHCP scope(s) between two DHCP servers for redundancy. In small networks where basic IP addressing scheme was used, that was not big problem. In large networks where VLANs were used and IP addressing scheme was more advanced, that was horrible.
DHCP servers redundancy in many companies is very important and the lowest cost of maintaining them is also crucial. So, DHCP clusters were not an option in many organizations.
Administrators needed to split scope according to their needs or Microsoft DHCP Best practices using one of recommended rules on two separate DHCP servers in a network
- 50/50 (half addresses on one DHCP server and another half on the second server)
- 80/20 (80% addresses on one DHCP server and 20% on the second server)
This required from them making exclusion ranges in scopes on DHCP servers and duplicating reservations on both servers. That was a lot of work to do! Especially, if a network had more than one scope.
When you wanted to check from which DHCP server computer received a lease you had to verify both DHCP servers lease database or run ipconfig /all command on a client to see which DHCP server isssued the lease.
DHCP servers offer leases in the same time and computer could select any of them. Mostly, the first offered lease is accepted but you cannot be sure which server offered it as the first.
From now, you don’t have to worry for all of these “limitations”. When you have both DHCP servers runnig Windows Server 2008 R2, you can simply achieve that using Split-Scope wizard. All necessary calculations will be done automatically. You can forget about making exlusion ranges in each scope on the second DHCP server and you can also forget about duplicating reservations on another server. Everything is done by Split-Scope wizard.
Another new DHCP feature is delay in lease offers. You can set up 1000 miliseconds (1 second) delay for other DHCP server and you can be sure that all of your clients will get lease from the first server.
Let’s start to show, how we can use that wizard. First, you need to install DHCP role on both Windows Server 2008 R2. Now, you can configure a scope on a server.
In this example, I will show you, how to split 192.168.1.0/24 scope between two DHCP servers (DHCP01 and DHCP02)
Log on to DHCP01 and run DHCP management console. Create a scope (if doesn’t exist) or select the existing one which you want to split.
Click right mouse button on selected scope and choose from context menu “Advanced -> Split-Scope”. You will see a wizard which helps you splitting a scope.
On “Additional DHCP Server” screen click “Add server” button and select the second DHCP server to which you want to split the scope
You can search for any DHCP server in your netwok using “Browse” button or select one of discovered from the list below
Now, you need to choose split scheme. You can choose 50/50 or 80/20 (default option) or even your own. To use other option than default, type other values (in percentage) in fields or move scroll-bar in the proper direction to adjust them ad-hoc
As I mentioned earlier, you can set up delay in leases offer to make sure that specified DHCP server will answer delayed and lease will be issued from “primary” server. To set up delay on DHCP02 in “Added DHCP Server” box, type 1000
apply settings by clicking on “Finish” button
verify if everything went well and close wizard
Check “Address pool” on current DHCP server and you will notice that DHCP Split-Scope wizard has done the job for you!
and for test, go to DHCP02 and check if scope is also split there
Notice, that scope on your DHCP02 is deactivated by default. If you wish to use it, you need to activate it first.
That’s all about configuring DHCP Split-Scope wizard.
Author: Krzysztof Pytko
Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP servers in short time or our DHCP server is in location where network connection is very slow? Do we have to configure it manually? Do we have to be patient and waste our valuable time? Answer is: NO, we can use a command-line tool which is available on each Windows 2003/2008 server. It’s very powerful utility and it’s simple in use.
This article describes how to do that on Microsoft Windows Server 2003.
If our server has installed DHCP service, we can configure it remotely from command-line using netsh command. We have to login to any Windows 2003 server and run command-line console. In this console we have to type netsh
Next, we use dhcp context of netsh to configure our DHCP server(s).
Before we start configuring server, we need some details:
- Hostname or IP address of DHCP server(s)
- Scope IP address (Network ID) and network mask
- Scope name
- Description for scope
- IP pool for scope
- Any IP reservation
- Any IP exclusion
- Default gateway IP address
- IP address of DNS servers
- Domain suffix name
- IP address of WINS servers (if required)
In our example we use:
- 192.168.1.1 as DHCP server IP address
- 192.168.1.0/24 as network ID
- TestScope as scope name
- “This is my test scope” as description
- 192.168.1.100 – 192.168.1.149 as scope’s pool
- 192.168.1.125 reserved IP address for device with 00-03-EF-15-9A-6B MAC address
- 192.168.1.130 – 192.168.1.134 as excluded IP addresses
- 192.168.1.254 as default gateway
- 192.168.1.10 and 192.168.1.11 as DNS servers
- testenv.local as DNS domain name
- 192.168.1.10 and 192.168.1.12 as WINS servers
- Hostname or IP address of DHCP server(s)
If we collect all of these settings we can start to configure DHCP server(s).
The very first thing is to create a scope on DHCP server. To do this we have to type command
netsh> dhcp server <DHCP_IP_Address_or_hostname> add scope <Scope_Network_ID> <Mask> <Scope_name> <”Scope_description”>
netsh> dhcp server 192.168.1.1 add scope 192.168.1.0 255.255.255.0 TestScope “This is my test scope”
Each time we will see this message it means that we set an option properly.
We have created a scope on our DHCP server. Now, we need to activate it
netsh> dhcp server <DHCP_IP_Address_or_hostname> scope <Scope_Network_ID> set state 1
If we don’t want to set it as active during creation process, set state value should be 0.
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 set state 0
We don’t want to active scope right now. We will do it later.
After that, we have to define IP addresses pool
netsh> dhcp server <DHCP_IP_Address_or_hostname> scope <Scope_Network_ID> add iprange <Start_IP_Address> <End_IP_Address>
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 add iprange 192.168.1.100 192.168.1.149
We have defined scope’s pool and we will exclude some IP addresses, now.
netsh> dhcp server <DHCP_IP_Address_or_hostname> scope <Scope_Network_ID> add excluderange <Start_excluded_IP_Address> <End_excluded_IP_Address>
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 add excluderange 192.168.1.130 192.168.1.134
So, if we want to exclude only one IP address we should use this syntax (let’s say only 192.168.1.130)
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 add excluderange 192.168.1.130 192.168.1.130
Now, we will enable reservation IP address for a device
netsh> dhcp server <DHCP_IP_Address_or_hostname> scope <Scope_Network_ID> add reservedip <Reserved_IP_Address> <MAC_Address> <Reservation_Name> <”Description_for_reservation”> <DHCP_Flags>
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 add reservedip 192.168.1.125 0003EF159A6B My_PC “” BOTH
DHCP_Flags are: BOOTP only, DHCP only or BOTH
The last steps we need to provide are DNS servers and domain suffix. This time we have to consider where to place them, in the scope options or in a server options. What is the difference?
If our DHCP server contains only one scope we don’t have to worry where we will place these settings, because they will only impact one scope.
Settings applied in “Scope options” affect only that particular scope. Settings configured on “Server options” will be inherited by all scopes, even the new ones. When we set “Server options” and then we additionally configure “Scope options” they will overwrite those global settings.
This is very helpful if we have more than one scope on DHCP settings (most VLAN scenarios) and we have common settings for them. Let’s say that we need to configure the same DNS servers and domain suffix for all scopes then we do it in “Server options”. The only thing we will set in “Scope options” is default gateway.
In our scenario we don’t have more that one scope, so we will configure “Scope options” providing default gateway, DNS servers and WINS servers.
netsh> dhcp server <DHCP_IP_Address_or_hostname> scope <Scope_Network_ID> set optionvalue <option_value> IPADDRESS <Default_Gateway_IP_Address or DNS_Server_IP_Addresses or WINS_Server_IP_Addresses>
for WINS we need to set
netsh> dhcp server <DHCP_IP_Address_or_hostname> scope <Scope_Network_ID> set optionvalue <option_value> BYTE <one of these node types: 1,2,4,8>
WINS node types:
1 b-node (broadcasts)
2 p-node (point-to-point name queries to WINS)
4 m-node (broadcasts then query name server)
8 h-node (query name server then broadcasts)
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 003 IPADDRESS 192.168.1.254
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 006 IPADDRESS 192.168.1.10 192.168.1.11
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 044 IPADDRESS 192.168.1.10 192.168.1.12
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 046 BYTE 8
Now, we set domain suffix
netsh> dhcp server <DHCP_IP_Address_or_hostname> scope <Scope_Network_ID> set optionvalue <option_value> STRING <Domain_suffix>
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 015 STRING testenv.local
We’ve just finished DHCP configuration. Now, we have to enable scope for serving IP addresses and authorize our DHCP server
netsh> dhcp server 192.168.1.1 scope 192.168.1.0 set state 1 (now scope is active)
netsh> dhcp server initiate auth (now DHCP server is authorized)
We finished our DHCP server configuration. If we need any other “Scope/Server options” we can set them like we did it with DNS,WINS and others.
OK, but you wrote that it will be automated and simple configuration but we lost so much time configuring DHCP server from command-line? We could do it via console! Yes, you’re right we have to prepare a template for automated configuration.
Preparing template for automated DHCP configuration is very simple. We have to put all those commands into text file without NETSH command, so let’s create i.e. text file named dhcp_conf.txt and put there
dhcp server 192.168.1.1 add scope 192.168.1.0 255.255.255.0 TestScope “This is my test scope”
dhcp server 192.168.1.1 scope 192.168.1.0 set state 0
dhcp server 192.168.1.1 scope 192.168.1.0 add iprange 192.168.1.100 192.168.1.149
dhcp server 192.168.1.1 scope 192.168.1.0 add excluderange 192.168.1.130 192.168.1.134
dhcp server 192.168.1.1 scope 192.168.1.0 add reservedip 192.168.1.125 0003EF159A6B My_PC “” BOTH
dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 003 IPADDRESS 192.168.1.254
dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 006 IPADDRESS 192.168.1.10 192.168.1.11
dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 044 IPADDRESS 192.168.1.10 192.168.1.12
dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 046 BYTE 8
dhcp server 192.168.1.1 scope 192.168.1.0 set optionvalue 015 STRING testenv.local
dhcp server 192.168.1.1 scope 192.168.1.0 set state 1
dhcp server initiate auth
and save this file on the network drive which is available from any Windows Server 2003/2008 machine. Now, we can modify necessary parts of this template to adjust it for any other DHCP server configuration.
The only thing that we have to do is running NETSH command on Windows 2003/2008 Server in context of EXEC <full_path_to_dhcp-conf.txt_file>
netsh exec c:dhcp_conf.txt
Author: Krzysztof Pytko