PowerShell Logo Small

New-NetRoute



This is the built-in help made by Microsoft for the command 'New-NetRoute', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Creates an entry in the IP routing table.

SYNTAX


New-NetRoute [-DestinationPrefix] <String> [-AddressFamily <AddressFamily>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>]
[-NextHop <String>] [-PolicyStore <String>] [-PreferredLifetime <TimeSpan>] [-Publish <Publish>] [-RouteMetric <UInt16>] [-ThrottleLimit
<Int32>] [-ValidLifetime <TimeSpan>] -InterfaceAlias <String> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
New-NetRoute [-DestinationPrefix] <String> [-AddressFamily <AddressFamily>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>]
[-NextHop <String>] [-PolicyStore <String>] [-PreferredLifetime <TimeSpan>] [-Publish <Publish>] [-RouteMetric <UInt16>] [-ThrottleLimit
<Int32>] [-ValidLifetime <TimeSpan>] -InterfaceIndex <UInt32> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-NetRoute cmdlet creates an entry in the IP routing table, including properties such as destination network prefixes, Next Hop IP
addresses and Route Metrics.


IP routing is the process of forwarding a packet based on the destination IP address. Routing occurs at a sending TCP/IP host and at an IP
router.

In each case, the IP layer at the sending host or router must decide where to forward the packet. For IPv4, routers are also commonly referred
to as gateways. To make these decisions, the IP layer consults a routing table stored in memory. Routing table entries are created by default
when TCP/IP initializes, and entries can be added either manually or automatically. When the computer is routing, the RouteMetric property is
added to the InterfaceMetric property, described as a part of NetIPInterface. This total value is used to decide the pass-through interface to
send the forwarded packets. For more information, see IP Routing on TechNet.


Note: A gateway is a routing concept covered by the NetRoute cmdlets. For IP endpoints, the gateway specifies the forwarding or next hop IP
address over which the set of addresses defined by the network destination and subnet mask are reachable.



<

RELATED LINKS

Format-List
Get-NetRoute
Remove-NetRoute
Set-NetRoute

REMARKS

<

Examples


EXAMPLE 1

Used without parameters this cmdlet gets the IP route information for all of the interfaces.
PS C:\>New-NetRoute –InterfaceIndex 12 –DestinationPrefix 10.0.0.0/24 –NextHop 192.168.0.1


The default output omits some properties. Run this cmdlet to display all of the fields (all of the properties of the object).
PS C:\>Get-NetRoute | Format-List -Property *



This example adds an IP routing table entry.