cisco学习笔记

      CCIE之路中。。。。其实我是一个天才,可惜天妒英才!o(∩_∩)o...哈哈

  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  39 随笔 :: 5 文章 :: 36 评论 :: 0 Trackbacks

BGPlocal-preference试验

拓扑:

因为BGPlocal-preference默认为100,而BGP默认选择local-preference较大的值作为下一跳

local-preference配置:在本地配置影响IBGP对等体出站

R1的配置:

Router>en

Router#conf t

Router(config)#host R1

R1(config)#int s1/1

R1(config-if)#ip add 10.1.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int fa0/0

R1(config-if)#ip add 10.4.4.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int lo 0

R1(config-if)#ip add 1.1.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#exi

R1(config)#router rip    bgp的底层协议我起的RIP

R1(config-router)#ver 2

R1(config-router)#no au

R1(config-router)#net 1.0.0.0

R1(config-router)#net 10.0.0.0 

R1(config-router)#end

R1(config)#int lo 1

R1(config-if)#ip add 100.100.100.100 255.255.255.0

R1(config-if)#no sh

R1(config-if)#exi

R1(config)#router bgp 100

R1(config-router)#net 100.100.100.0 mask 255.255.255.0   (公告100.100.100.0/24网段)

R1(config-router)#nei 2.2.2.2 remote 100

R1(config-router)#nei 2.2.2.2 update-source loopback 0  (指定更新源是LOOPBACK 0

R1(config-router)#nei 4.4.4.4 remote 200

R1(config-router)#nei 4.4.4.4 update-source lo 0

R1(config-router)#nei 4.4.4.4 ebgp-multihop 2  ebgp建立邻居时要配置)

 

R2 R3 R4 的配置与R1的类似

 

现在我们查看R3 R4bgp路由表:

R3#sh ip bgp

BGP table version is 3, local router ID is 3.3.3.3

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

* i100.100.100.0/24    1.1.1.1                  0    100       0 100 i

*>                  2.2.2.2                                 0 100 i

* i200.200.200.0       1.1.1.1                  0    100       0 100 i

*>                  2.2.2.2                   0              0 100 i

 

R4#sh ip bgp

BGP table version is 3, local router ID is 4.4.4.4

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

* i100.100.100.0/24    2.2.2.2                  0    100      0 100 i

*>                  1.1.1.1                  0             0 100 i

* i200.200.200.0       2.2.2.2                  0    100      0 100 i

*>                  1.1.1.1                                0 100 i

发现R3 学到100.100.100.0/24 网络和200.200.200.0/24网络都是从R2学到的

发现R4 学到100.100.100.0/24 网络和200.200.200.0/24网络都是从R1学到的

这是为什么呢?为什么不是R3学到100.100.100.0/24 网络从R1而学200.200.200.0/24网络都是从R2学到呢?

这是因为EBGP优与IBGP

 

 

现在在R4上做local-preference来影响R3出站:让R3学到100.100.100.0/24 是从R1学到的。

 

R4(config)#access-list 1 per 100.100.100.0 0.0.0.255  (标示出要施加策略的网络)

R4(config)#route-map ccxx per 10                   (写ROUTE-MAP

R4(config-route-map)#ma ip add 1

R4(config-route-map)#set local-preference 200          (改变local-preference值,越大越优)

R4(config-route-map)#exi

R4(config)#route-map ccxx per 20                      (写一个空ROUTE-MAP

R4(config-route-map)#exi

R4(config)#router bgp 200

R4(config-router)#nei 1.1.1.1 route-map ccxx in            (套用ROUTE-MAP)

 

再查看R3 R4BGP路由表:

R3#sh ip bgp

BGP table version is 4, local router ID is 3.3.3.3

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

*>i100.100.100.0/24   1.1.1.1            0    200      0 100 I  (变了吧!!(=^ ^=))

*                   2.2.2.2                           0 100 i

* i200.200.200.0       1.1.1.1              0    100      0 100 i

*>                  2.2.2.2               0             0 100 i

 

R4#sh ip bgp

BGP table version is 4, local router ID is 4.4.4.4

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

*> 100.100.100.0/24   1.1.1.1                  0    200      0 100 i

* i200.200.200.0    2.2.2.2                  0    100      0 100 i

*>                  1.1.1.1                                0 100 i

posted on 2008-10-02 23:03 cisco交流平台 阅读(4978) 评论(0)  编辑 收藏 引用 所属分类: BGP
只有注册用户登录后才能发表评论。