BGP选路规则实验

实验拓扑及要求如下

注意: 在完成要求时,默认区域内IGP搭建完成,IBGP和EBGP的对等体关系建立完成

结果演示如下

IBGP内部搭建:使用OSPF

IBGP与EBGP对等体建立

要求一:PreVal策略

PV属性默认值为0,规则是:越大越优选,所以要将R4上的192.168.10.0/24网段的值改大

使用路由策略抓取流量并修改其值

复制代码
ip ip-prefix pv index 10 permit 192.168.10.0 24 greater-equal 24 less-equal 24---抓流量

修改pv值大小(比0大即可)

复制代码
  peer 24.0.0.2 route-policy pv import ---调用(入方向上)

要求二:AS_Path策略

该属性默认为越小越优选

可以在R2上添加AS_Path 或者 将R3上的该属性变为空列表

调用

复制代码
  peer 34.0.0.4 route-policy as export

要求三:

MED属性默认值为空,且越小越优选,必须是两个具体数值才可以比较,因此在R2和R3上修改

将R3上的值修改的比R2小即可

要求四和要求五:

默认值为100,越大越优选。在R1上修改

复制代码
ip ip-prefix LP permit 192.168.1.0 24 greater-equal 24 less-equal 24
route-policy LP permit node 10
if-match ip-prefix LP
apply local-preference 200	
route-policy LP permit node 20
bgp 123
peer 2.2.2.2 route-policy LP import

ip ip-prefix LP permit 192.168.1.0 24 greater-equal 24 less-equal 24
route-policy LP permit node 10
if-match ip-prefix LP
apply local-preference 200	
route-policy LP permit node 20
bgp 123
peer 2.2.2.2 route-policy LP import

要求六:

在R1上修改最大路由条目为2

复制代码
  maximum load-balancing ibgp 2

要求七:

打上路径标签进行过滤

复制代码
ip as-path-filter 1 deny ^$
ip as-path-filter 1 permit .*
bgp 123
peer 15.0.0.5 as-path-filter 1 export 

要求八:

开启社团属性为no-export,不向EBGP对等体传递

复制代码
ip ip-prefix com permit 192.168.3.0 24 greater-equal 24 less-equal 24

route-policy com permit node 10
if-match ip-prefix com
apply community no-export
route-policy com permit node 20

bgp 123
peer 24.0.0.2 advertise-community
peer 34.0.0.3 advertise-community
peer 24.0.0.2 route-policy com export 
peer 34.0.0.3 route-policy com export

在R2.R3上开启社团属性

复制代码
peer 1.1.1.1 advertise-community

其他要求已在进行路径属性选择前完成

相关推荐
Lucas. Wáng3 小时前
Linux网络编程之网络套接字
linux·服务器·网络
进击的荆棘3 小时前
Linux网络——Socket编程TCP
linux·运维·服务器·网络·tcp/ip
沫璃染墨5 小时前
从零入门计算机网络系列(二十六):IPv4分片机制详解——从MTU与MSS到报文分片与重组
运维·服务器·网络·网络协议·tcp/ip·ip
宝哥网络砖家17 小时前
软路由品牌推荐先看设备站在哪一层
网络·软路由·routeros
时间的拾荒人17 小时前
Linux 系统命令与网络、磁盘、日志监控(下篇):性能原理与优化
linux·运维·网络
nice_lcj52020 小时前
【从零理解计算机网络 · 13】DNS 解析全流程:域名怎么变成 IP,慢在哪
网络·计算机网络·面试·dns·域名解析·cname·ttl
张张123y1 天前
个人助手型 Agent 的六个工程细节:Hermes 与 OpenClaw 的审批、委派、上下文与调度
网络·人工智能·开源·后端开发·ai agent
nice_lcj5201 天前
【从零理解计算机网络 · 15】完整串联:一次请求的全旅程,以及那道经典面试题
网络·计算机网络·http·面试·tcp·总结·网络排查
光电笑映2 天前
TCP 为什么可靠?从三次握手、滑动窗口到拥塞控制全面拆解(下)
linux·网络·网络协议·tcp
如夏倾城2 天前
入侵检测系统(IDS)原理、部署模式与 IPS/防火墙对比
大数据·网络·人工智能·网络安全·云原生·架构·kubernetes