How Can I Modify the Preference of a BGP Route Learned by the Router?
Perform the following operations on the receive end of the BGP route. The NE40E is used as an example:
bgp 100
peer 172.10.10.2 as-number 100
#
ipv4-family unicast
undo synchronization
preference route-policy 2 //Reference a route priority policy.
peer 172.10.10.2 enable
peer 172.10.10.2 route-policy 1 import //Community attribute (5000:200).
#
route-policy 1 permit node 1
apply community 5000:200
#
ip community-filter basic antiddos permit 5000:200 //Define the community attribute filtering policy.
#
route-policy 2 permit node 1
if-match community-filter antiddos //Match the community attribute.
apply preference 4 //Re-specify the route priority.
You can run the display bgp routing-table community command to view the community attributes that are used.