底层做EIGRP,将各自的环回地址宣告进BGP
控制选路:
1.AS1>AS2走R2
用Local_pref:在R2上抓取AS2的流量,增大Local_pref值,in方向
2.AS2>AS1走R3
用MED:在R4上抓取AS1的流量,增大MED值,in方向
3.AS1>AS3走R6
用weight:在R2上抓取AS3的流量,增大weight值,在R2与R6建邻时调用,in方向
4.AS2>AS3走R5
用next-hop:在R4上抓取AS3的流量,定义下一跳地址为R4->R5的下一跳地址,在R4与R5建邻时调用,in/out方向都可以
5.AS3>AS2走R6
用AS-path:在R5上抓取AS2的流量,增加AS-path的长度,在R4-R6建邻时调用,in/out方向都可以
6.AS3>AS1走R5
用Origin:在R6上抓取AS1的流量,定义origin为?,在R2-R6建邻时调用,in/out方向都可以
**抓取AS2流量**
R2(config)#ip prefix-list 1 permit 10.3.3.3/32
R2(config)#ip prefix-list 1 permit 10.4.4.4/32
**修改local_pref**
R2(config)#route-map 1 permit 10
R2(config-route-map)#match ip address prefix-list 1
R2(config-route-map)#set local-preference 120
R2(config-route-map)#exit
R2(config)#route-map 1 permit 20
R2(config-route-map)#exit
**调用route-map**
R2(config)#router bgp 1
R2(config-router)#neighbor 10.1.24.2 route-map 1 in
**抓取AS1流量**
R4(config)#ip prefix-list 2 permit 10.1.1.1/32
R4(config)#ip prefix-list 2 permit 10.2.2.2/32
**修改MED值**
R4(config)#route-map 2 permit 10
R4(config-route-map)#match ip address prefix-list 2
R4(config-route-map)#set metric 2
R4(config-route-map)#exit
R4(config)#route-map 2 permit 20
R4(config-route-map)#exit
**调用**
R4(config)#router bgp 2
R4(config-router)#neighbor 10.1.24.1 route-map 2 in
** 抓取AS3流量**
R2(config)#ip prefix-list 3 permit 10.5.5.5/32
R2(config)#ip prefix-list 3 permit 10.6.6.6/32
R2(config)#ip prefix-list 3 permit 10.7.7.7/32
**设置weight值**
R2(config)#route-map 3 permit 10
R2(config-route-map)#match ip address prefix-list 3
R2(config-route-map)#set weight 2
R2(config-route-map)#exit
R2(config)#route-map 3 permit 20
R2(config-route-map)#exit
**调用**
R2(config)#router bgp 1
R2(config-router)#neighbor 10.1.26.2 route-map 3 in
**抓取流量**
R4(config)#ip prefix-list 4 permit 10.5.5.5/32
R4(config)#ip prefix-list 4 permit 10.6.6.6/32
R4(config)#ip prefix-list 4 permit 10.7.7.7/32
**定义下一跳地址**
R4(config)#route-map 4 permit 10
R4(config-route-map)#match ip address prefix-list 4
R4(config-route-map)#set ip next-hop 10.1.45.2
R4(config-route-map)#exit
R4(config)#route-map 4 permit 20
R4(config-route-map)#exit
**调用**
R4(config)#router bgp 2
R4(config-router)#neighbor 10.1.46.2 route-map 4 in
**抓取AS2流量**
R5(config)#ip prefix-list 5 permit 10.3.3.3/32
R5(config)#ip prefix-list 5 permit 10.4.4.4/32
**加长AS-path**
R5(config)#route-map 5 permit 10
R5(config-route-map)#match ip address prefix-list 5
R5(config-route-map)#set as-path prepend 2 2 2
R5(config-route-map)#exit
R5(config)#route-map 5 permit 20
R5(config-route-map)#exit
**调用**
R5(config)#router bgp 3
R5(config-router)#neighbor 10.1.45.1 route-map 5 in
**抓取AS1流量**
R6(config)#ip prefix-list 6 permit 10.1.1.1/32
R6(config)#ip prefix-list 6 permit 10.2.2.2/32
**修改origin**
R6(config)#route-map 6 permit 10
R6(config-route-map)#match ip address prefix-list 6
R6(config-route-map)#set origin incomplete
R6(config-route-map)#exit
R6(config)#route-map 6 permit 20
R6(config-route-map)#exit
**调用**
R6(config)#router bgp 3
R6(config-router)#neighbor 10.1.26.1 route-map 6 in