注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 51CTO三周年庆典之IT北斗..
 帮助

CCNP-34 BGP 4


2007-12-10 21:38:04
 标签:网络 BGP 4 CCNP-34   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://loveme23.blog.51cto.com/7891/54451

CCNP-34 BGP 4

实验拓扑:

实验要求:按照拓扑将4台路由器分别配置在AS 100/200中,R1R2 R3成为EBGP PEERR4R2 R3成为IBGP PEER,在R4上起loopback接口,配置完成后在R1上观察BGP路由表,看看R4loopback接口的网络是通过哪台路由器学习到的,然后通过修改MED属性,使之从另外一台路由器学习R4loopback网络。
试验目的:掌握BGP属性中的MED属性的作用和配置方法。

实验配置:
R1
R1(config)#int f0/0
R1(config-if)#ip add 172.16.1.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int f1/0
R1(config-if)#ip add 172.16.4.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int loop0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#router bgp 100
R1(config-router)#neighbor 172.16.1.2 remote-as 200
R1(config-router)#neighbor 172.16.4.2 remote-as 200
R1(config-router)#exit
 
R2
R2(config)#int f0/0
R2(config-if)#ip add 172.16.1.2 255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int f1/0
R2(config-if)#ip add 172.16.2.1 255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int loop0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#router bgp 200
R2(config-router)#neighbor 172.16.1.1 remote-as 100
R2(config-router)#neighbor 4.4.4.4 remote-as 200
R2(config-router)#neighbor 3.3.3.3 remote-as 200
R2(config-router)#neighbor 4.4.4.4 update-source loopback 0
R2(config-router)#neighbor 3.3.3.3 update-source loopback 0
R2(config-router)#exit
R2(config)#ip route 3.3.3.0 255.255.255.0 172.16.2.2
R2(config)#ip route 4.4.4.0 255.255.255.0 172.16.2.2
R2(config)#exit
 
R3
R3(config)#int f0/0
R3(config-if)#ip add 172.16.3.2 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#int f1/0
R3(config-if)#ip add 172.16.4.2 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#int loop0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#exit
R3(config)#router bgp 200
R3(config-router)#neighbor 172.16.4.1 remote-as 100
R3(config-router)#neighbor 2.2.2.2 remote-as 200
R3(config-router)#neighbor 4.4.4.4 remote-as 200
R3(config-router)#neighbor 2.2.2.2 update-source loopback 0
R3(config-router)#neighbor 4.4.4.4 update-source loopback 0
R3(config-router)#exit
R3(config)#ip route 2.2.2.0 255.255.255.0 172.16.3.1
R3(config)#ip route 4.4.4.0 255.255.255.0 172.16.3.1
R3(config)#exit
 
R4
R4(config)#int f0/0
R4(config-if)#ip add 172.16.3.1 255.255.255.0
R4(config-if)#no shu
R4(config-if)#exit
R4(config)#int f1/0
R4(config-if)#ip add 172.16.2.2 255.255.255.0
R4(config-if)#no shu
R4(config-if)#exit
R4(config)#int loop0
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#exit
R4(config)#int loop1
R4(config-if)#ip add 10.10.10.10 255.255.255.0
R4(config-if)#exit
R4(config)#int loop2
R4(config-if)#ip add 20.20.20.20 255.255.255.0
R4(config-if)#exit
R4(config)#router bgp 200
R4(config-router)#neighbor 2.2.2.2 remote-as 200
R4(config-router)#neighbor 3.3.3.3 remote-as 200
R4(config-router)#neighbor 2.2.2.2 update-source loopback 0
R4(config-router)#neighbor 3.3.3.3 update-source loopback 0
R4(config-router)#network 10.10.10.0 mask 255.255.255.0
R4(config-router)#network 20.20.20.0 mask 255.255.255.0
R4(config-router)#exit
R4(config)#ip route 2.2.2.0 255.255.255.0 172.16.2.1
R4(config)#ip route 3.3.3.0 255.255.255.0 172.16.3.2
R4(config)#ip route 172.16.1.0 255.255.255.0 172.16.2.1
R4(config)#ip route 172.16.4.0 255.255.255.0 172.16.3.2
R4(config)#exit
 
