共用方式為


IVMDHCPVirtualNetworkServer::ConfigureDHCPServer method

The ConfigureDHCPServer method sets the parameters for the virtual network DHCP server.

Syntax

HRESULT ConfigureDHCPServer(
  [in] BSTR network,
  [in] BSTR networkMask,
  [in] BSTR startingIPAddress,
  [in] BSTR endingIPAddress,
  [in] BSTR serverIPAddress
);

Parameters

network [in]

This parameter and the networkMask parameter define the range of TCP/IP addresses managed by the DHCP server. This parameter defines the base TCP/IP address of the range.

For example, a network of "192.168.0.0" and a networkMask of "255.255.255.0" defines the address range "192.168.0.1" to "192.168.0.254". ("192.168.0.0" is invalid and "192.168.0.255" is a special address used to broadcast to all nodes in this network range.)

This parameter must contain a TCP/IP address formatted as a string in dotted-decimal notation, such as "10.237.0.0".

networkMask [in]

This parameter and the network parameter define the range of TCP/IP addresses managed by the DHCP server. This parameter is a mask used to calculate the base TCP/IP address for the given network.

This parameter must contain a TCP/IP address formatted as a string in dotted-decimal notation, such as "255.255.0.0".

startingIPAddress [in]

This parameter specifies the first TCP/IP address that the server can dynamically assign to a client on the Virtual Network. Virtual Server reserves the first fifteen TCP/IP valid network and networkMask for internal use. Therefore, this parameter must have a value between the sixteenth and the last valid TCP/IP address.

For example, if the network parameter is "192.168.0.0", startingIPAddress must be between "192.168.0.16" and "192.168.0.254".

This parameter must contain a TCP/IP address formatted as a string in dotted-decimal notation, such as "10.237.0.16".

endingIPAddress [in]

This parameter specifies the last TCP/IP address that the DHCP server can dynamically assign to a client on the Virtual Network. The value must be between the startingIPAddress parameter and the last valid TCP/IP address.

This parameter must contain a TCP/IP address formatted as a string in dotted-decimal notation, such as "10.237.255.254".

serverIPAddress [in]

This parameter specifies the TCP/IP address to be used by the DHCP server. The value must be between the first valid TCP/IP address defined by the network and networkMask parameters and the startingIPAddress parameter.

This parameter must contain a TCP/IP address formatted as a string in dotted-decimal notation, such as "10.237.255.131".

Return value

This method can return one of these values.

This method supports standard return values, as well as the following. For information on Virtual Server specific return values not listed below, see HRESULT Codes Specific to the Virtual Server.

Return code Description
S_OK
The operation was successful.
E_INVALIDARG
A parameter contained no data (the string was empty).
VM_E_INVALID_IP_ADDRESS
A parameter was not a valid IP address.
VM_E_INVALID_NETWORK_ADDRESS
The IP address string must be a class A, class B, or class C address.
VM_E_INVALID_NETWORK_MASK
The network mask is not valid for the class of network address.
VM_E_INVALID_ENDING_ADDRESS
The ending IP address is not in a valid range.
VM_E_INVALID_STARTING_ADDRESS
The starting IP address is not in a valid range.
VM_E_INVALID_ADDRESS_RANGE
The starting IP address must be less than or equal to the ending IP address.
DISP_E_EXCEPTION
An unexpected error has occurred.

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMDHCPVirtualNetworkServer