Bgp的本地优先属性    
                           <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Router#config t
Router(config)#host R2
R2(config)#int s1/1
R2(config-if)#ip addr 202.110.101.1 255.255.255.0
R2(config-if)#encap hdlc
R2(config-if)#clock rate 56000
R2(config-if)#no shut
R2(config)#int s1/2
R2(config-if)#ip addr 202.110.104.2 255.255.255.0
R2(config-if)#encap hdlc
R2(config-if)#no shut
R2(config-if)#exi
R2(config)#router bgp 64500
R2(config-router)#neighbor 202.110.101.2 remote-as 64500
R2(config-router)#neighbor 202.110.104.1 remote-as 64500
R2(config-router)#net 202.110.101.0
R2(config-router)#net 202.110.104.0
Router(config)#host R3
R3(config)#int s1/1
R3(config-if)#ip addr 202.110.101.2 255.255.255.0
R3(config-if)#encap hdlc
R3(config-if)#no shut
R3(config-if)#int s1/2
R3(config-if)#ip addr 202.110.102.1 255.255.255.0
R3(config-if)#encap hdlc
R3(config-if)#clock rate 56000
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#
R3(config)#router bgp 64500
R3(config-router)#neighbor 202.110.101.1 remote-as 64500
R3(config-router)#neighbor 202.110.102.2 remote-as 64501
R3(config-router)#net 202.110.101.0
R3(config-router)#net 202.110.102.0
config)#
R4(config)#int lo0
R4(config-if)#ip addr 192.168.10.1 255.255.255.0
R4(config-if)#exit
R4(config)#int s1/2
R4(config-if)#ip addr 202.110.102.2 255.255.255.0
R4(config-if)#encap hdlc
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#int s1/1
R4(config-if)#ip addr 202.110.103.1 255.255.255.0
R4(config-if)#encap hdlc
R4(config-if)#clock rate 56000
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#router bgp 64501
R4(config-router)#neighbor 202.110.102.1 remote-as 64500
R4(config-router)#neighbor 202.110.103.2 remote-as 64500
R4(config-router)#net 192.168.10.0
R4(config-router)#net 202.110.102.0
R4(config-router)#net 202.110.103.0
Router(config)#host R5
R5(config)#int s1/1
R5(config-if)#ip addr 202.110.103.2 255.255.255.0
R5(config-if)#encap hdlc
R5(config-if)#no shut
R5(config-if)#exit
R5(config)#int
R5(config)#int s1/2
R5(config-if)#ip addr 202.110.104.1 255.255.255.0
              
