共用方式為


Netsh RAS IP Context Commands

Applies To: Windows Server 2008, Windows Server 2008 R2

The following commands are specific to the ras IP (IPv4) context within the Netsh environment.

To view the command syntax, click a command:

  • dump

Add commands

  • add range

Delete commands

  • delete pool

  • delete range

Set commands

  • set access

  • set addrassign

  • set addrreq

  • set broadcastnameresolution

  • set negotiation

  • set preferredadapter

Show commands

  • show config

  • show preferredadapter

Netsh commands for ras IP

  • The IP context is for IP version 4. The following entries provide details for each command.

dump

Displays the IP configuration of a remote access server in script form.

Syntax

dump

Remarks

  • You can dump the contents of the current configuration to a file that can be used to restore altered configuration settings.

Example

The following commands save the current configuration as a script in the c:\test\rasipcfg.dmp file.

  • From the command prompt:

    netsh ras ip dump > c:\test\rasipcfg.dmp

  • From the netsh ras ip context prompt:

    set file open c:\test\rasipcfg.dmp

    dump

    set file close

You can use the netsh exec command to run the script created by the netsh dump command.

show config

Displays the current IPv4 configuration of the remote access server.

Syntax

show config

set negotiation

Specifies whether the remote access server should allow IPv4 to be used on client connections the server accepts.

Syntax

set negotiation

mode = ] { allow | deny }

Parameters

  • mode = ] { allow | deny }
    Required. Specifies whether to permit the use of the IPv4 protocol over client connections. The allow parameter allows IPv4 over client connections. The deny parameter prevents IPv4 over client connections.

set access

Specifies whether IPv4 network traffic from any client are forwarded to the network or networks to which the remote access server is connected.

Syntax

set access

mode = ] { all | serveronly }

Parameters

  • mode = ] { all | serveronly }
    Required. Specifies whether clients are able to reach the remote access server and any networks to which it is connected. The all parameter allows clients to reach networks through the server. The serveronly parameter allows clients to reach only the server and any shared folders that it makes available.

set addrassign

Sets the method by which the remote access server assigns IP addresses to its clients.

Syntax

set addrassign

method = ] { auto | pool }

Parameters

  • method = ] { auto | pool }
    Required. Specifies whether IPv4 addresses are assigned by using DHCP or from a pool of addresses held by the remote access server. The auto parameter specifies that addresses are assigned by using DHCP. If no DHCP server is available, a random, private address is assigned. The pool parameter specifies that addresses are assigned from a pool.

set addrreq

Specifies whether dial-up clients are able to request their own IPv4 addresses.

Syntax

set addrreq

mode = ] { allow | deny }

Parameters

  • mode = ] { allow | deny }
    Required. Specifies whether clients are able to request their own IPv4 addresses. The allow parameter allows clients to request addresses. The deny parameter prevents clients from requesting addresses.

set broadcastnameresolution

Enables or disables broadcast name resolution using NetBIOS over TCP/IP.

Syntax

set broadcastnameresolution

mode = ] { enabled | disabled }

Parameters

  • mode = ] { enabled | disabled }
    Required. Specifies whether to enable or disable broadcast name resolution using NetBIOS over TCP/IP. The enabled parameter enables broadcast name resolution using NetBIOS over TCP/IP. The disabled parameter disables broadcast name resolution using NetBIOS over TCP/IP.

Remarks

  • To check the status of broadcastnameresolution, use the dump command.

add range

Adds a range of addresses to the pool of static IPv4 addresses that the remote access server can assign to clients.

Syntax

add range

from = ] StartingIPAddress

to = ] EndingIPAddress

Parameters

  • from = ] StartingIPAddress [ to = ] EndingIPAddress
    Required. Specifies the range of IPv4 addresses to add. The StartingIPAddress parameter specifies the first IPv4 address in the range. The EndingIPAddress parameter specifies the last IPv4 address in the range.

Example

To add the range of IPv4 addresses 10.2.2.10 through 10.2.2.20 to the static pool of IP addresses that the remote access server can assign, type:

add range from=10.2.2.10 to=10.2.2.20

delete range

Deletes a range of addresses from the pool of static IPv4 addresses that the remote access server can assign to clients.

Syntax

delete range

from = ] StartingIPAddress

to = ] EndingIPAddress

Parameters

  • from = ] StartingIPAddress [ to = ] EndingIPAddress
    Required. Specifies the range of IPv4 addresses to delete. The StartingIPAddress parameter specifies the first IPv4 address in the range. The EndingIPAddress parameter specifies the last IPv4 address in the range.

Example

To delete the range of IPv4 addresses 10.2.2.10 through 10.2.2.20 from the pool of static IPv4 addresses that the remote access server can assign, type:

delete range from=10.2.2.10 to=10.2.2.20

delete pool

Deletes all addresses from the pool of static IP addresses that the remote access server can assign to clients.

Syntax

delete pool

set preferredadapter

Specifies the preferred adapter for the Routing and Remote Access service.

Syntax

set preferredadapter

name = ] InterfaceName

Parameters

  • name = ] InterfaceName
    Specifies the adapter used to obtain the IPv4 addresses for allocation (if configured to use DHCP) and the IPv4 address of DHCP and WINS servers for assignment to remote access clients and demand-dial routers. If no interface is specified, the server randomly selects an adapter when the Routing and Remote Access service is started.

show preferredadapter

Displays the preferred adapter for Routing and Remote Access service.

Syntax

show preferredadapter