所向无敌 发表于 2015-11-5 09:18:35

BGP local-preference 试验

拓扑:

因为BGP的local-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 R4的bgp路由表:
  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 R4的BGP路由表:
  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
  
    


Cisco CCIE Security 2009 IOS防火墙合集
Cisco CCIE Security 2009最新整套视频合集
dada147 2009 ccnp新版交换视频集合

  CCIE 路由与交换 CCIE SP 服务提供商
CCIE R&S v4.0 LAB 版本 k1 + k2 + k3 分享 转帖
现任明教教主共享TCPIP课程(2008年最新录制)2008.6.18

现任明教教主视频汇总
  JUNOS Enterprise Routing

  秦柯 08 CCIEPIX 分解实验 一

秦柯 08 CCIE pix 视频分享 1-2集
Catalyst 6500 Lab Virtual Switching System VSS--中文
F5 中国解决方案
Cisco 交换机6509配置实例(双机热备)

H3C与cisco互联问题技术交流汇总
F5 链路负载均衡方案模板
F5 FirePass功能配置手册

Cisco 6500 FWSM防火墙模块配置和实验案例

Cisco ASA 5500 系列产品售后实施文档
Cisco ASA and PIX Firewall Handbook


  Juniper视频如何购买
  CCSP视频下载
  Juniper 视频购买
  Cisco CCNP+TSHOOT+642-832+中文 高清扫描版
  新版 CCNP 学习用书 CCNP SWITCH 642-813
  新版 CCNP 学习用书 CCNP ROUTE 642-902
  新版 CCNP 学习用书 CCNP TSHOOT 642-832
  
  [已更新] 秦柯TCP-IP协议基础视频(含PPT文档共960MB)文章转载至http://bbs.net527.cn无忧网客联盟
shop.net527.cn/

  无忧网客联盟主站
无忧linux时代
             版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: BGP local-preference 试验