Command Line Reference
IP Unicast Routing
Policy Route Configuration
12 min
policy route configuration policy route configuration show pbr interface show pbr interface interface name \[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 ethernet13 ethernet13(54) with pbr policy test show pbr map 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 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 show pbr nexthop groups 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 groups nexthop group test table 10001 valid 1 installed 1 	valid 0 nexthop ethernet32 	valid 1 nexthop ethernet31 pbr map pbr map name seq number \[command] pbr map name seq number \[purpose] create a policy route and enter the view \[parameter] true 121,540 left #4283c7 unhandled content type left #4283c7 unhandled content type left 1 1 unhandled content type left 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type \[view] system configuration view \[use cases] sonic(config)# pbr map test seq 10 sonic(config pbr map)# match { match { dst ip ip address|dst port port|ip protocol protocol|src ip ip address|src port port } \[command] 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] true 172,489 left #4283c7 unhandled content type left #4283c7 unhandled content type left 1 1 unhandled content type left 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type left 1 1 unhandled content type left 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type left 1 1 unhandled content type left 1 1 unhandled content type \[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 set { set { nexthop ip address|nexthop group name } \[command] set { nexthop ip address|nexthop group name } \[purpose] configure an action of redirecting packets to a next hop ip address \[parameter] true 217,444 left #4283c7 unhandled content type left #4283c7 unhandled content type left 1 1 unhandled content type left 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type left #d8e5f5 1 1 unhandled content type \[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 nexthop group nexthop group name \[command] 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)# nexthop nexthop ip address \[command] 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 pbr policy pbr policy name \[command] 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 src interface src interface interface num \[command] src interface interface num no src interface interface num \[purpose] specify that messages from a specific source interface can go to the specified next hop based on the message source and corresponding matching conditions, go to the corresponding exit output \[view] policy route view \[notes] this traceability function needs to be used in conjunction with spi functionality to enable spi functionality based on the different types of requirement messages \[use cases] sonic(config)# pbr map test seq 6 sonic(config pbr map)# src interface 13
