实验目的:

1、理解MED属性能够影响,其它的自治系统的数据流如何流入本地自治系统。

2、掌握基于route-map的MED配置方法。

实验拓扑:

接口ip配置、路由协议基础配置详见

CSDNhttps://mp.csdn.net/mp_blog/creation/editor/125133896查看R3和R4的路由表

R3#show ip route Gateway of last resort is not set34.0.0.0/24 is subnetted, 1 subnets
C       34.34.34.0 is directly connected, FastEthernet0/01.0.0.0/24 is subnetted, 1 subnets
B       1.1.1.0 [20/0] via 23.23.23.2, 00:01:332.0.0.0/24 is subnetted, 1 subnets
B       2.2.2.0 [20/0] via 23.23.23.2, 00:01:3323.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, FastEthernet0/112.0.0.0/24 is subnetted, 1 subnets
B       12.12.12.0 [20/0] via 23.23.23.2, 00:01:3314.0.0.0/24 is subnetted, 1 subnets
B       14.14.14.0 [200/0] via 34.34.34.4, 00:01:35
R4#show ip route Gateway of last resort is not set34.0.0.0/24 is subnetted, 1 subnets
C       34.34.34.0 is directly connected, FastEthernet0/01.0.0.0/24 is subnetted, 1 subnets
B       1.1.1.0 [20/0] via 14.14.14.1, 00:02:062.0.0.0/24 is subnetted, 1 subnets
B       2.2.2.0 [20/0] via 14.14.14.1, 00:02:0623.0.0.0/24 is subnetted, 1 subnets
B       23.23.23.0 [200/0] via 34.34.34.3, 00:01:5112.0.0.0/24 is subnetted, 1 subnets
B       12.12.12.0 [20/0] via 14.14.14.1, 00:02:0614.0.0.0/24 is subnetted, 1 subnets
C       14.14.14.0 is directly connected, FastEthernet0/1

根据路由表可以看出,R3路由器到达R1的1.1.1.0/24子网,选择了14.14.14.0/24网络。在本例中,我们更希望R3选择23.23.23.0/24网络。为了实现这一目的,可以在R1与R2上配置MED属性,因为MED属性可以实现:影响其它的自治系统的数据流,如何流入本地自治系统

根据MED的属性值越低的哪条路由,会被优先选择的特性。而且MED值默认为0。因此,可以在R2上配置其向R2通告的1.1.1.0/24的网络路由的MED值高于默认值即可。如果不主动修改R1的MED默认值的话。

为了能够观察到MED的配置前后路由变化,需要先查看R3与R4的BGP数据库表:

R3#show ip bgp
BGP table version is 7, local router ID is 34.34.34.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incompleteNetwork          Next Hop            Metric LocPrf Weight Path
* i1.1.1.0/24       34.34.34.4               0    100      0 12 i
*>                  23.23.23.2                             0 12 i
* i2.2.2.0/24       34.34.34.4               0    100      0 12 i
*>                  23.23.23.2               0             0 12 i
…………………………
R4#show ip bgp
BGP table version is 8, local router ID is 34.34.34.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incompleteNetwork          Next Hop            Metric LocPrf Weight Path
* i1.1.1.0/24       23.23.23.2               0    100      0 12 i
*>                  14.14.14.1               0             0 12 i
* i2.2.2.0/24       23.23.23.2               0    100      0 12 i
*>                  14.14.14.1                             0 12 i
……………………

在R2上实施MED的策略配置。

R2(config)#access-list 1 permit 1.1.1.0 0.0.0.255
//使用ACL指出需要修改的MED的路由。
R2(config)#route-map set_med permit 10
R2(config-route-map)#match ip address 1
//用于匹配查询ACL 1所指出的路由条目。
R2(config-route-map)#set metric 100
//对于匹配成功的路由条目,将其MED值设为100
R2(config)#route-map set_med permit 20
//配置对于其它的路由采用默认的方式进行宣告。即不做任何修改。
R2(config)#router bgp 12
R2(config-router)#neighbor 23.23.23.3 route-map set_med out
//针对对等体23.23.23.3进行策略路由。
//方向out,是指出从R2向R1发出的路由进行策略设置。

加快bgp收敛

R2#clear ip bgp * soft out 

查看R3与R4的BGP数据库信息。

R3#show ip bgp
BGP table version is 1, local router ID is 34.34.34.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incompleteNetwork          Next Hop            Metric LocPrf Weight Path
* i1.1.1.0/24       34.34.34.4               0    100      0 12 i
*>                  23.23.23.2                             0 12 i
//由于BGP会选择较低的MED值的路由,因此R2选择下一跳为23.23.23.2
* i2.2.2.0/24       34.34.34.4               0    100      0 12 i
*>                  23.23.23.2               0             0 12 I
…………………………
R4#show ip bgp
BGP table version is 9, local router ID is 34.34.34.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incompleteNetwork          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       14.14.14.1               0             0 12 i
//由于MED属性为不可传递,因此,其并没有影响到R4的BGP的路由协议。
*> 2.2.2.0/24       14.14.14.1                             0 12 i
………………………………

为了确切的判断出R3到达1.1.1.0/24的网络路由,使用的是最佳路由,在R4路由器上配置下一跳属性。配置如下:

R4(config)#router bgp 34
R4(config-router)#neighbor 34.34.34.3 next-hop-self 

在R3路由器上查看BGP的数据库和路由表:

