HCIP之BGP的选路原则
目录
HCIP之BGP的选路原则
实验
R1基本配置
R2基本配置
R3基本配置
R4基本配置
R5基本配置
ospf区域配置
AS1区域配置
AS2区域配置
BGP选路的原则
1.优选PV值最大的路由
修改PV影响选路的配置:
2.优选LP属性值最大的路由
通过修改LP值来影响选路
3.自己始发的路由
4.优选AS_PATH属性最短的路由
AS_PATH属性进行选路时,需要注意的两点:
干涉选路的方法
5.优选起源码属性最优的路由。
控制选路的方法
6.优选MED属性值较小的路由
干涉选路的方法
7.EBGP对等体路由优于IBGP对等体
HCIP之BGP的选路原则
BGP的选路原则 --- 前提 --- 丢弃所有不可用的路由系信息
实验
R1基本配置
[R1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.0.0.1/24 up up
GigabitEthernet0/0/1 13.0.0.1/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 1.1.1.1/24 up up(s)
NULL0 unassigned up up(s)
[R1]
R2基本配置
[R2]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.0.0.2/24 up up
GigabitEthernet0/0/1 24.0.0.1/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 2.2.2.2/24 up up(s)
NULL0 unassigned up up(s)
[R2]
R3基本配置
[R3]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 13.0.0.2/24 up up
GigabitEthernet0/0/1 34.0.0.1/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 3.3.3.3/24 up up(s)
NULL0 unassigned up up(s)
[R3]
R4基本配置
[R4]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 24.0.0.2/24 up up
GigabitEthernet0/0/1 34.0.0.2/24 up up
GigabitEthernet0/0/2 45.0.0.1/24 up up
LoopBack0 4.4.4.4/24 up up(s)
NULL0 unassigned up up(s)
[R4]\
R5基本配置
[R5]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 45.0.0.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 5.5.5.5/24 up up(s)
NULL0 unassigned up up(s)
[R5]
ospf区域配置
R2
[R2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPFDestinations : 3 Routes : 3 OSPF routing table status : <Active>Destinations : 3 Routes : 3Destination/Mask Proto Pre Cost Flags NextHop Interface3.3.3.3/32 OSPF 10 2 D 24.0.0.2 GigabitEthernet
0/0/14.4.4.4/32 OSPF 10 1 D 24.0.0.2 GigabitEthernet
0/0/134.0.0.0/24 OSPF 10 2 D 24.0.0.2 GigabitEthernet
0/0/1OSPF routing table status : <Inactive>Destinations : 0 Routes : 0[R2]
R3
[R3]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPFDestinations : 3 Routes : 3 OSPF routing table status : <Active>Destinations : 3 Routes : 3Destination/Mask Proto Pre Cost Flags NextHop Interface2.2.2.2/32 OSPF 10 2 D 34.0.0.2 GigabitEthernet
0/0/14.4.4.4/32 OSPF 10 1 D 34.0.0.2 GigabitEthernet
0/0/124.0.0.0/24 OSPF 10 2 D 34.0.0.2 GigabitEthernet
0/0/1OSPF routing table status : <Inactive>Destinations : 0 Routes : 0[R3]
R4
[R4]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPFDestinations : 2 Routes : 2 OSPF routing table status : <Active>Destinations : 2 Routes : 2Destination/Mask Proto Pre Cost Flags NextHop Interface2.2.2.2/32 OSPF 10 1 D 24.0.0.1 GigabitEthernet
0/0/03.3.3.3/32 OSPF 10 1 D 34.0.0.1 GigabitEthernet
0/0/1OSPF routing table status : <Inactive>Destinations : 0 Routes : 0[R4]
AS1区域配置
R1
[R1-bgp]display bgp routing-table BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 1Network NextHop MED LocPrf PrefVal Path/Ogn*> 1.1.1.0/24 0.0.0.0 0 0 i[R1-bgp]display bgp peer BGP local router ID : 1.1.1.1Local AS number : 1Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv12.0.0.2 4 2 22 24 0 00:20:04 Established 013.0.0.2 4 2 21 23 0 00:19:59 Established 0
[R1-bgp]
AS2区域配置
R2
[R2]display bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 1Network NextHop MED LocPrf PrefVal Path/Ogn*> 1.1.1.0/24 12.0.0.1 0 0 1i[R2]display bgp peer BGP local router ID : 2.2.2.2Local AS number : 2Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv4.4.4.4 4 2 14 21 0 00:12:02 Established 012.0.0.1 4 1 23 22 0 00:20:50 Established 1
[R2]
R3
[R3]display bgp peer BGP local router ID : 3.3.3.3Local AS number : 2Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv4.4.4.4 4 2 14 22 0 00:12:02 Established 013.0.0.1 4 1 24 23 0 00:21:17 Established 1[R3]display bgp routing-table BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 1Network NextHop MED LocPrf PrefVal Path/Ogn*> 1.1.1.0/24 13.0.0.1 0 0 1i
[R3]
R4
[R4]display bgp routing-table BGP Local router ID is 4.4.4.4 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*>i 1.1.1.0/24 2.2.2.2 0 100 0 1i* i 3.3.3.3 0 100 0 1i[R4]display bgp peer BGP local router ID : 4.4.4.4Local AS number : 2Total number of peers : 3 Peers in established state : 3Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv2.2.2.2 4 2 17 15 0 00:13:18 Established 13.3.3.3 4 2 16 14 0 00:12:46 Established 145.0.0.2 4 3 23 25 0 00:21:52 Established 0
BGP选路的原则
属性名 |
传播范围 | 默认值 | 评判标准 |
PV | 不传播 | 0(0-65535) | 越大越优 |
LP | IBGP对等体之间 | 100 | 越大越优 |
AS_PATH | BGP对等体之间 | 记录数量越少越优 | |
OGN | bgp对等体之间 | 根据起源类型决定 | I>e>? |
MED | bgp对等体之间 | 默认继承全局路由表中的开销值 | 越小越优 |
1.优选PV值最大的路由
PV值是华为的私有属性,可以理解为是权重,数值越大,其优先级越高,又因为他是所有选路原则中的第一条原则,所以,该属性是本设备上选路最方便的一个属性。 --- 这个属性只能在本设备上生效,他无法传递给任何BGP对等体。
修改PV影响选路的配置:
方法一 --- 全局修改
[R4-bgp]peer 3.3.3.3 preferred-value ?INTEGER<0-65535> Preference value
[R4-bgp]peer 3.3.3.3 preferred-value 100AS-path 1, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 1, not preferred for PreVal
负载分担 --- 即让不同的流量走不同的线路,分担单一线路的压力
方法二 --- 精细化控制
1.抓取流量
[R4]ip ip-prefix PV permit 10.0.0.0 24
2.做路由策略
[R4]route-policy PV permit node 10
Info: New Sequence of this List.
[R4-route-policy]if-match ip-prefix pv
[R4-route-policy]apply preferred-value 100
[R4-route-policy]q
[R4]route-policy PV permit node 20 --- 配置空列表放通剩余所有流量
Info: New Sequence of this List.
[R4-route-policy]q
注意:
必须要配置空列表放通剩余所有流量
3.在BGP中调用路由策略
[r4-bgp]peer 3.3.3.3 route-policy PV import
2.优选LP属性值最大的路由
LP --- 本地优先级 --- 默认值为100,越大越优。这个属性可以再IBGP对等体之间进行传递,所以,他是AS内部选路最常用的属性。路由信息在传递给EBGP对等体时将不携带这个属性
通过修改LP值来影响选路
方法一 --- 全局修改
[R3-bgp]default local-preference 200
方法二 --- 精细化控制
在R3的出方向做
1.抓取路由
[r3]ip ip-prefix lp permit 10.0.0.0 24
2.做路由策略
[r3]route-policy lp permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-match ip-prefix lp
[r3-route-policy]apply local-preference 300
[r3-route-policy]q
[r3]route-policy lp permit node 20
Info: New Sequence of this List.
[r3-route-policy]q
3.在BGP进程中调用
[r3-bgp]peer 4.4.4.4 route-policy lp export
3.自己始发的路由
自己始发的路由优先级高于对等体处学来的,自己始发的方法也存在多种,他们的优先级关系为手工聚合>自动聚合>network>import
4.优选AS_PATH属性最短的路由
AS_PATH属性进行选路时,需要注意的两点:
1.我们在进行路由聚合时,如果激活AS_SET关键字之后,将不同AS的明细路由进行聚合,则我们将AS_PATH属性中携带所有明细AS的AS号,并用大括号括起来。在进行选路比较时,大括号的内容当做一个AS号来看待。
2.在联邦时,我们联邦内部也需要使用AS_PATH来进行防环,我们使用小括号将AS号括起来,在进行选路比较时,将不计算小圆括号里的内容。
干涉选路的方法
在R1的出方向修改AS_PATH属性
1.抓取路由
[r1]ip ip-prefix as permit 10.0.0.0 24
2.配置路由策略
[r1]route-policy as permit node 10
Info: New Sequence of this List.
[r1-route-policy]if-match ip-prefix as
[R1-route-policy]apply as-path 11 22 33 ?INTEGER<1-4294967295> AS number in asplain format (number<1-4294967295>)STRING<3-11> AS number in asdot format (number<1-65535>.number<0-65535>)additive Append to original As Numberoverwrite Overwrite original As Number[R1-route-policy]apply as-path 11 22 33 additive
[R1]route-policy as permit node 20
Info: New Sequence of this List.
解析:
additive Append to original As Number --- 在原有AS_PATH属性的基础上添加配置的AS号
overwrite Overwrite original As Number --- 直接覆盖原有的AS_PATH属性值
[R1-route-policy]apply as-path 11 22 33 additive --- 建议使用添加,因为AS_PATH属性主要任务用来防止环路,将原有属性覆盖可能导致路由回传,造成环路产生
3.在BGP中调用策略
[R1-bgp]peer 12.0.0.2 route-policy as export
[r2-route-policy]apply as-path 1 1 1 additive --- 建议在AS_PATH属性中添加真实离开的AS的AS号,因为AS_PATH属性本身具有防环作用,添加AS号后可能导致路由无法发送到对应的AS当中,影响陆游的传递。AS_PATH属性在进行选路时,仅关注AS号的长短,不关注内容。
5.优选起源码属性最优的路由。
起源码的优先级 --- I>E>?
OGN --- 起源码 --- I,e,?--- 用来表示路由条目的起源
I --- 代表该路由信息起源于IGP协议(不局限于IGP协议,包括静态,直连),代表该路由条目起源于AS内部 --- 通过network发不出来的路由信息起源码为I
E --- 代表该路由信息起源于EGP协议 --- EGP指的是BGP之前使用的外部网关协议
?--- 通过除了以上两种方式学习到的路由 --- 重发布导入的路由起源码都是 ?
控制选路的方法
1.抓取路由
[r2]ip ip-prefix ogn permit 10.0.0.0 24
[r2]route-policy ogn permit node 10
Info: New Sequence of this List.
[r2-route-policy]if-match ip-prefix ogn
[r2-route-policy]apply origin ?
egp Remote EGP
igp Local IGP
incomplete Unknown heritage
[r2-route-policy]apply origin incomplete
[r2-route-policy]q
[r2]route-policy ogn permit node 20
Info: New Sequence of this List.
[r2-route-policy]q
3.在BGP中进行调用
[r2-bgp]peer 12.0.0.1 route-policy ogn import
6.优选MED属性值较小的路由
MED --- 多出口鉴别属性 --- MED值默认初始值并不是0,而是继承了路由表中该路由条目的开销值,所以,他可以反应到达目标网段在本AS内部的开销值大小,通过这个参数,别的AS的流量在进入本AS时将可以选择开销值较小的入口进入。通过修改这个属性值,我们也可以影响其他AS的流量流入本AS的路径。若本地通过IBGP毒地鞥提学习到一条BGP路由,其中存在MED值,之后需要将这条路由再传递给本地的EBGP对等体,则他将不再携带这个MED值,这种设置将有可能造成选路不佳的情况。所以,讲义,如果存在多边界设备需要将路由发送给EBGP对等体关系时,需要将所有的路由信息都发布。(每台设备都需要发布)
干涉选路的方法
在R2配置,影响R1的选路
1.抓取路由
[r2]ip ip-prefix med permit 4.4.4.0 24
2.配置路由策略
[r2]route-policy med permit node 10
Info: New Sequence of this List.
[r2-route-policy]if-match ip-prefix med
[r2-route-policy]apply cost 10
[r2-route-policy]q
[r2]route-policy med permit node 20
Info: New Sequence of this List.
[r2-route-policy]q
3.在BGP进程中调用
[r2-bgp]peer 12.0.0.1 route-policy med export
注意:
MED值影响的是别的AS的流量通过多个出口进入到本AS内部,如果流入的不是同一个AS,即收到的路由条目中AS_PATH属性最左边的AS号不同,则将不比较第六条,直接比较第七条
7.EBGP对等体路由优于IBGP对等体
HCIP之BGP的选路原则相关推荐
- BGP路由选路原则排序
1.首先丢弃下一跳(NEXT_HOP)不可达的路由: 2.优选Preferred-value值最大的路由: 3.优选本地优先级(LOCAL_PREF)最高的路由: 4.优选聚合路由: 5.优选AS路径 ...
- bgp选路原则【第二部】
面向逻辑谈bgp选路原则(第二部) 终于到了BGP终极解析的第二部曲--BGP选路原则.与题目相呼应,我不会直接介绍选路原则的规则,而是从时间逻辑和空间逻辑上将所有的选路原则分层分类.因为只有从这种角 ...
- BGP团体属性 选路原则
赠人玫瑰,手有余香. 文章目录 一.BGP的选路原则 二.拓扑 三.基础配置 四.策略部署 一.BGP的选路原则 1.BGP路由器将路由通告给邻居后,每个BGP邻居都会进行路由优选,路由选择有三种情况 ...
- bgp通告四原则_BGP选路原则详解
<BGP选路原则详解>由会员分享,可在线阅读,更多相关<BGP选路原则详解(112页珍藏版)>请在人人文库网上搜索. 1.BGP选路原则详解,BGP路由选路原则详解,技术培训中 ...
- bgp通告四原则_BGP的十三条选路原则
BGP的13条选路原则: 1.优选具有最大Weight值的路由 2.优选具有最大Local_Preference值的路由 3.优选起源于本地的路由(如本地network.aggregate或redis ...
- bgp通告四原则_华为路由器BGP路由选路和负载均衡
点击"HCIE考试俱乐部"→点击右上角"..."→"设为星标" 资讯丨干货丨入群 联系小E微信:SPOTO123456 作者:alon ...
- BGP协议:简介、属性、选路原则
BGP协议:简介.属性.选路原则 目录 BGP协议:简介.属性.选路原则 一.学习网络BGP必备基础知识 二.BGP 工作原理 三.BGP报文 四.BGP邻居关系的配置 五.BGP需要注意的事项 六. ...
- BGP------BGP工作原理、BGP属性及选路原则
BGP工作原理 一.BGP报文 1.open报文 作用:建立邻居.协商参数 open报文只在邻居建立时发送,不会周期发送 内容: version:BGP版本 My AS:自身的AS号 hold tim ...
- Cisco(37)——BGP的十三条选路原则演示
思科网络实验(34)--BGP的十三条选路原则 实验拓扑: 实验说明: 1.拓扑中含有三个AS,只有在AS10内存在三台路由器,在AS10内部运行EIGRP传路由,剩余的AS内部只有一台路由器. 2. ...
最新文章
- 通过信息系统项目管理师+系统集成我是如何做到的?
- JPA-EntityManager.merge()
- (原)PyTorch中使用指定的GPU
- pytorch查看模型的可训练参数
- nginx日志分析脚本
- TensorFlow会话的配置项
- 计算机体系结构数据库论文,信息管理中计算机数据库系统研究论文
- SecureCRT登录本地cygwin。
- 移动端自适应缩放代码
- C++ 多线程与并发
- python 下载文件-python爬虫之下载文件的方式总结以及程序实例
- 阶段1 语言基础+高级_1-3-Java语言高级_06-File类与IO流_07 缓冲流_5_BufferedWriter_字符缓冲输出流...
- WINDOWS 下将 FAT OR FAT32 转换成 NTFS 格式
- 转:UIViewController中各方法调用顺序及功能详解
- PaddleHub创意项目 | 将霉霉P到埃菲尔铁塔前
- android注册页面开发
- 随笔记之lombok
- 新媒体运营是什么??新媒体运营通过哪些方式进行?
- 互点流量,互刷排名,刷下拉刷联想-胖虎图图-互动点击系统
- 2017年计算机春季高考试题,山东省2017年春季高考数学试题(PDF版,含答案)
热门文章
- 异方差性和加权最小二乘法详解
- 求n + nn + nnn + nnnn + .... = 用C语言
- json文件保存与读取
- linux 读卡器信息,Linux如何使用笔记本自带的SD/MMC读卡器
- adroid xpose 修改java方法实例_基于xposed 修改硬件信息(xposed框架使用)
- numeric_limits 解析
- 【Linux】ssh连接远程服务器
- Oracle Oracle数据库常用命令、Linux监听配置、oracle linux下开放1521端口
- 10分钟教你搭建自己的ngrok服务器
- 2021单招十类计算机试题,2021年河北省高职单招考试十类和高职单招对口电子电工类、对口计算机类联考文化素质考试(数学)考试大纲...