共用方式為


Netsh Commands for Routing

Applies To: Windows Server 2008, Windows Server 2008 R2

You can use commands in the Netsh routing context to configure all aspects of routing. The Netsh commands for routing provide the same functionality as the Routing and Remote Access console, and the commands can be run manually at the netsh prompt or in scripts and batch files. The netsh routing context is available only on a computer running Windows Server that has the Routing and Remote Access Service installed. It is not available on a computer running a client version of Windows.

To run these commands from the command prompt, you must either enter the netsh routing context or prepend the context to the command. For example, if you are at the command prompt but have not typed netsh and then routing to enter the netsh routing context, you must type:

netsh routing command

Where command is the command that you want to run, including all of the required parameters for the command.

For more information about Netsh, see Netsh Overview and Enter a Netsh Context.

Netsh routing command reference

The Netsh commands for routing are grouped by the following command categories.

Netsh Routing IP Autodhcp Context Commands. These commands allow you to configure the DHCP allocator.

Netsh Routing IP Dnsproxy Context Commands. These commands allow you to configure Domain Name System (DNS) proxy parameters and install the routing protocol.

Netsh Routing IP IGMP Context Commands. These commands allow you to display and configure IGMP parameters.

Netsh Routing IP NAT Context Commands. These commands allow you to view and configure network address translation (NAT).

Netsh Routing IP Relay Context Commands. These commands allow you to view and configure the DHCP Relay Agent.

Netsh Routing IP RIP Context Commands. These commands allow you to display and configure various Routing Information Protocol (RIP) settings, such as: filters, RIP neighbors, and RIP statistics.

Netsh Routing IP Routerdiscovery Context Commands. These commands allow you to display and configure router discovery.

Netsh Routing IPv6 Context Commands. These commands allow you to view and configure IPv6-related routing settings.

Netsh Routing IPv6 Relayv6 Context Commands. These commands allow you to view and configure the DHCPv6 relay agent settings.

Netsh Routing example

As an example of using a netsh command: to enable router discovery for the interface named Local Area Connection, specifying a minimum interval of 7 minutes, a maximum interval of 10 minutes, a life of 30 minutes for router discovery packets, and a zero (0) or no preference level, type the following from the netsh prompt:

routing ip routerdiscovery add interface "Local Area Connection" enable 7 10 30 0

For information on how to interpret netsh command syntax, see Formatting Legend.