MPLS VPN - Route Target Rewrite feature
假設VRFA(R1,R2)只接受來自於VRB的路由prefix為100:200,VRFB(R3,R4)只接受來自於VRA的路由prefix為200:100,現有的路由community,VRFB to VRFA有123:123,234:234,VRFA to VRFB有987:987,876:876,要求由R3上面進行設置:
R1(config)#ip vrf VRFA
R1(config-vrf)#route-target import 100:200
R2(config)#ip vrf VRFA
R2(config-vrf)#route-target import 100:200
R3(config)#ip vrf VRFB
R3(config-vrf)#route-target import 200:100
R4(config)#ip vrf VRFB
R4(config-vrf)#route-target import 200:100
R3(config)#ip extcommunity-list 1 permit rt 123:123
R3(config)#ip extcommunity-list 2 permit rt 234:234
R3(config)#ip extcommunity-list 3 permit rt 987:987
R3(config)#ip extcommunity-list 4 permit rt 876:876
R3(config)#route-map VRFB2VRFA permit 10
R3(config-route-map)#match extcommunity 1
R3(config-route-map)#set extcomm-list 1 delete
R3(config-route-map)#set extcommunity rt 100:200
R3(config)#route-map VRFB2VRFA permit 20
R3(config-route-map)#match extcommunity 2
R3(config-route-map)#set extcomm-list 2 delete
R3(config-route-map)#set extcommunity rt 100:200
R3(config)#route-map VRFB2VRFA permit 30
R3(config)#route-map VRFA2VRFB permit 10
R3(config-route-map)#match extcommunity 3
R3(config-route-map)#set extcomm-list 3 delete
R3(config-route-map)#set extcommunity rt 200:100
R3(config)#route-map VRFA2VRFB permit 20
R3(config-route-map)#match extcommunity 4
R3(config-route-map)#set extcomm-list 4 delete
R3(config-route-map)#set extcommunity rt 200:100
R3(config)#route-map VRFA2VRFB permit 30
R3(config)#router bgp 100
R3(config-router)#address-family vpnv4
R3(config-router-af)#neighbor 1.1.1.1 route-map VRFB2VRFA out
R3(config-router-af)#neighbor 2.2.2.2 route-map VRFB2VRFA out
R3(config-router-af)#neighbor 4.4.4.4 route-map VRFA2VRFB out
Comments