Policy Route Configuration
show pbr interface
Section titled “show pbr interface”[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 Ethernet30Ethernet30(38) with pbr-policy TESTshow pbr map [map-name]
Section titled “show pbr map [map-name]”[Command]
show pbr map [map-name]
[Purpose]
Display the configured policy routes
[View]
System view
[Use Cases]
sonic# show pbr mappbr-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: 10000show pbr nexthop-groups
Section titled “show pbr nexthop-groups”[Command]
show pbr nexthop-groups
[Purpose]
Displays the next address group for the policy route
[View]
System view
[Use Cases]
sonic# show pbr nexthop-groupsNexthop-Group: TEST Table: 10001 Valid: 1 Installed: 1 Valid: 0 nexthop Ethernet32 Valid: 1 nexthop Ethernet31pbr-map
Section titled “pbr-map”[Command]
pbr-map NAME seq number
no pbr-map NAME [seq number ]
[Purpose]
Create a policy route and enter the view
[Parameter]
| Parameter | Description |
|---|---|
| name | Specify the policy name |
| number | Policy 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 10sonic(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]
| Parameter | Description |
|---|---|
| dst-ip | Match the destination IP address of the packet |
| dst-port | Match the destination port of the packet |
| ip-protocol | Match the protocol type of the packet |
| src-ip | Match the source IP address of the packet |
| src-port | Match the source port of the packet |
[View]
Policy route view
[Use Cases]
sonic(config)# pbr-map TEST seq 10sonic(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]
| Parameter | Description |
|---|---|
| nexthop ip-address | Nexthop ip address |
| nexthop-group name | Nexthop 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 TESTsonic(config-pbr-map)# set nexthop 1.1.1.0/24nexthop-group
Section titled “nexthop-group”[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 TESTsonic(config-nh-group)#nexthop
Section titled “nexthop”[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 TESTsonic(config-nh-group)# nexthop 1.1.1.0/24sonic(config-nh-group)# nexthop 1.1.2.0/24pbr-policy
Section titled “pbr-policy”[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 1sonic(config-if-1)# pbr-policy TEST