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
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.