Saving and restoring the DHCP configuration
After you configure all the necessary DHCP settings, you might want to save the DHCP configuration so that you can restore it on the DHCP server. To save the configuration, enter the following command at the command prompt:
netsh dump DHCP › dhcpconfig.dmp
In this example, dhcpconfig.dmp is the name of the configuration script you want to create. By default, the script is created in the current working directory. Alternatively, you can specify the full file path in which to save the script. After you create this script, you can restore the configuration by executing the script. If you saved the script in the current working directory, you can enter the following command at the command prompt:
netsh exec dhcpconfig.dmp
If you saved the script in another directory, you can specify the full path to the script, such as:
netsh exec d: \dhcp\scripts\dhcpconfig.dmp
TIP You can also use this technique to set up another DHCP server with the same configuration. Just copy the configuration script to a folder on the destination computer, and then execute it.
You can save or restore the DHCP configuration by using the DHCP console as well. To save the configuration, press and hold or right-click the DHCP server entry, tap or click Backup, use the dialog box provided to select the folder for the backup, and then tap or click OK. To restore the configuration, press and hold or right-click the DHCP server entry, tap or click Restore, use the dialog box provided to select the backup folder, and then tap or click OK. When prompted to confirm, tap or click Yes.
At an elevated Windows PowerShell prompt, you use Export-DhcpServer to save the configuration settings. The basic syntax is:
Export-DhcpServer -ComputerName ServerID -File SavePath
Here, ServerID is the DNS name or IP address of the DHCP server, and SavePath is the path and name of the file in which you want to store the configuration settings. If you omit the name of the server to work with, the local server is used. If you don’t specify a save path along with the file name, the configuration file is created in the current working directory. In the following example, you store the configuration settings in the d: \dhcp\scripts directory with the name dhcpconfig.dmp:
Export-DhcpServer-File d: \dhcp\scripts\dhcpconfig.dmp
You can restore the configuration using Import-DhcpServer. The basic syntax is:
Import-DhcpServer -ComputerName ServerID -BackupPath CurrentConfigSavePath -File SavePath
Here, SavePath is the path and name of the file in which you stored the configuration settings and CurrentConfigSavePath specifies the path where the current configuration should be saved prior to importing and overwriting existing settings. In the following example, you back up the settings to d: \dhcp\backup\origconfig. dmp and then apply the saved configuration from d: \dhcp\scripts\dhcpconfig.dmp:
Import-DhcpServer-BackupPath d: \dhcp\backup\origconfig.dmp -File d: \dhcp\scripts\dhcpconfig.dmp
After you install a DHCP server, you need to configure the scopes that the DHCP server will use. Scopes are pools of IP addresses you can lease to clients. As explained earlier in “Understanding scopes,” you can create superscopes, normal scopes, multicast scopes, and failover scopes with IPv4 addresses, but you can create only normal scopes with IPv6 addresses.
Creating and managing superscopes
A superscope is a container for IPv4 scopes in much the same way that an organizational unit is a container for Active Directory objects. Superscopes help you manage scopes available on the network by grouping them into a single point of management. For example, with a superscope, you can activate or deactivate multiple scopes through a single action. You can also view statistics for all scopes in the superscope rather than having to check statistics for each scope. Superscopes also support DHCP clients on a single physical network where multiple logical IP networks are used, or put another way, you can create superscopes to distribute IP addresses from different logical networks to the same physical network segment.
Creating superscopes
After you create at least one normal or multicast IPv4 scope, you can create a superscope by following these steps:
1.In the DHCP console, expand the node for the server with which you want to work, press and hold or right-click IPv4, and then tap or click New Superscope to start the New Superscope Wizard. Tap or click Next.
2.Enter a name for the superscope, and then tap or click Next.
3.Select scopes to add to the superscope. Select individual scopes by tapping or clicking their entry in the Available Scopes list. Select multiple scopes by tapping or clicking entries while holding down Shift or Ctrl.
4.Tap or click Next, and then tap or click Finish.
Adding scopes to a superscope
You can add scopes to a superscope when you create it, or you can add the scopes later. To add a scope to a superscope, follow these steps:
1.Press and hold or right-click the scope you want to add to a superscope, and then tap or click Add To Superscope.
2.In the Add Scope To A Superscope dialog box, select a superscope.
3.Tap or click OK. The scope is then added to the superscope.
Removing scopes from a superscope
To remove a scope from a superscope, follow these steps:
1.Press and hold or right-click the scope you want to remove from a superscope, and then tap or click Remove From Superscope.
2.Confirm the action by tapping or clicking Yes when prompted. If this is the last scope in the superscope, the superscope is deleted automatically.
Activating and deactivating a superscope
When you activate or deactivate a superscope, you make all the scopes within the superscope active or inactive. To activate a superscope, press and hold or right-click the superscope, and then select Activate. To deactivate a superscope, press and hold or right-click the superscope, and then select Deactivate.
Deleting a superscope
Deleting a superscope removes the superscope container but doesn’t delete the scopes it contains. If you want to delete the member scopes, you’ll need to do that separately. To delete a superscope, press and hold or right-click the superscope, and then select Delete. When prompted, tap or click Yes to confirm the action.
Creating and managing scopes
Scopes provide a pool of IP addresses for DHCP clients. A normal scope is a scope with class A, B, or C network addresses. A multicast scope is a scope with class D network addresses. Although you create normal scopes and multicast scopes differently, you manage them in much the same way. The key differences are that multicast scopes can’t use reservations, and you can’t set additional options for WINS, DNS, routing, and so forth.
Creating normal scopes for IPv4 addresses
You can create a normal scope for IPv4 addresses by following these steps:
1.In the DHCP console, expand the node for the server with which you want to work, and then press and hold or right-click IPv4. If you want to add the new scope to a superscope automatically, press and hold or right-click the superscope instead.
Читать дальше