A carrier needs to redirect traffic to different egresses using policy-based routing. For example, some traffic is redirected to the provincial egress, and other traffic is redirected to the Internet egress. Common requirements: Traffic destined for China Telecom needs to go out from the egress of China Telecom, and traffic destined for China Netcom needs to go out from the egress of China Netcom. When defining routing policies, it is complex to use ACLs to define traffic characteristics. A simpler way is required to distinguish traffic.
1. Configure routing policies for routes from some BGP peers. Redefine the next hop of routes matching some AS numbers. Assume that routes with AS200 are routes to China Telecom. The NE40E&NE80E needs to send traffic destined for China Telecom to the next hop 22.214.171.124.
The configuration is as follows:
peer 126.96.36.199 route-policy ceshi import //A routing policy is applied to routes from a specified BGP peer.
ip as-path-filter 1 permit _200_
route-policy ceshi permit node 10
if-match as-path-filter 1
apply ip-address next-hop 188.8.131.52
route-policy ceshi permit node 20
2. In this configuration, it is difficult to collect all AS numbers of China Telecom and China Netcom, and the regular expression must be used to describe characteristics of the AS number list. For example, _200_ indicates the AS number list containing 200.
For details about the regular expression, see the attachment.