Skip to content
dscbot edited this page Jun 7, 2024 · 6 revisions

Route

Parameters

Parameter Attribute DataType Description Allowed Values
InterfaceAlias Key String Specifies the alias of a network interface.
AddressFamily Key String Specifies the IP address family. IPv4, IPv6
DestinationPrefix Key String Specifies a destination prefix of an IP route. A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/).
NextHop Key String Specifies the next hop for the IP route.
Ensure Write String Specifies whether the route should exist. Defaults to 'Present'. Present, Absent
RouteMetric Write UInt16 Specifies an integer route metric for an IP route. Defaults to 256.
Publish Write String Specifies the publish setting of an IP route. Defaults to 'No'. No, Yes, Age
PreferredLifetime Write Real64 Specifies a preferred lifetime in seconds of an IP route.

Description

This resource is used to control static routes on an interface for a node.

Examples

Example 1

Add a net route to the Ethernet interface.

Configuration Route_AddRoute_Config
{
    Import-DSCResource -ModuleName NetworkingDsc

    Node localhost
    {
        Route NetRoute1
        {
            Ensure = 'Present'
            InterfaceAlias = 'Ethernet'
            AddressFamily = 'IPv4'
            DestinationPrefix = '192.168.0.0/16'
            NextHop = '192.168.120.0'
            RouteMetric = 200
        }
    }
}