Configuration Guide
Policy-Based Routing Configuration Guide
7 min
introduction introduction policy based routing (pbr) is a routing mechanism that forwards packets based on custom defined policies when packets are routed, they can be matched based on source ip address, destination ip address, ip protocol, source tcp/udp port number, and destination tcp/udp port number for packets that meet the matching conditions, the next hop is set to complete the forwarding control of the packets policy based routing configuration policy based routing configuration configure policy based routing configure policy based routing table 1 configure policy based routing table 1 configure policy based routing true 218,235 2970297029703,152 7029702970297 left #4283c7 unhandled content type left #4283c7 unhandled content type left #4283c7 unhandled content type left unhandled content type left unhandled content type left unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left unhandled content type left unhandled content type left unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left unhandled content type left unhandled content type left unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type configure interface binding with policy routing configure interface binding with policy routing table 2 configure interface binding with policy routing table 2 configure interface binding with policy routing true 155,206 15688487584652,244 84311512415348 left #4283c7 unhandled content type left #4283c7 unhandled content type left #4283c7 unhandled content type left unhandled content type left unhandled content type left unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left unhandled content type left unhandled content type left unhandled content type display and maintenance display and maintenance table 3 pbr display and maintenance table 3 pbr display and maintenance true 174,300 15955056179774,131 84044943820226 left #4283c7 unhandled content type left #4283c7 unhandled content type left #4283c7 unhandled content type left unhandled content type left unhandled content type left unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left #d8e5f5 unhandled content type left unhandled content type left unhandled content type left unhandled content type typical configuration example typical configuration example networking requirements to achieve flexible scheduling and refined management of traffic, policy routing (pbr) technology needs to be deployed in the network architecture we now require vm1 to serve as the traffic source, release two streams of traffic externally, configure pbr through the switch, and forward one stream to vm2 and the other stream to vm3 to meet the traffic processing needs in different business scenarios, improve network resource utilization efficiency and business flexibility topology procedure \#configure interface ip sonic# config terminal sonic(config)# interface ethernet 0/72 sonic(config if 0/72)# ip address 72 0 0 1/24 sonic(config if 0/72)# exit sonic(config)# interface ethernet 0/73 sonic(config if 0/73)# ip address 73 0 0 1/24 sonic(config if 0/73)# exit sonic(config)# interface ethernet 0/74 sonic(config if 0/74)# ip address 74 0 0 1/24 sonic(config if 0/74)# exit \#configure pbr sonic# config terminal sonic(config)# pbr map test seq 1 sonic(config pbr map)# match src ip 1 0 0 0/24 sonic(config pbr map)# set nexthop 73 0 0 2 sonic(config pbr map)# exit sonic(config)# pbr map test seq 2 sonic(config pbr map)# match src ip 2 0 0 0/24 sonic(config pbr map)# set nexthop 74 0 0 2 sonic(config pbr map)# exit sonic(config)# interface ethernet 0/72 sonic(config if 0/72)# pbr policy test sonic(config if 0/72)# exit verify the configuration \#check pbr configuration sonic# show pbr interface ethernet 0/72(106) with pbr policy test leaf 129# show pbr nexthop groups nexthop group test2 table 10001 valid 0 installed 0 valid 0 nexthop 74 0 0 2 nexthop group test1 table 10000 valid 0 installed 0 valid 0 nexthop 73 0 0 2 leaf 129# show pbr map pbr map test valid no seq 1 rule 300 installed no reason invalid nh src match 1 0 0 0/24 nexthop 73 0 0 2 installed no tableid 10000 seq 2 rule 301 installed no reason invalid nh src match 2 0 0 0/24 nexthop 74 0 0 2 installed no tableid 10001 tc2 is configured with host1 ip 73 0 0 2, gateway ip 73 0 0 1 tc3 is configured with host2 ip 74 0 0 2, gateway ip 74 0 0 1 tc1 sends two streams with source ips 1 0 0 1 and 2 0 0 1, tc2 can capture the stream with source ip 1 0 0 1, and tc3 can capture the stream with source ip 2 0 0 1
