实验二十七.BGP路由策略与选路控制
一. 实验拓扑图
二.
组网需求
三. 实验配置
组网一:BGP路由策略与选路控制(一)
1、BGP配置及调测: R1:
r1(config)#router bgp 65000
r1(config-router)#bgp router-id 10.0.0.1 r1(config-router)#no synchronization r1(config-router)#no auto-summary
r1(config-router)#neighbor 10.0.0.3 remote-as 65000 r1(config-router)#neighbor 10.0.0.3 update-source lo0 r1(config-router)#neighbor 10.0.0.3 next-hop-self r1(config-router)#neighbor 10.0.0.4 remote-as 65000 r1(config-router)#neighbor 10.0.0.4 update-source lo0 r1(config-router)#neighbor 10.0.0.4 next-hop-self r1(config-router)#neighbor 10.0.15.2 remote-as 65001
R2:
r2(config)#router bgp 65000
r2(config-router)#bgp router-id 10.0.0.2 r2(config-router)#no synchronization r2(config-router)#no auto-summary
r2(config-router)#neighbor 10.0.0.3 remote-as 65000 r2(config-router)#neighbor 10.0.0.3 update-source lo0 r2(config-router)#neighbor 10.0.0.3 next-hop-self r2(config-router)#neighbor 10.0.0.4 remote-as 65000 r2(config-router)#neighbor 10.0.0.4 next-hop-self r2(config-router)#neighbor 10.0.0.4 update-source lo0 r2(config-router)#neighbor 10.0.26.2 remote-as 65001
R3:
r3(config)#router bgp 65000
r3(config-router)#bgp router-id 10.0.0.3 r3(config-router)#bgp cluster-id 10.0.0.3
r3(config-router)#neighbor as65000-rrc peer-group r3(config-router)#neighbor as65000-rrc remote-as 65000 r3(config-router)#neighbor as65000-rrc next-hop-self
r3(config-router)#neighbor as65000-rrc update-source lo0 r3(config-router)#neighbor as65000-rrc route-reflector-client r3(config-router)#neighbor 10.0.0.2 peer-group as65000-rrc r3(config-router)#neighbor 10.0.0.1 peer-group as65000-rrc r3(config-router)#neighbor 10.0.0.4 remote-as 65000
r3(config-router)#neighbor 10.0.0.4 next-hop-self r3(config-router)#neighbor 10.0.0.4 update-source lo0 r3(config-router)#network 10.0.0.0 mask 255.255.0.0 r3(config-router)#network 10.2.0.0 mask 255.255.0.0 r3(config-router)#network 10.3.0.0 mask 255.255.0.0 r3(config-router)#network 10.4.0.0 mask 255.255.0.0 r3(config-router)#exit
r3(config)#ip route 10.0.0.0 255.255.0.0 null0 r3(config)#ip route 10.2.0.0 255.255.0.0 null0 r3(config)#ip route 10.3.0.0 255.255.0.0 null0 r3(config)#ip route 10.4.0.0 255.255.0.0 null0
R4:
r4(config)#router bgp 65000
r4(config-router)#bgp router-id 10.0.0.4
r4(config-router)#neighbor as65000-rrc peer-group r4(config-router)#neighbor as65000-rrc remote-as 65000 r4(config-router)#neighbor as65000-rrc next-hop-self r4(config-router)#neighbor as65000-rrc update-source lo0 r4(config-router)#neighbor as65000-rrc route-reflector-client r4(config-router)#neighbor 10.0.0.1 peer-group as65000-rrc r4(config-router)#neighbor 10.0.0.2 peer-group as65000-rrc r4(config-router)#neighbor 10.0.0.3 remote-as 65000 r4(config-router)#neighbor 10.0.0.3 next-hop-self r4(config-router)#neighbor 10.0.0.3 update-source lo0 r4(config-router)#network 10.0.0.0 mask 255.255.0.0 r4(config-router)#network 10.2.0.0 mask 255.255.0.0 r4(config-router)#network 10.3.0.0 mask 255.255.0.0 r4(config-router)#network 10.4.0.0 mask 255.255.0.0 r4(config-router)#exit
r4(config)#ip route 10.0.0.0 255.255.0.0 null0 r4(config)#ip route 10.2.0.0 255.255.0.0 null0 r4(config)#ip route 10.3.0.0 255.255.0.0 null0 r4(config)#ip route 10.4.0.0 255.255.0.0 null0
R5:
r5(config)#router bgp 65001
r5(config-router)#bgp router-id 10.5.0.1
r5(config-router)#neighbor 10.0.15.1 remote-as 65000 r5(config-router)#neighbor 10.6.0.1 remote-as 65001 r5(config-router)#neighbor 10.6.0.1 next-hop-self r5(config-router)#neighbor 10.6.0.1 update-source lo0
R6:
r6(config)#router bgp 65001
r6(config-router)#bgp router-id 10.6.0.1
r6(config-router)#neighbor 10.0.26.1 remote-as 65000 r6(config-router)#neighbor 10.5.0.1 remote-as 65001 r6(config-router)#neighbor 10.5.0.1 next-hop-self r6(config-router)#neighbor 10.5.0.1 update-source lo0
查看BGP表: r5#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.6.0.1 0 100 0 65000 i *> 10.0.15.1 0 65000 i * i10.2.0.0/16 10.6.0.1 0 100 0 65000 i *> 10.0.15.1 0 65000 i * i10.3.0.0/16 10.6.0.1 0 100 0 65000 i *> 10.0.15.1 0 65000 i * i10.4.0.0/16 10.6.0.1 0 100 0 65000 i *> 10.0.15.1 0 65000 i *> 10.5.0.0/16 0.0.0.0 0 32768 i *>i10.6.0.0/16 10.6.0.1 0 100 0 i //EBGP路由比IBGP路由更优先,所以其为最佳有效路由。
r6#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.5.0.1 0 100 0 65000 i *> 10.0.26.1 0 65000 i *> 10.2.0.0/16 10.0.26.1 0 65000 i * i 10.5.0.1 0 100 0 65000 i *> 10.3.0.0/16 10.0.26.1 0 65000 i * i 10.5.0.1 0 100 0 65000 i *> 10.4.0.0/16 10.0.26.1 0 65000 i * i 10.5.0.1 0 100 0 65000 i *>i10.5.0.0/16 10.5.0.1 0 100 0 i *> 10.6.0.0/16 0.0.0.0 0 32768 i
r3#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *> 0.0.0.0 0 32768 i *>i10.2.0.0/16 10.0.0.4 0 100 0 i *> 10.3.0.0/16 0.0.0.0 0 32768 i *>i10.4.0.0/16 10.0.0.4 0 100 0 i
* i10.5.0.0/16 10.0.0.2 0 100 0 65001 i
*>i 10.0.0.1 0 100 0 65001 i * i10.6.0.0/16 10.0.0.2 0 100 0 65001 i *>i 10.0.0.1 0 100 0 65001 i
//选择下一跳IGP开销最小的。
r3#show ip route
O 10.0.0.2/32 [110/201] via 10.0.1.6, 00:01:26, Serial0/0
[110/201] via 10.0.1.2, 00:01:26, FastEthernet1/0 O 10.0.0.1/32 [110/101] via 10.0.1.6, 00:01:27, Serial0/0
R4同R3
r1#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.2.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i * i10.3.0.0/16 10.0.0.3 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.4.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i * i10.5.0.0/16 10.0.0.2 0 100 0 65001 i *> 10.0.15.2 0 0 65001 i *> 10.6.0.0/16 10.0.15.2 0 65001 i * i 10.0.0.2 0 100 0 65001 i //EBGP路由比IBGP路由更优先,所以其为最佳有效路由。 R2同R1
2、BGP路由策略部署(方案一:Local_Preference) R1:
r1(config)#ip prefix-list p5 seq 5 permit 10.5.0.0/16 //用前缀列表定义感兴趣流量 r1(config)#ip prefix-list p6 seq 5 permit 10.6.0.0/16 r1(config)#route-map as65000-in permit 10 //启用策略路由,命名为as65000-in r1(config-route-map)#match ip address prefix-list p5 //匹配前缀列表p5的流量 r1(config-route-map)#set local-preference 300 //设置匹配流量的本地优先级为300 r1(config-route-map)#exit
r1(config)#route-map as65000-in permit 20
r1(config-route-map)#match ip address prefix-list p6
r1(config-route-map)#set local-preference 200 r1(config-route-map)#exit
r1(config)#route-map as65000-in permit 30
r1(config-route-map)#exit r1(config)#router bgp 65000
r1(config-router)#neighbor 10.0.15.2 route-map as65001-in in //将策略路由应用到BGP邻居上
R2:
r2(config)#ip prefix-list p5 seq 5 permit 10.5.0.0/16 r2(config)#ip prefix-list p6 seq 6 permit 10.6.0.0/16 r2(config)#route-map as65001-in permit 10
r2(config-route-map)#match ip address prefix-list p5 r2(config-route-map)#set local-preference 200 r2(config-route-map)#exit
r2(config)#route-map as65001-in permit 20
r2(config-route-map)#match ip address prefix-list p6 r2(config-route-map)#set local-preference 300 r2(config-route-map)#exit
r2(config)#route-map as65001-in permit 30 r2(config-route-map)#exit r2(config)#router bgp 65000
r2(config-router)#neighbor 10.0.26.2 route-map as65001-in in
R5:
r5(config)#ip prefix-list p3 seq 5 permit 10.3.0.0/16 r5(config)#ip prefix-list p4 seq 5 permit 10.4.0.0/16 r5(config)#ip prefix-list p4 seq 10 permit 10.2.0.0/16 r5(config)#route-map as65000-in permit 10
r5(config-route-map)#match ip address prefix-list p3 r5(config-route-map)#set local-preference 300 r5(config-route-map)#exit
r5(config)#route-map as65000-in permit 20
r5(config-route-map)#match ip address prefix-list p4 r5(config-route-map)#set local-preference 200 r5(config-route-map)#exit
r5(config)#route-map as65000-in permit 30 r5(config-route-map)#exit r5(config)#router bgp 65001
r5(config-router)#neighbor 10.0.15.1 route-map as65000-in in
R6:
r6(config)#ip prefix-list p3 seq 5 permit 10.3.0.0/16 r6(config)#ip prefix-list p4 seq 5 permit 10.4.0.0/16 r6(config)#ip prefix-list p4 seq 10 permit 10.2.0.0/16 r6(config)#route-map as65000-in permit 10
r6(config-route-map)#match ip address prefix-list p3
r6(config-route-map)#set local-preference 200 r6(config-route-map)#exit
r6(config)#route-map as65000-in permit 20
r6(config-route-map)#match ip address prefix-list p4 r6(config-route-map)#set local-preference 300 r6(config-route-map)#exit
r6(config)#route-map as65000-in permit 30 r6(config-route-map)#exit r6(config)#router bgp 65001
r6(config-router)#neighbor 10.0.26.1 route-map as65000-in in
查看BGP表: r5#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.6.0.1 0 100 0 65000 i *> 10.0.15.1 0 65000 i *>i10.2.0.0/16 10.6.0.1 0 300 0 65000 i * 10.0.15.1 200 0 65000 i *> 10.3.0.0/16 10.0.15.1 300 0 65000 i *>i10.4.0.0/16 10.6.0.1 0 300 0 65000 i * 10.0.15.1 200 0 65000 i *> 10.5.0.0/16 0.0.0.0 0 32768 i *>i10.6.0.0/16 10.6.0.1 0 100 0 i //选择了 local-preference值最大的路由。
//因为BGP路由器只将最佳路由转发给其邻居,因此10.3.0.0/16网段只有一条。
r1#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.2.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i * i10.3.0.0/16 10.0.0.3 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.4.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i
*> 10.5.0.0/16 10.0.15.2 0 300 0 65001 i * 10.6.0.0/16 10.0.15.2 0 200 0 65001 i *>i 10.0.0.2 0 300 0 65001 i * i 10.0.0.2 0 300 0 65001 i
//R6通告10.6.0.0/16网段给R2,再经过R3、R4反射给R1,R1直接从R5收到一条,一共三条。 //10.5.0.0/16网段,因为R3、R4收到的最佳的为R1传给它们的,所以不再发给R1,因此只有一条。
r3#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *> 0.0.0.0 0 32768 i *>i10.2.0.0/16 10.0.0.4 0 100 0 i *> 10.3.0.0/16 0.0.0.0 0 32768 i *>i10.4.0.0/16 10.0.0.4 0 100 0 i
*>i10.5.0.0/16 10.0.0.1 0 300 0 65001 i *>i10.6.0.0/16 10.0.0.2 0 300 0 65001 i
//因为在R1上10.6.0.0/16网段的最佳有效路由是R3反射给它的,因此它不再发给R3。 r3#traceroute 10.6.6.1 1 10.0.1.2 92 msec 10.0.1.6 60 msec 10.0.1.2 68 msec 2 10.0.1.14 84 msec 10.0.1.10 100 msec 10.0.1.14 52 msec
3 10.0.26.2 104 msec * 152 msec
//10.5..0.0/16略,测试表明达到了选路需求。
3、BGP路由策略部署(方案二:MED) R1:
r1(config)#router bgp 65000
r1(config-router)#no neighbor 10.0.15.2 route-map as65001-in in r1(config-router)#exit
r1(config)#ip prefix-list p3 seq 5 permit 10.3.0.0/16 //用前缀列表定义感兴趣流量 r1(config)#ip prefix-list p4 seq 5 permit 10.4.0.0/16 r1(config)#ip prefix-list p4 seq 10 permit 10.2.0.0/16 r1(config)#route-map as65000-out permit 10
r1(config-route-map)#match ip address prefix-list p3 //匹配前缀列表p3 r1(config-route-map)#set metric 1000 //将MED设置为1000 r1(config-route-map)#exit
r1(config)#route-map as65000-out permit 20
r1(config-route-map)#match ip address prefix-list p4 r1(config-route-map)#set metric 2000 r1(config-route-map)#exit
r1(config)#route-map as65000-out permit 30 r1(config-route-map)#exit r1(config)#router bgp 65000
r1(config-router)#neighbor 10.0.15.2 route-map as65000-out out//将策略路由应用到BGP邻居上。
R2:
r2(config)#router bgp 65000
r2(config-router)#no neighbor 10.0.26.2 route-map as65001-in in r2(config-router)#exit
r2(config)#ip prefix-list p3 seq 5 permit 10.3.0.0/16 r2(config)#ip prefix-list p4 seq 5 permit 10.4.0.0/16 r2(config)#ip prefix-list p4 seq 10 permit 10.2.0.0/16 r2(config)#route-map as6500-out permit 10
r2(config-route-map)#match ip address prefix-list p3 r2(config-route-map)#set metric 2000 r2(config-route-map)#exit
r2(config)#route-map as65000-out permit 20
r2(config-route-map)#match ip address prefix-list p4 r2(config-route-map)#set metric 1000 r2(config-route-map)#exit
r2(config)#route-map as65000-out permit 30 r2(config-route-map)#exit r2(config)#router bgp 65000
r2(config-router)#neighbor 10.0.26.2 route-map as65000-out out
R5:
r5(config)#router bgp 65001
r5(config-router)#no neighbor 10.0.15.1 route-map as65000-in in r5(config-router)#exit
r5(config)#ip prefix-list p5 seq 5 permit 10.5.0.0/16 r5(config)#ip prefix-list p6 seq 5 permit 10.6.0.0/16 r5(config)#route-map as65001-out permit 10
r5(config-route-map)#match ip address prefix-list p5 r5(config-route-map)#set metric 1000 r5(config-route-map)#exit
r5(config)#route-map as65001-out permit 20
r5(config-route-map)#match ip address prefix-list p6 r5(config-route-map)#set metric 2000 r5(config-route-map)#exit
r5(config)#route-map as65001-out permit 30 r5(config-route-map)#exit r5(config)#router bgp 65001
r5(config-router)#neighbor 10.0.15.1 route-map as65001-out out
R6:
r6(config)#router bgp 65001
r6(config-router)#no neighbor 10.0.26.1 route-map as65000-in in r6(config-router)#exit
r6(config)#ip prefix-list p5 seq 5 permit 10.5.0.0/16 r6(config)#ip prefix-list p6 seq 5 permit 10.6.0.0/16 r6(config)#route-map as65001-out permit 10
r6(config-route-map)#match ip address prefix-list p5 r6(config-route-map)#set metric 2000 r6(config-route-map)#exit
r6(config)#route-map as65001-out permit 20
r6(config-route-map)#match ip address prefix-list p6 r6(config-route-map)#set metric 1000 r6(config-route-map)#exit
r6(config)#route-map as65001-out permit 30 r6(config-route-map)#exit r6(config)#router bgp 65001
r6(config-router)#neighbor 10.0.26.1 route-map as65001-out out r6(config-router)#exit 查看BGP表:
r1#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.2.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i * i10.3.0.0/16 10.0.0.3 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.4.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i
*> 10.5.0.0/16 10.0.15.2 1000 0 65001 i * 10.6.0.0/16 10.0.15.2 2000 0 65001 i *>i 10.0.0.2 1000 100 0 65001 i * i 10.0.0.2 1000 100 0 65001 i
//10.6.0.0/16网段,R6传给R2,然后再分别通过R3、R4反射给R1,R1从R5直接收到一条,一共三条。
//10.5.0.0/16网段,因为R3、R4收到的最佳的为R1传给它们的,所以不再发给R1,因此只有一条。
//优选MED值小的路由。 r3#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *> 0.0.0.0 0 32768 i *>i10.2.0.0/16 10.0.0.4 0 100 0 i *> 10.3.0.0/16 0.0.0.0 0 32768 i *>i10.4.0.0/16 10.0.0.4 0 100 0 i
*>i10.5.0.0/16 10.0.0.1 1000 100 0 65001 i *>i10.6.0.0/16 10.0.0.2 1000 100 0 65001 i
//因为在R1上10.6.0.0/16网段的最佳有效路由是R3反射给它的,因此它不再发给R3。 r5#show ip bgp
Network Next Hop Metric LocPrf Weight Path *> 10.3.0.0/16 10.0.15.1 1000 0 65000 i *>i10.4.0.0/16 10.6.0.1 1000 100 0 65000 i * 10.0.15.1 2000 0 65000 i
//因为BGP路由器只将最佳路由转发给其邻居,因此10.3.0.0/16网段只有一条。 r3#traceroute 10.6.6.1 1 10.0.1.6 44 msec 10.0.1.2 44 msec 10.0.1.6 60 msec 2 10.0.1.10 84 msec 10.0.1.14 52 msec 10.0.1.10 56 msec
3 10.0.26.2 136 msec * 120 msec 经traceroute测试,达到了选路要求。
4、BGP路由策略部署(方案三:Local_Preference+MED) R1:
r1(config)#router bgp 65000
r1(config-router)#neighbor 10.0.15.2 route-map as65000-out out r1(config-router)#neighbor 10.0.15.2 route-map as65000-in in
R2:
r2(config)#router bgp 65000
r2(config-router)#neighbor 10.0.26.2 route-map as65001-in in r2(config-router)#neighbor 10.0.26.2 route-map as65000-out out
R5:
r5(config)#router bgp 65001
r5(config-router)#no neighbor 10.0.15.1 route-map as65001-out out
R6:
r6(config)#router bgp 65001
r6(config-router)#no neighbor 10.0.26.1 route-map as65001-out out
r1#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *>i 10.0.0.3 0 100 0 i
*>i10.2.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i * i10.3.0.0/16 10.0.0.3 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.4.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i
*> 10.5.0.0/16 10.0.15.2 0 300 0 65001 i *>i10.6.0.0/16 10.0.0.2 0 300 0 65001 i * i 10.0.0.2 0 300 0 65001 i *
r2#show ip bgp
Network *>i10.0.0.0/16 * i *>i10.2.0.0/16 * i * i10.3.0.0/16 *>i *>i10.4.0.0/16 * i * i10.5.0.0/16 *>i * *> 10.6.0.0/16
r3#show ip bgp
Network * i10.0.0.0/16 *> *>i10.2.0.0/16 *> 10.3.0.0/16 *>i10.4.0.0/16 *>i10.5.0.0/16 *>i10.6.0.0/16
r4#show ip bgp
Network *> 10.0.0.0/16 * i *> 10.2.0.0/16 *>i10.3.0.0/16 *> 10.4.0.0/16
10.0.15.2 Next Hop 10.0.0.4 10.0.0.3 10.0.0.4 10.0.0.4 10.0.0.3 10.0.0.3 10.0.0.4 10.0.0.4 10.0.0.1 10.0.0.1 10.0.26.2 10.0.26.2 Next Hop 10.0.0.4 0.0.0.0 10.0.0.4 0.0.0.0 10.0.0.4 10.0.0.1 10.0.0.2 Next Hop 0.0.0.0 10.0.0.3 0.0.0.0 10.0.0.3 0.0.0.0 0 200 0 65001 i Metric LocPrf Weight Path 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 300 0 65001 i 0 300 0 65001 i 200 0 65001 i 0 300 0 65001 i Metric LocPrf Weight Path 0 100 0 i 0 32768 i 0 100 0 i 0 32768 i 0 100 0 i
0 300 0 65001 i 0 300 0 65001 i Metric LocPrf Weight Path 0 32768 i 0 100 0 i 0 32768 i 0 100 0 i 0 32768 i
*>i10.5.0.0/16 10.0.0.1 0 300 0 65001 i *>i10.6.0.0/16 10.0.0.2 0 300 0 65001 i
r5#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.6.0.1 0 100 0 65000 i *> 10.0.15.1 0 65000 i *>i10.2.0.0/16 10.6.0.1 1000 100 0 65000 i * 10.0.15.1 2000 0 65000 i *> 10.3.0.0/16 10.0.15.1 1000 0 65000 i *>i10.4.0.0/16 10.6.0.1 1000 100 0 65000 i * 10.0.15.1 2000 0 65000 i *> 10.5.0.0/16 0.0.0.0 0 32768 i *> 10.6.0.0/16 0.0.0.0 0 32768 i * i 10.6.0.1 0 100 0 i
r6#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.5.0.1 0 100 0 65000 i *> 10.0.26.1 0 65000 i *> 10.2.0.0/16 10.0.26.1 1000 0 65000 i *>i10.3.0.0/16 10.5.0.1 1000 100 0 65000 i * 10.0.26.1 2000 0 65000 i *> 10.4.0.0/16 10.0.26.1 1000 0 65000 i *>i10.5.0.0/16 10.5.0.1 0 100 0 i * i10.6.0.0/16 10.5.0.1 0 100 0 i *> 0.0.0.0 0 32768 i
5、BGP缺省路由发布
r1(config)#router bgp 65000
r1(config-router)#neighbor 10.0.15.2 default-originate //向BGP邻居发布缺省路由
r5#show ip bgp
Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0 10.0.15.1 0 0 65000 i
r5#show ip route
B* 0.0.0.0/0 [20/0] via 10.0.15.1, 00:00:30
r1(config)#router bgp 65000
r1(config-router)#no neighbor 10.0.15.2 default-originate
r3(config)#int e3/1
r3(config-if)#ip add 172.1.1.2 255.255.255.252 r3(config-if)#no shut
r3(config)#ip route 0.0.0.0 0.0.0.0 172.1.1.1 r3(config)#router bgp 65000
r3(config-router)#network 0.0.0.0 //将缺省路由发布到全网中 r1#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i0.0.0.0 10.0.0.3 0 100 0 i
r2#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i0.0.0.0 10.0.0.3 0 100 0 i
r3#show ip bgp
Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0 172.1.1.1 0 32768 i
r5#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i0.0.0.0 10.6.0.1 0 100 0 65000 i *> 10.0.15.1 0 65000 i
r6#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.5.0.1 0 100 0 65000 i *> 10.0.26.1 0 65000 i
组网二:BGP路由策略与选路控制(二)
1、BGP配置及调测:
查看BGP表: r1#show ip bgp
Network Next Hop Metric LocPrf Weight Path * i10.0.0.0/16 10.0.0.4 0 100 0 i *>i 10.0.0.3 0 100 0 i *>i10.2.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i * i10.3.0.0/16 10.0.0.3 0 100 0 i *>i 10.0.0.3 0 100 0 i
*>i10.4.0.0/16 10.0.0.4 0 100 0 i * i 10.0.0.4 0 100 0 i
*> 10.5.0.0/16 10.0.15.2 0 0 65001 i * i10.6.0.0/16 10.0.0.2 0 100 0 65002 i *>i 10.0.0.2 0 100 0 65002 i
* 10.0.15.2 0 65001 65002 i
r2#show ip bgp
Network Next Hop Metric LocPrf Weight Path *>i10.0.0.0/16 * i *>i10.2.0.0/16 * i * i10.3.0.0/16 *>i *>i10.4.0.0/16 * i *>i10.5.0.0/16 * i * *> 10.6.0.0/16
r3#show ip bgp
Network * i10.0.0.0/16 *> *>i10.2.0.0/16 *> 10.3.0.0/16 *>i10.4.0.0/16 *>i10.5.0.0/16 *>i10.6.0.0/16
r4#show ip bgp
Network *> 10.0.0.0/16 * i *> 10.2.0.0/16 *>i10.3.0.0/16 *> 10.4.0.0/16 *>i10.5.0.0/16 *>i10.6.0.0/16
r5#show ip bgp
Network
10.0.0.4 10.0.0.3 10.0.0.4 10.0.0.4 10.0.0.3 10.0.0.3 10.0.0.4 10.0.0.4 10.0.0.1 10.0.0.1 10.0.26.2 10.0.26.2 Next Hop 10.0.0.4 0.0.0.0 10.0.0.4 0.0.0.0 10.0.0.4 10.0.0.1 10.0.0.2 Next Hop 0.0.0.0 10.0.0.3 0.0.0.0 10.0.0.3 0.0.0.0 10.0.0.1 10.0.0.2 Next Hop 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i 0 100 0 i
0 100 0 65001 i 0 100 0 65001 i
0 65002 65001 i 0 0 65002 i Metric LocPrf Weight Path 0 100 0 i 0 32768 i 0 100 0 i 0 32768 i 0 100 0 i
0 100 0 65001 i 0 100 0 65002 i Metric LocPrf Weight Path 0 32768 i 0 100 0 i 0 32768 i 0 100 0 i 0 32768 i
0 100 0 65001 i 0 100 0 65002 i Metric LocPrf Weight Path
* 10.0.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 0 65000 i * 10.2.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 0 65000 i * 10.3.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 0 65000 i * 10.4.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 0 65000 i *> 10.5.0.0/16 0.0.0.0 0 32768 i
* 10.6.0.0/16 10.0.15.1 0 65000 65002 i *> 10.5.1.2 0 0 65002 i
r6#show ip bgp
Network Next Hop Metric LocPrf Weight Path *> 10.0.0.0/16 10.0.26.1 0 65000 i
* 10.5.1.1 0 65001 65000 i *> 10.2.0.0/16 10.0.26.1 0 65000 i
* 10.5.1.1 0 65001 65000 i *> 10.3.0.0/16 10.0.26.1 0 65000 i
* 10.5.1.1 0 65001 65000 i *> 10.4.0.0/16 10.0.26.1 0 65000 i
* 10.5.1.1 0 65001 65000 i * 10.5.0.0/16 10.0.26.1 0 65000 65001 i *> 10.5.1.1 0 0 65001 i *> 10.6.0.0/16 0.0.0.0 0 32768 i
2、BGP路由策略部署(Local_Preference): R5:
r5(config)#route-map set-LP-300 permit 10
r5(config-route-map)#set local-preference 300 //将本地优先级设置为300 r5(config-route-map)#exit r5(config)#router bgp 65001
r5(config-router)#neighbor 10.0.15.1 route-map set-LP-300 in
R6:
r6(config)#route-map set-LP-300 permit 10 r6(config-route-map)#set local-preference 300 r6(config-route-map)#exit r6(config)#router bgp 65002
r6(config-router)#neighbor 10.0.26.1 route-map set-LP-300 in 查看BGP表:
r5#show ip bgp
Network Next Hop Metric LocPrf Weight Path
* 10.0.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 300 0 65000 i * 10.2.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 300 0 65000 i * 10.3.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 300 0 65000 i * 10.4.0.0/16 10.5.1.2 0 65002 65000 i *> 10.0.15.1 300 0 65000 i *> 10.5.0.0/16 0.0.0.0 0 32768 i
*> 10.6.0.0/16 10.0.15.1 300 0 65000 65002 i * 10.5.1.2 0 0 65002 i r6#show ip bgp
Network Next Hop Metric LocPrf Weight Path *> 10.0.0.0/16 10.0.26.1 300 0 65000 i
* 10.5.1.1 0 65001 65000 i *> 10.2.0.0/16 10.0.26.1 300 0 65000 i
* 10.5.1.1 0 65001 65000 i *> 10.3.0.0/16 10.0.26.1 300 0 65000 i
* 10.5.1.1 0 65001 65000 i *> 10.4.0.0/16 10.0.26.1 300 0 65000 i
* 10.5.1.1 0 65001 65000 i *> 10.5.0.0/16 10.0.26.1 300 0 65000 65001 i * 10.5.1.1 0 0 65001 i *> 10.6.0.0/16 0.0.0.0 0 32768 i //AS65001和AS65002到其他自治系统的路由满足要求
四、实验配置: R1:
r1#show run
Building configuration...
Current configuration : 2230 bytes !
version 12.3
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption !
hostname r1 !
boot-start-marker boot-end-marker ! !
no aaa new-model !
resource policy !
memory-size iomem 5 ip subnet-zero ! ! ip cef
no ip dhcp use vrf connected ! !
no ip domain lookup
no ftp-server write-enable ! ! ! !
interface Loopback0
ip address 10.0.0.1 255.255.255.255 !
interface Serial0/0
ip address 10.0.1.6 255.255.255.252 ip ospf network point-to-point ip ospf cost 100
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/1
ip address 10.0.15.1 255.255.255.252 serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/2 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/3
no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface FastEthernet1/0
ip address 10.0.1.13 255.255.255.252 ip ospf network point-to-point ip ospf cost 100 duplex auto speed auto !
interface Ethernet3/0 no ip address shutdown half-duplex !
interface Ethernet3/1 no ip address shutdown half-duplex !
interface Ethernet3/2 no ip address shutdown half-duplex !
interface Ethernet3/3 no ip address shutdown half-duplex !
router ospf 10
log-adjacency-changes
redistribute connected metric 1000 metric-type 1 subnets passive-interface Serial0/1 network 10.0.0.1 0.0.0.0 area 0 network 10.0.1.4 0.0.0.3 area 0 network 10.0.1.12 0.0.0.3 area 0 !
router bgp 65000 no synchronization bgp router-id 10.0.0.1 bgp log-neighbor-changes
neighbor 10.0.0.3 remote-as 65000
neighbor 10.0.0.3 update-source Loopback0 neighbor 10.0.0.3 next-hop-self neighbor 10.0.0.4 remote-as 65000
neighbor 10.0.0.4 update-source Loopback0 neighbor 10.0.0.4 next-hop-self neighbor 10.0.15.2 remote-as 65001 no auto-summary !
ip http server ip classless ! ! ! !
ip prefix-list p3 seq 5 permit 10.3.0.0/16 !
ip prefix-list p4 seq 5 permit 10.4.0.0/16 ip prefix-list p4 seq 10 permit 10.2.0.0/16 !
ip prefix-list p5 seq 5 permit 10.5.0.0/16 !
ip prefix-list p6 seq 5 permit 10.6.0.0/16 ! !
control-plane ! !
line con 0
exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! end
R2:
r2#show run
Building configuration...
Current configuration : 2258 bytes !
version 12.3
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption !
hostname r2 !
boot-start-marker boot-end-marker ! !
no aaa new-model !
resource policy !
memory-size iomem 5 ip subnet-zero ! ! ip cef
no ip dhcp use vrf connected ! !
no ip domain lookup
no ftp-server write-enable ! ! ! !
interface Loopback0
ip address 10.0.0.2 255.255.255.255 !
interface Serial0/0
ip address 10.0.1.10 255.255.255.252 ip ospf network point-to-point ip ospf cost 100
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/1
ip address 10.0.26.1 255.255.255.252 serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/2
no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/3 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface FastEthernet1/0
ip address 10.0.1.14 255.255.255.252 ip ospf network point-to-point ip ospf cost 100 duplex auto speed auto !
interface Ethernet3/0 no ip address shutdown half-duplex !
interface Ethernet3/1 no ip address shutdown half-duplex !
interface Ethernet3/2 no ip address shutdown half-duplex !
interface Ethernet3/3 no ip address shutdown half-duplex !
router ospf 10 router-id 10.0.0.2
log-adjacency-changes
redistribute connected metric 1000 metric-type 1 subnets passive-interface Serial0/1 network 10.0.0.2 0.0.0.0 area 0
network 10.0.1.8 0.0.0.3 area 0 network 10.0.1.12 0.0.0.3 area 0 !
router bgp 65000 no synchronization bgp router-id 10.0.0.2 bgp log-neighbor-changes
neighbor 10.0.0.3 remote-as 65000
neighbor 10.0.0.3 update-source Loopback0 neighbor 10.0.0.3 next-hop-self neighbor 10.0.0.4 remote-as 65000
neighbor 10.0.0.4 update-source Loopback0 neighbor 10.0.0.4 next-hop-self neighbor 10.0.26.2 remote-as 65002 no auto-summary !
ip http server ip classless ! ! ! !
ip prefix-list p3 seq 5 permit 10.3.0.0/16 !
ip prefix-list p4 seq 5 permit 10.4.0.0/16 ip prefix-list p4 seq 10 permit 10.2.0.0/16 !
ip prefix-list p5 seq 5 permit 10.5.0.0/16 !
ip prefix-list p6 seq 5 permit 10.6.0.0/16 ! !
control-plane ! !
line con 0
exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! end
R3:
r3#show run
Building configuration...
Current configuration : 2339 bytes !
version 12.3
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption !
hostname r3 !
boot-start-marker boot-end-marker ! !
no aaa new-model !
resource policy !
memory-size iomem 5 ip subnet-zero ! ! ip cef
no ip dhcp use vrf connected ! !
no ip domain lookup
no ftp-server write-enable ! ! ! !
interface Loopback0
ip address 10.0.0.3 255.255.255.255 !
interface Serial0/0
ip address 10.0.1.5 255.255.255.252 ip ospf network point-to-point ip ospf cost 100
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/1 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/2 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/3 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface FastEthernet1/0
ip address 10.0.1.1 255.255.255.252 ip ospf network point-to-point ip ospf cost 100 duplex auto speed auto !
interface Ethernet3/0
ip address 10.3.3.1 255.255.255.0 half-duplex !
interface Ethernet3/1
ip address 172.1.1.2 255.255.255.252 half-duplex !
interface Ethernet3/2 no ip address shutdown half-duplex !
interface Ethernet3/3 no ip address shutdown
half-duplex !
router ospf 10 router-id 10.0.0.3
log-adjacency-changes
passive-interface Ethernet3/0 network 10.0.0.3 0.0.0.0 area 0 network 10.0.1.0 0.0.0.3 area 0 network 10.0.1.4 0.0.0.3 area 0 network 10.3.3.0 0.0.0.255 area 0 !
router bgp 65000 no synchronization bgp router-id 10.0.0.3 bgp cluster-id 10.0.0.3 bgp log-neighbor-changes network 0.0.0.0
network 10.0.0.0 mask 255.255.0.0 network 10.3.0.0 mask 255.255.0.0 neighbor as65000-rrc peer-group
neighbor as65000-rrc remote-as 65000
neighbor as65000-rrc update-source Loopback0 neighbor as65000-rrc route-reflector-client neighbor as65000-rrc next-hop-self
neighbor 10.0.0.1 peer-group as65000-rrc neighbor 10.0.0.2 peer-group as65000-rrc neighbor 10.0.0.4 remote-as 65000
neighbor 10.0.0.4 update-source Loopback0 neighbor 10.0.0.4 next-hop-self no auto-summary !
ip http server ip classless
ip route 10.0.0.0 255.255.0.0 Null0 ip route 10.3.0.0 255.255.0.0 Null0 ! ! ! ! !
control-plane ! !
line con 0
exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! end
R4:
r4#show run
Building configuration...
Current configuration : 2425 bytes !
version 12.3
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption !
hostname r4 !
boot-start-marker boot-end-marker ! !
no aaa new-model !
resource policy !
memory-size iomem 5 ip subnet-zero ! ! ip cef
no ip dhcp use vrf connected ! !
no ip domain lookup
no ftp-server write-enable ! ! ! !
interface Loopback0
ip address 10.0.0.4 255.255.255.255 !
interface Serial0/0
ip address 10.0.1.9 255.255.255.252 ip ospf network point-to-point ip ospf cost 100
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/1 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/2 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/3 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface FastEthernet1/0
ip address 10.0.1.2 255.255.255.252 ip ospf network point-to-point ip ospf cost 100 duplex auto speed auto !
interface Ethernet3/0
ip address 10.2.2.1 255.255.255.0 half-duplex !
interface Ethernet3/1
ip address 10.4.4.1 255.255.255.0 half-duplex !
interface Ethernet3/2
no ip address shutdown half-duplex !
interface Ethernet3/3 no ip address shutdown half-duplex !
router ospf 10 router-id 10.0.0.4
log-adjacency-changes
passive-interface Ethernet3/0 network 10.0.0.4 0.0.0.0 area 0 network 10.0.1.0 0.0.0.3 area 0 network 10.0.1.8 0.0.0.3 area 0 network 10.2.2.0 0.0.0.255 area 0 network 10.4.4.0 0.0.0.255 area 0 !
router bgp 65000 no synchronization bgp router-id 10.0.0.4 bgp cluster-id 10.0.0.3 bgp log-neighbor-changes
network 10.0.0.0 mask 255.255.0.0 network 10.2.0.0 mask 255.255.0.0 network 10.4.0.0 mask 255.255.0.0 neighbor as65000-rrc peer-group
neighbor as65000-rrc remote-as 65000
neighbor as65000-rrc update-source Loopback0 neighbor as65000-rrc route-reflector-client neighbor as65000-rrc next-hop-self
neighbor 10.0.0.1 peer-group as65000-rrc neighbor 10.0.0.2 peer-group as65000-rrc neighbor 10.0.0.3 remote-as 65000
neighbor 10.0.0.3 update-source Loopback0 neighbor 10.0.0.3 next-hop-self no auto-summary !
ip http server ip classless
ip route 10.0.0.0 255.255.0.0 Null0 ip route 10.2.0.0 255.255.0.0 Null0 ip route 10.4.0.0 255.255.0.0 Null0
! ! ! ! !
control-plane ! !
line con 0
exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! end
R5:
r5#show run
Building configuration...
Current configuration : 2587 bytes !
version 12.3
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption !
hostname r5 !
boot-start-marker boot-end-marker ! !
no aaa new-model !
resource policy !
memory-size iomem 5 ip subnet-zero ! !
ip cef
no ip dhcp use vrf connected ! !
no ip domain lookup
no ftp-server write-enable ! ! ! !
interface Loopback0
ip address 10.5.0.1 255.255.255.255 !
interface Serial0/0
ip address 10.0.15.2 255.255.255.252 serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/1 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/2 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/3 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface FastEthernet1/0
ip address 10.5.1.1 255.255.255.252 ip ospf network point-to-point ip ospf cost 100 duplex auto speed auto !
interface Ethernet3/0
ip address 10.5.5.1 255.255.255.0 half-duplex !
interface Ethernet3/1 no ip address shutdown half-duplex !
interface Ethernet3/2 no ip address shutdown half-duplex !
interface Ethernet3/3 no ip address shutdown half-duplex !
router ospf 10 router-id 10.5.0.1
log-adjacency-changes passive-interface Serial0/0
network 10.0.15.0 0.0.0.3 area 0 network 10.5.0.1 0.0.0.0 area 0 network 10.5.1.0 0.0.0.3 area 0 network 10.5.5.0 0.0.0.255 area 0 !
router bgp 65001 no synchronization bgp router-id 10.5.0.1 bgp log-neighbor-changes
network 10.5.0.0 mask 255.255.0.0 neighbor 10.0.15.1 remote-as 65000
neighbor 10.0.15.1 route-map set-LP-300 in neighbor 10.5.1.2 remote-as 65002 no auto-summary !
ip http server ip classless
ip route 10.5.0.0 255.255.0.0 Null0 ! ! ! !
ip prefix-list p3 seq 5 permit 10.3.0.0/16 !
ip prefix-list p4 seq 5 permit 10.4.0.0/16 ip prefix-list p4 seq 10 permit 10.2.0.0/16 !
ip prefix-list p5 seq 5 permit 10.5.0.0/16 !
ip prefix-list p6 seq 5 permit 10.6.0.0/16 route-map as65000-in permit 10 match ip address prefix-list p3 set local-preference 300 !
route-map as65000-in permit 20 match ip address prefix-list p4 set local-preference 200 !
route-map as65000-in permit 30 !
route-map set-LP-300 permit 10 set local-preference 300 !
route-map as65001-out permit 10 match ip address prefix-list p5 set metric 1000 !
route-map as65001-out permit 20 match ip address prefix-list p6 set metric 2000 !
route-map as65001-out permit 30 ! ! !
control-plane ! !
line con 0
exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! end
R6:
r6#show run
Building configuration...
Current configuration : 2553 bytes !
version 12.3
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption !
hostname r6 !
boot-start-marker boot-end-marker ! !
no aaa new-model !
resource policy !
memory-size iomem 5 ip subnet-zero ! ! ip cef
no ip dhcp use vrf connected ! !
no ip domain lookup
no ftp-server write-enable ! ! ! !
interface Loopback0
ip address 10.6.0.1 255.255.255.255 !
interface Serial0/0
ip address 10.0.26.2 255.255.255.252 serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/1 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/2 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface Serial0/3 no ip address shutdown
serial restart-delay 0
no dce-terminal-timing-enable !
interface FastEthernet1/0
ip address 10.5.1.2 255.255.255.252 ip ospf network point-to-point ip ospf cost 100 duplex auto speed auto !
interface Ethernet3/0
ip address 10.6.6.1 255.255.255.0 half-duplex !
interface Ethernet3/1 no ip address shutdown half-duplex !
interface Ethernet3/2 no ip address shutdown half-duplex !
interface Ethernet3/3 no ip address shutdown
half-duplex !
router ospf 10 router-id 10.6.0.1
log-adjacency-changes passive-interface Serial0/0 network 10.5.1.0 0.0.0.3 area 0 network 10.6.0.1 0.0.0.0 area 0 network 10.6.6.0 0.0.0.255 area 0 !
router bgp 65002 no synchronization bgp router-id 10.6.0.1 bgp log-neighbor-changes
network 10.6.0.0 mask 255.255.0.0 neighbor 10.0.26.1 remote-as 65000
neighbor 10.0.26.1 route-map set-LP-300 in neighbor 10.5.1.1 remote-as 65001 no auto-summary !
ip http server ip classless
ip route 10.6.0.0 255.255.0.0 Null0 ! ! ! !
ip prefix-list p3 seq 5 permit 10.3.0.0/16 !
ip prefix-list p4 seq 5 permit 10.4.0.0/16 ip prefix-list p4 seq 10 permit 10.2.0.0/16 !
ip prefix-list p5 seq 5 permit 10.5.0.0/16 !
ip prefix-list p6 seq 5 permit 10.6.0.0/16 route-map as65000-in permit 10 match ip address prefix-list p3 set local-preference 200 !
route-map as65000-in permit 20 match ip address prefix-list p4 set local-preference 300 !
route-map as65000-in permit 30
!
route-map set-LP-300 permit 10 set local-preference 300 !
route-map as65001-out permit 10 match ip address prefix-list p5 set metric 2000 !
route-map as65001-out permit 20 match ip address prefix-list p6 set metric 1000 !
route-map as65001-out permit 30 ! ! !
control-plane ! !
line con 0
exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! end
五、实验总结
此实验为BGP有关路由策略与选路控制的实验,在本次试验中主要应该注意的问题有:1、要分析清楚每条路由条目是怎么传递的,依据什么参数确定的最佳有效路由。2、BGP路由选择原则13条的先后顺序一定要记清楚,不要弄混。
因篇幅问题不能全部显示,请点此查看更多更全内容