R3#show ip bgp
BGP table version is 1, local router ID is 34.34.34.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incompleteNetwork          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       23.23.23.2                             0 12 i
* i                 34.34.34.4               0    100      0 12 i
*> 2.2.2.0/24       23.23.23.2               0             0 12 i
* i                 34.34.34.4               0    100      0 12 i
……………………R3#show ip route Gateway of last resort is not set34.0.0.0/24 is subnetted, 1 subnets
C       34.34.34.0 is directly connected, FastEthernet0/01.0.0.0/24 is subnetted, 1 subnets
B       1.1.1.0 [20/0] via 23.23.23.2, 00:01:112.0.0.0/24 is subnetted, 1 subnets
B       2.2.2.0 [20/0] via 23.23.23.2, 00:01:1123.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, FastEthernet0/112.0.0.0/24 is subnetted, 1 subnets
B       12.12.12.0 [20/0] via 23.23.23.2, 00:01:1114.0.0.0/24 is subnetted, 1 subnets
B       14.14.14.0 [200/0] via 34.34.34.4, 00:01:12

使用tracert命令确认路由信息:

R3#traceroute 1.1.1.1Type escape sequence to abort.
Tracing the route to 1.1.1.11 23.23.23.2 20 msec 8 msec 12 msec2 12.12.12.1 [AS 12] 24 msec 20 msec 28 msec

bgp med属性配置与详解相关推荐

  1. kafka部分属性配置字段详解

    broker配置 常规配置 broker.id默认值是0,可以被设置成任意整数,但是在kafka集群中必须是唯一的.建议设置成与机器名具有相关性的整数 prot kafka默认监听9092端口 zoo ...

  2. Ehcache配置参数详解

    ehcache配置参数详解 <?xml version="1.0" encoding="UTF-8"?><ehcache><dis ...

  3. Java编程配置思路详解

    Java编程配置思路详解 SpringBoot虽然提供了很多优秀的starter帮助我们快速开发,可实际生产环境的特殊性,我们依然需要对默认整合配置做自定义操作,提高程序的可控性,虽然你配的不一定比官 ...

  4. ASP.NET Core的配置(2):配置模型详解

    在上面一章我们以实例演示的方式介绍了几种读取配置的几种方式,其中涉及到三个重要的对象,它们分别是承载结构化配置信息的Configuration,提供原始配置源数据的ConfigurationProvi ...

  5. oracle tns 代理配置_oracle数据库tns配置方法详解

    TNS简要介绍与应用 Oracle中TNS的完整定义:transparence Network Substrate透明网络底层,监听服务是它重要的一部分,不是全部,不要把TNS当作只是监听器. TNS ...

  6. 【夯实Spring Cloud】Spring Cloud分布式配置中心详解

    本文属于[夯实Spring Cloud]系列文章,该系列旨在用通俗易懂的语言,带大家了解和学习Spring Cloud技术,希望能给读者带来一些干货.系列目录如下: [夯实Spring Cloud]D ...

  7. elastic-Job配置参数详解

    elastic-Job配置参数详解 1. 注册中心配置 (1) reg:zookeeper命名空间属性说明 属性名 类型 是否必填 缺省值 描述 id String 是   注册中心在Spring容器 ...

  8. selenium工具启动Chrome浏览器时配置选项详解

    mb62abf3afb54fb2022-06-18 00:02:10 文章标签chromechrome浏览器加载文章分类虚拟化云计算阅读数1473 前言 1. Chromeoptions 是Chrom ...

  9. 机器人轴配置数据详解

    机器人轴配置数据详解 在ABB机器人中,位置的表示与存储是通过 robtarget 数据类型来实现的.robtarget是用于定义机器人与机器人附加轴的移动指令中的位置的.当机器人能够以多种不同的方式 ...

最新文章

  1. $().html()对ie9无效,不注意这点,\9和\0就可能对hack IE11\IE9\IE8无效
  2. Linux学习笔记:touch新建文件、修改访问、改动时间
  3. [lwip-users] memp_malloc: out of memory in pool TCP_PCB
  4. 机器学习经验总结-神经网络训练失败的一些常见原因
  5. 解决eclipse中git插件中的cannot open git-upload-pack问题
  6. DIV默认高度且自适应高度
  7. VS2013、VS2015中,新建项目没有看到解决方案的问题(已解决)
  8. 如何查看IOS系统APP的包名
  9. Datasqueeze v2.0.7
  10. Windows右键菜单管理 图片右键菜单太长
  11. matlab如何绘制状态图,[转载]MATLAB画状态方程的向量图
  12. adb shell打开开发者选项
  13. 春夏秋冬又一春之Redis持久化
  14. 剑指offer编程题(JAVA实现)——第35题:数组中的逆序对
  15. 海盗分赃(8行代码搞定!)
  16. Android基础之十八显示gif动画,动态图片
  17. 【16.10更新】神器再现!百度云网盘批量高速下载 Chrome插件+IDM
  18. oracle删除两个月以前的数据,Oracle恢复删除数据
  19. Hexo(sakura)自定义标签云
  20. Spring Boot整合Freemarker

热门文章

  1. python爬取路况信息_北京市交通管理局实时路况爬虫 | 学步园
  2. CVE-2022-33891:Apache Spark 命令注入漏洞通告
  3. UCOSiii难疑之——“OS_SAFETY_CRITICAL”
  4. 网站报红怎么解决?驰网科技
  5. MySQL数据类型之字符型
  6. fatal error: pcap.h: No such file or directory
  7. cesium 添加纽约城市模型
  8. 企业微信应用深色模式色值表
  9. excel中文名字转换多种方法
  10. Google Earth Engine(GEE)——自定义图标样式ui.chart(内附详细的图表格式修改方式)