R5(config-if)#encap hdlc
R5(config-if)#clock rate 56000
R5(config-if)#no shut
R5(config-if)#exit
R5(config)#router bgp 64500
R5(config-router)#neighbor 202.110.103.1 remote-as 64501
R5(config-router)#neighbor 202.110.104.2 remote
R5(config-router)#neighbor 202.110.104.2 remote-as 64500
R5(config-router)#net 202.110.103.0
R5(config-router)#net 202.110.104.0                             ^
R5(config-router)#net 202.110.104.0
R5(config-router)#exit
R2上测试
R2#show ip ro
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
C    202.110.101.0/24 is directly connected, Serial1/1
B    192.168.10.0/24 [200/0] via 202.110.102.2, 00:00:20
B    202.110.102.0/24 [200/0] via 202.110.101.2, 00:18:46
B    202.110.103.0/24 [200/0] via 202.110.104.1, 00:13:38
C    202.110.104.0/24 is directly connected, Serial1/2
由R2上的路由,可以看出默认情况下学习R4上的路由走R3,下面我们将人为通过修改路由器的本地优先属性,使R2上学习到R4的路由走R5,如果成功,那么今天的目的就基本达到了。本地优先属性的修改语法是:
(config-router)#bgp  default  local-preference 值
//该值默认范围是0-----4294967295,默认是100,且属性值越高越好。
我们让R3为默认的100,人为将R5的属性值改为120,看试验效果。
R5(config)#router bgp 64500
R5(config-router)#bgp default local-preference 120
R5(config-router)#net 202.110.103.0
R5(config-router)#net 202.110.104.0
在R2上测试,
R2#clear ip ro *
R2#show ip ro
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
C    202.110.101.0/24 is directly connected, Serial1/1
B    192.168.10.0/24 [200/0] via 202.110.102.2, 00:00:01  当重新学习路由表后,该路由没有变,不是我们想要的试验结果。
B    202.110.102.0/24 [200/0] via 202.110.101.2, 00:00:01
B    202.110.103.0/24 [200/0] via 202.110.104.1, 00:00:01
C    202.110.104.0/24 is directly connected, Serial1/2
R2#clear ip bgp *
*Apr 30 20:22:31.027: %BGP-5-ADJCHANGE: neighbor 202.110.101.2 Down User reset
*Apr 30 20:22:31.031: %BGP-5-ADJCHANGE: neighbor 202.110.104.1 Down User reset 提示重新启动。
R2#show ip bgp
BGP table version is 8, local router ID is 202.110.104.2
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
* i192.168.10.0     202.110.102.2            0    100      0 64501 i
*>i                 202.110.103.1            0    120      0 64501 I 
>表示最好路由,优先属性变成了120,
r>i202.110.101.0    202.110.101.2            0    100      0 i
* i202.110.102.0    202.110.101.2            0    100      0 i
*>i                 202.110.103.1            0    120      0 64501 i
* i202.110.103.0    202.110.102.2            0    100      0 64501 i
*>i                 202.110.104.1            0    120      0 i
r>i202.110.104.0    202.110.104.1            0    120      0 i
有这张bgp表可以看出明显存在下一跳问题,也可以按照以前的修改下一跳,克服保留下一跳的问题。
分别在R3 和R5上做,因为理论上R2的下一跳应该在这两台路由器上。
R3(config)#router bgp 64500
R3(config-router)#neighbor 202.110.101.1 next-hop-self
R5(config)#router bgp 64500
R5(config-router)#neighbor 202.110.104.2 next-hop-self
R2#show ip bgp
BGP table version is 12, local router ID is 202.110.104.2
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
* i192.168.10.0     202.110.101.2            0    100      0 64501 i
*>i                 202.110.104.1            0    120      0 64501 i
*> 202.110.101.0    <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.0                  0         32768 i
* i                 202.110.101.2            0    100      0 i
* i202.110.102.0    202.110.101.2            0    100      0 i
*>i                 202.110.104.1            0    120      0 64501 i
* i202.110.103.0    202.110.101.2            0    100      0 64501 i
*>i                 202.110.104.1            0    120      0 i
*> 202.110.104.0    0.0.0.0                  0         32768 i
* i                 202.110.104.1            0    120      0 i
R2#
C    202.110.101.0/24 is directly connected, Serial1/1
B    192.168.10.0/24 [200/0] via 202.110.103.1, 00:01:02 经过的路径也改了过来。
B    202.110.102.0/24 [200/0] via 202.110.103.1, 00:01:02
B    202.110.103.0/24 [200/0] via 202.110.104.1, 00:01:02
C    202.110.104.0/24 is directly connected, Serial1/2

转载于:https://blog.51cto.com/shenleigang/154602