好了,基本的BGP配置完成了,配置静态路由的作用是因为BGP的同步特性要求。然后我们在R1show ip bgp查看一下BGP的路由表:
R1#show ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*  10.10.10.0/24    172.16.4.2                             0 200 i
*>                  172.16.1.2                             0 200 i
*  20.20.20.0/24    172.16.4.2                             0 200 i
*>                  172.16.1.2                             0 200 i
可以看到到10.10.10.0/2420.20.20.0/24的路由都是从172.16.1.2学到的,也就是从R2学到的,默认的Metric0,那么为什么不是从R3学到的呢?后面我会讲到BGP路由选择路径的方法和顺序。
如果这样配置的话,R3基本上没有什么流量,所有的流量都是通过R2走的,下面我们来配置BGPMetric属性来把20.20.20.0/24的流量分担到R3上:
R2(config)#access-list 10 permit 10.10.10.0 0.0.0.255
R2(config)#route-map med_10 permit 10
R2(config-route-map)#match ip add 10
R2(config-route-map)#set metric 100
R2(config-route-map)#exit
R2(config)#route-map med_10 permit 20
R2(config-route-map)#set metric 200
R2(config-route-map)#exit
R2(config)#router bgp 200
R2(config-router)#neighbor 172.16.1.1 route-map med_10 out
R2(config-router)#exit
 
R3(config)#access-list 20 permit 20.20.20.0 0.0.0.255
R3(config)#route-map med_20 permit 10
R3(config-route-map)#match ip add 20
R3(config-route-map)#set metric 100
R3(config-route-map)#exit
R3(config)#route-map med_20 permit 20
R3(config-route-map)#set metric 200
R3(config-route-map)#exit
R3(config)#router bgp 200
R3(config-router)#neighbor 172.16.4.1 route-map med_20 out
R3(config-router)#exit
首先定义一条访问控制列表来设置感兴趣的路由,然后配置策略路由,匹配之前定义的ACL,然后设置MED属性,BGP会优先选择MED属性值低的路径,最后把定义好的策略路由应用到BGP邻居配置中,方向为OUTMED属性只在EBGP对等体之间传输)。
都设置好后,我们在R1clear ip bgp *强制重起一下BGP的进程,然后再show ip bgp查看BGP的路由表:
R1#show ip bgp  
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    172.16.1.2             100             0 200 i
*                   172.16.4.2             200             0 200 i
*  20.20.20.0/24    172.16.1.2             200             0 200 i
*>                  172.16.4.2             100             0 200 i
观察一下与刚才有什么不同?Metric属性值变了,从172.16.1.2学到的10.10.10.0/24Metric变为10020.20.20.0/24Metric变为200,同样,从172.16.4.2学到的10.10.10.0/24Metric变成了20020.20.20.0/24Metric变成了100,这样的话R1上学到的10.10.10.0/24的路由就是通过R2学到的,20.20.20.0/24学到的路由是从R3学到的,这样就有效的分担了R2上的流量。
再来看一下R1的路由表:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     20.0.0.0/24 is subnetted, 1 subnets
B       20.20.20.0 [20/100] via 172.16.4.2, 00:01:05
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.4.0 is directly connected, FastEthernet1/0
C       172.16.1.0 is directly connected, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
B       10.10.10.0 [20/100] via 172.16.1.2, 00:01:05

实验总结:掌握在BGP路径选择中MED属性的作用,并且掌握修改MED属性的方法。

本文出自 “★Beckham~23” 博客,请务必保留此出处http://loveme23.blog.51cto.com/7891/54451



上一篇 CCNP-33 BGP 3  下一篇 CCNP-35 BGP 5



    文章评论
 
2007-12-11 00:13:20
看了博主好多实验了 不错 辛苦了

2007-12-11 19:37:05
回复:卡卡
多谢了,不辛苦,为人民服务! 呵呵

2008-05-27 19:07:27
楼主大好人!

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: