Skip to content
Ask AI

Policy Route Configuration

[Command]

**show pbr interface ** [ interface-name ]

[Purpose]

View the binding relationship between interfaces and policy routes

[View]

System view

[Use Cases]

sonic# show pbr interface Ethernet30
Ethernet30(38) with pbr-policy TEST

[Command]

show pbr map [map-name]

[Purpose]

Display the configured policy routes

[View]

System view

[Use Cases]

sonic# show pbr map
pbr-map TEST valid: no
Seq: 10 rule: 309
Installed: no Reason: Invalid NH
SRC Match: 10.255.255.0/30
nexthop 10.254.254.1
Installed: no Tableid: 10000

[Command]

show pbr nexthop-groups

[Purpose]

Displays the next address group for the policy route

[View]

System view

[Use Cases]

sonic# show pbr nexthop-groups
Nexthop-Group: TEST Table: 10001 Valid: 1 Installed: 1
Valid: 0 nexthop Ethernet32
Valid: 1 nexthop Ethernet31

[Command]

pbr-map NAME seq number

no pbr-map NAME [seq number ]

[Purpose]

Create a policy route and enter the view

[Parameter]

ParameterDescription
nameSpecify the policy name
numberPolicy ID, value range: 1-700, the lower the number, the higher the priority

[View]

System configuration view

[Use Cases]

sonic(config)# pbr-map TEST seq 10
sonic(config-pbr-map)#

[Command]

match {dst-ip ip-address |dst-port port |ip-protocol protocol |src-ip ip-address |src-port port }

no match {dst-ip ip-address |dst-port port |ip-protocol protocol |src-ip ip-address |src-port port }

[Purpose]

Create match conditions for policy routing

[Parameter]

ParameterDescription
dst-ipMatch the destination IP address of the packet
dst-portMatch the destination port of the packet
ip-protocolMatch the protocol type of the packet
src-ipMatch the source IP address of the packet
src-portMatch the source port of the packet

[View]

Policy route view

[Use Cases]

sonic(config)# pbr-map TEST seq 10
sonic(config-pbr-map)# match src-ip 1.1.1.0/24

[Command]

set {nexthop ip-address |nexthop-group NAME } no set {nexthop ip-address |nexthop-group NAME }

[Purpose]

Configure an action of redirecting packets to a next-hop IP address

[Parameter]

ParameterDescription
nexthop ip-addressNexthop ip address
nexthop-group nameNexthop group name

[View]

Policy route view

[Notes] The redirect nexthop command allows user to specify a maximum of 4 next-hop IP addresses. If multiple next-hop IP addresses are configured, the device redirects packets in active/standby mode. The device determines the primary link and backup links according to the sequence in which next-hop IP addresses were configured. The next-hop IP address that was configured first has the highest priority and this next hop is used as the primary path. Other next hops are used as backup paths. When the primary link becomes Down, a next hop with higher priority is used as the primary path.

[Use Cases]

sonic(config)# nexthop-group TEST
sonic(config-pbr-map)# set nexthop 1.1.1.0/24

[Command]

nexthop-group NAME

no nexthop-group NAME

[Purpose]

Create a next-hop address group and enter the view

[View]

System configuration view

[Use Cases]

sonic(config)# nexthop-group TEST
sonic(config-nh-group)#

[Command]

nexthop ip_address

no nexthop ip_address

[Purpose]

Configure the member addresses in the next-hop address group

[View]

Nexthop group view

[Notes] If multiple next-hop IP addresses are specified, the device redirects packets in ECMP load balancing mode

[Use Cases]

sonic(config)# nexthop-group TEST
sonic(config-nh-group)# nexthop 1.1.1.0/24
sonic(config-nh-group)# nexthop 1.1.2.0/24

[Command]

pbr-policy NAME no pbr-policy NAME

[Purpose]

Bind the policy route to the specified interface

[View]

Interface view

[Use Cases]

sonic(config)# interface ethernet 1
sonic(config-if-1)# pbr-policy TEST