CCNP系列三十四--- Bgp的本地优先属性相关推荐

  1. 电气器件系列三十四:智能除湿装置

    冷凝智能除湿装置是采用半导体冷凝方式,主动将密闭空间的潮湿空气在风扇的作用下吸入除湿风道,空气中的水汽经过冷凝机构后凝结成水,再通过导水管排出柜体,可以达到很好的除湿效果.智能除湿装置把被动防止凝露方 ...

  2. BizTalk开发系列(三十四) Xpath

    更多内容请查看:BizTalk动手实验系列目录                       BizTalk 开发系列 XPath 是在 XML 文档中查找信息的语言,在BizTalk的开发中应用非常广 ...

  3. Tricks(三十四)—— 判断某一属性列是数值型还是标称型

    # 这时还未将标称型属性从字符串转化为 int if isinstance(x[feat], int) or isinstance(x[feat], float):... else:...

  4. 前端工程师和设计师必读文章推荐【系列三十六】

    <Web 前端开发精华文章推荐>自2011年6月20号发布第一期以来,历经五年半,总共发布了30多期.今天这篇是2017年第2期(总第36期),希望你能在这里发现有用的资料. 梦想天空专注 ...

  5. 【SQL开发实战技巧】系列(十四):计算消费后的余额计算银行流水累计和计算各部门工资排名前三位的员工

    系列文章目录 [SQL开发实战技巧]系列(一):关于SQL不得不说的那些事 [SQL开发实战技巧]系列(二):简单单表查询 [SQL开发实战技巧]系列(三):SQL排序的那些事 [SQL开发实战技巧] ...

  6. springboot mybatis ehcache_SpringBoot入门建站全系列(十四)集成Redis缓存

    SpringBoot入门建站全系列(十四)集成Redis缓存 一.概述 本地缓存,就是使用应用内使用本地内存将数据暂缓存储,一般数据库的查询如果不怎么改动,可以用本地缓存暂存. 远程缓存,比如redi ...

  7. 【Visual C++】游戏开发笔记三十四 浅墨DirectX提高班之三 起承转合的艺术:Direct3D渲染五步曲...

    本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 文章链接: http://blog.csdn.net/zhmxy555/article/details/8223965 作者:毛星云(浅墨 ...

  8. 实践数据湖iceberg 第三十四课 基于数据湖icerberg的流批一体架构-流架构测试

    系列文章目录 实践数据湖iceberg 第一课 入门 实践数据湖iceberg 第二课 iceberg基于hadoop的底层数据格式 实践数据湖iceberg 第三课 在sqlclient中,以sql ...

  9. 【正点原子FPGA连载】第三十四章RGB-LCD触摸屏实验 -摘自【正点原子】新起点之FPGA开发指南_V2.1

    1)实验平台:正点原子新起点V2开发板 2)平台购买地址:https://detail.tmall.com/item.htm?id=609758951113 2)全套实验源码+手册+视频下载地址:ht ...

  10. 【Visual C++】游戏开发笔记三十四 浅墨DirectX提高班之三 起承转合的艺术:Direct3D渲染五步曲

    本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 文章链接: http://blog.csdn.net/zhmxy555/article/details/8223965 作者:毛星云(浅墨 ...

最新文章

  1. VC6.0的使用,工程的创建
  2. 设计模式第19篇:访问者模式
  3. 什么意思_invalid是什么意思
  4. multiprocessing(python 版)
  5. 实验一 线性表的顺序存储与实现_程序员:数据结构与算法,线性表介绍
  6. 广州电子厂房净化工程_医药厂房净化车间工程验收,怎么测定风速风量和换气次数?...
  7. 目标检测的性能上界讨论
  8. (html字体图片纯css插件)Font Awesome
  9. 数据科学常用Python库介绍--Numpy、Scipy、Pandas、Matplotlib、Plotly、SciKit-Learn等
  10. php7会带领,php7中不能做的10件事
  11. 2015年江苏对口单招计算机试卷答案,2016江苏对口单招试卷 2015年江苏对口单招计算机试卷.doc...
  12. beats耳机红白交替闪烁三次_beats耳机红白灯交替闪怎么解决
  13. 计网 应用题、计算题 答案详解 总结(已更完)
  14. 修改客户端 与服务器断开,如何处理服务器或客户端socket断开
  15. 视觉技术再赋能,深眸科技一体化解决方案引领工业视觉机器人落地应用
  16. 【web开发 模拟ua调试】修改chrome浏览器的user agent
  17. 文件名依照字符串和数字进行排序
  18. 融云根据关键字获取搜索聊天记录
  19. Delphi的多线程开发实例
  20. workon 未找到命令

热门文章

  1. UML?类图中聚合和组合的区别
  2. cs231n学习(1)图像分类器:KNN和线性分类器(上)
  3. 操作系统课设 Nachos 实验三:利用信号量实现线程同步
  4. 单片机c语言中void key(void),单片机C语言编程
  5. 小红帽系统进入oracle,11G RAC 安装在红帽6上,grid跑root.sh报错
  6. vant实现三级联动
  7. springboot+easyui+jpa实现动态权限角色的后台管理系统(二)
  8. [POJ3233] Matrix Power Series(矩阵快速幂)
  9. 解决Eclipse10配置Pydev不成功的问题
  10. 正则表达式验证输入用户名格式是否正确