Professional Windows Server 1002003 Security A Technical Reference [Electronic resources]

Roberta Bragg

نسخه متنی -صفحه : 415/ 350
نمايش فراداده

netsh/DHCP Context

Configures DHCP servers.

Subcontexts

Server
Scope
Mscope

Commands

list

Lists available DHCP commands (more verbose than help).

dump

Dumps the configuration of the DHCP server as a series of NetShell commands.

add server [servername | serveraddress]

Adds a DHCP server to the list of authorized DHCP servers stored in Active Directory. You can specify either the DNS name or IP address of the server.

delete server [servername | serveraddress]

Removes a DHCP server from the list of authorized DHCP servers.

show server

Lists all authorized DHCP servers in the current domain.

server [\\servername | serveraddress]

Enters the subcontext for the specified DHCP server, which enables you to configure the DHCP server using the add, delete, initiate, scope, mscope, set, and show commands. These commands and their options are summarized in Table 5-8.

Note that the scope and mscope commands enter new subcontexts. The Scope context configures a specific scope on the server, and Mscope configures multicast scopes. The commands available in these subcontexts are shown in Table 5-9 and Table 5-10.

You can tell what context you are currently in by the command prompt during a NetShell session. For example:

C:\>netsh
netsh>dhcp
dhcp>server \\mydhcp
dhcp server>

In the previous example, you move from the Windows command shell to the NetShell global context (netsh>), then to the DHCP context (dhcp>), and finally to the DHCP server context (dhcp server>), which is a subcontext for a particular DHCP server. From here, you could move deeper into the subcontext of a particular scope on the specified server and so on.

Table 5-8. Commands available in DHCP Server subcontext

Command

Option

Description

add

class

Adds a new class

mscope

Adds a new multicast scope

optiondef

Adds a new option

scope

Adds a scope

delete

class

Deletes a class

mscope

Deletes a multicast scope

optiondef

Deletes an option

optionvalue

Deletes an option value

scope

Deletes a scope

superscope

Deletes a superscope

initiate

auth

Reauthorizes the server

reconcile

Reconciles the DHCP database

mscope

mscope-name

Switches to specified mscope

scope

scope-ip-address

Switches to specified scope

set

auditlog

Configures audit log settings

databasebackupinterval

Specifies database backup interval

databasebackuppath

Specifies database backup path

databasecleanupinterval

Specifies database cleanup interval

databaseloggingflag

Resets flag for database logging

databasename

Specifies name of database file

databasepath

Specifies path of database file

databaserestoreflag

Resets flag for database restore

detectconflictretry

Specifies conflict detection attempts

dnsconfig

Configures Dynamic DNS settings

optionvalue

Configures global option value

server

Specifies the current DHCP server

userclass

Specifies the global user class name

vendorclass

Specifies the global vendor class name

show

all

Displays all DHCP server settings

auditlog

Displays the audit log settings

bindings

Displays bindings

class

Lists available classes

detectconflictretry

Displays detect-conflict-retry settings

dnsconfig

Displays Dynamic DNS settings

mibinfo

Displays MIB information

mscope

Lists multicast scopes

optiondef

Displays DHCP options

optionvalue

Displays configured option values

scope

Lists all available scopes

server

Displays current server

dbproperties

Displays database configuration

serverstatus

Shows current status of server

userclass

Displays current user class name

vendorclass

Displays current vendor class name

version

Displays server version number

optiondef

Deletes an option

Table 5-9. Commands available in DHCP Server Scope subcontext

Command

Option

Description

add

excluderange

Specifies an exclusion

iprange

Specifies an IP address range

reservedip

Creates a new reservation

delete

excluderange

Removes an exclusion

iprange

Removes an IP address range

optionvalue

Deletes a scope option value

reservedip

Deletes a reservation

reservedoptionvalue

Deletes a reservation option value

initiate

reconcile

Reconciles current scope

set

comment

Specifies a comment

name

Specifies scope name

optionvalue

Specifies an option value

reservedoptionvalue

Specifies a reserved option value

scope

Specifies the current scope

state

Toggles current scope active/inactive

superscope

Specifies the current superscope

show

clients

Lists available Version 4 clients

clientsv5

Lists available Version 5 clients

excluderange

Lists configured exclusions

iprange

Lists configured IP address ranges

optionvalue

Lists configured option values

reservedip

Lists configured reservations

reservedoptionvalue

Lists configured reserved option values

scope

Displays current scope

state

Displays state of current scope

Table 5-10. Commands available in DHCP Server Mscope subcontext

Command

Option

Description

add

excluderange

Specifies an exclusion

iprange

Specifies an IP address range

delete

excluderange

Removes an exclusion

iprange

Removes an IP address range

initiate

reconcile

Reconciles current scope

set

comment

Specifies a comment

lease

Specifies lease duration

mscope

Specifies the current scope

name

Specifies scope name

state

Toggles current scope active/inactive

ttl

Specifies time-to-live (TTL) value

show

clients

Lists available clients

excluderange

Lists configured exclusions

iprange

Lists configured IP address ranges

lease

Shows current lease duration

mibinfo

Displays MIB information

mscope

Displays current scope

state

Displays state of current scope

ttl

Displays time-to-live (TTL) value

Examples

Configure the scope on the DHCP server with IP address 172.16.11.104:

C:\>netsh
netsh>dhcp
dhcp>server 172.16.11.104
dhcp server>show scope
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Scope Address  - Subnet Mask    - State   - Scope Name          
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
172.16.11.0    - 255.255.255.0  -Active   -Building 14
Total No. of Scopes = 1
Command completed successfully.

Switch to subcontext of the defined scope:

dhcp server>scope 172.16.11.0
Changed the current scope context to 172.16.11.0 scope.

Show the range of IP addresses in the current scope:

dhcp server scope>show iprange
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Start Address   -    End Address    -     Address Type
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
172.16.11.220   -    172.16.11.240   -    DHCP ONLY
No. of IPRanges : 1 in the Scope : 172.16.11.0.
Command completed successfully.

Show addresses excluded from the scope:

dhcp server scope>show excluderange
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Start Address   -    End Address
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
172.16.11.233   -   172.16.11.233
No. of ExcludeRanges : 1 in the Scope : 172.16.11.0.
Command completed successfully.

To exclude the addresses 172.16.11.236 through 172.16.11.238 from the scope, first check the syntax for adding an exclusion range:

dhcp server scope>add excluderange ?
To exclude a range of IP addresses from distribution by the scope.
Syntax:
add excluderange StartIP EndIP
Parameters:
StartIP        - The starting IP address of the 
exclusion range.
EndIP          - The ending IP address of the 
exclusion range.
Example:       add excluderange 10.2.2.10 10.2.2.20
This command excludes IP addresses in the range 10.2.2.10 to 10.2.2.20 from 
distribution in the scope.

Exclude the addresses:

dhcp server scope>add excluderange 172.16.11.236  172.16.11.238
Command completed successfully.

Verify the results:

dhcp server scope>show excluderange
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Start Address   -    End Address
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
172.16.11.233   -   172.16.11.233
172.16.11.236   -   172.16.11.238
No. of ExcludeRanges : 2 in the Scope : 172.16.11.0.
Command completed successfully.

Quit the NetShell shell:

dhcp server scope>quit
C:\>

Notes

  • You must be a member of the Enterprise Admins group to configure DHCP servers.

  • NetShell's DHCP context is particularly useful for managing remote DHCP servers over slow WAN links where using the remote-administration Terminal Server mode to run the GUI DHCP management tool would result in poor performance.

See Also

DHCP