华为bgp之多级RR及团体属性、正则表达式多种应用案例

本文主要是介绍华为bgp之多级RR及团体属性、正则表达式多种应用案例,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在这里插入图片描述

1、实现总部和分部的oa、财务网段互通
2、分部之间oa也能互通
3、分部之间不能互通财务

主要用到bgp自定义团体属性、一级二级RR配置、bgp正则表达式匹配规则

R1

router id 1.1.1.1 //配全局地址池,又可以给ospf用也可以给bgp用

interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
ospf enable 1 area 0.0.0.0

interface GigabitEthernet0/0/1
ip address 10.0.11.1 255.255.255.0

interface GigabitEthernet0/0/2

interface LoopBack0
ip address 1.1.1.1 255.255.255.255
ospf enable 1 area 0.0.0.0

bgp 65100
peer 10.0.11.2 as-number 65001
peer 10.0.11.2 password cipher admin
peer 10.0.11.2 valid-ttl-hops 255 //开启ttl最大限制,为了安全
group ibgp internal //igp设备太多了,用组省事
peer ibgp connect-interface LoopBack0
peer 2.2.2.2 as-number 65100
peer 2.2.2.2 group ibgp
peer 4.4.4.4 as-number 65100
peer 4.4.4.4 group ibgp

ipv4-family unicast
undo synchronization
peer 10.0.11.2 enable
peer 10.0.11.2 route-policy finance export //发去分公司路由进行策略匹配
peer 10.0.11.2 advertise-community //开启传递团队属性功能
peer ibgp enable
peer ibgp next-hop-local
peer ibgp advertise-community //开启传递团队属性功能
peer 2.2.2.2 enable
peer 2.2.2.2 group ibgp
peer 4.4.4.4 enable
peer 4.4.4.4 group ibgp

ospf 1
area 0.0.0.0

route-policy finance permit node 10 //先检测调用匹配到的oa包策略并放行
if-match community-filter oa

route-policy finance deny node 20 //再匹配财务的策略
if-match as-path-filter finance

route-policy finance permit node 30 //其它没有匹配的放行

ip as-path-filter finance permit 65002$ //把起源结尾标签bgp号是65002的财务给正则出来

ip community-filter basic oa permit 65002:2 //把带有这个标签的oa办公包给匹配出来

R2

router id 2.2.2.2

interface GigabitEthernet0/0/0
ip address 10.0.23.2 255.255.255.0
ospf enable 1 area 0.0.0.0

interface GigabitEthernet0/0/1
ip address 10.0.12.2 255.255.255.0
ospf enable 1 area 0.0.0.0

interface LoopBack0
ip address 2.2.2.2 255.255.255.255
ospf enable 1 area 0.0.0.0

bgp 65100
group ibgp internal
peer ibgp connect-interface LoopBack0
peer 1.1.1.1 as-number 65100
peer 1.1.1.1 group ibgp
peer 3.3.3.3 as-number 65100
peer 3.3.3.3 group ibgp
peer 4.4.4.4 as-number 65100
peer 4.4.4.4 group ibgp
peer 5.5.5.5 as-number 65100
peer 5.5.5.5 group ibgp

ipv4-family unicast
undo synchronization
reflector cluster-id 24.24.24.24 //用于标识二级RR
peer ibgp enable
peer ibgp reflect-client //把学到的路由RR给所有的对等体
peer ibgp advertise-community //所有的IBGP对开启团体属性传递
peer 1.1.1.1 enable
peer 1.1.1.1 group ibgp
peer 3.3.3.3 enable
peer 3.3.3.3 group ibgp
peer 4.4.4.4 enable
peer 4.4.4.4 group ibgp
peer 5.5.5.5 enable
peer 5.5.5.5 group ibgp

ospf 1
area 0.0.0.0

R3

router id 3.3.3.3

interface GigabitEthernet0/0/0
ip address 10.0.23.3 255.255.255.0
ospf enable 1 area 0.0.0.0

interface GigabitEthernet0/0/1
ip address 10.0.34.3 255.255.255.0
ospf enable 1 area 0.0.0.0

interface GigabitEthernet0/0/2
ip address 10.0.33.3 255.255.255.0

interface LoopBack0
ip address 3.3.3.3 255.255.255.255
ospf enable 1 area 0.0.0.0

bgp 65100
peer 10.0.33.1 as-number 65003
peer 10.0.33.1 password cipher admin
peer 10.0.33.1 valid-ttl-hops 255
group ibgp internal
peer ibgp connect-interface LoopBack0
peer 2.2.2.2 as-number 65100
peer 2.2.2.2 group ibgp
peer 4.4.4.4 as-number 65100
peer 4.4.4.4 group ibgp

ipv4-family unicast
undo synchronization
peer 10.0.33.1 enable
peer 10.0.33.1 advertise-community //开启bgp团体属性传递功能
peer ibgp enable
peer ibgp reflect-client
peer ibgp next-hop-local
peer ibgp advertise-community //开启bgp团体属性传递功能
peer 2.2.2.2 enable
peer 2.2.2.2 group ibgp
peer 4.4.4.4 enable
peer 4.4.4.4 group ibgp

ospf 1
area 0.0.0.0

R4

router id 4.4.4.4

interface GigabitEthernet0/0/0
ip address 10.0.34.4 255.255.255.0
ospf enable 1 area 0.0.0.0

interface GigabitEthernet0/0/1
ip address 10.0.45.4 255.255.255.0
ospf enable 1 area 0.0.0.0

interface LoopBack0
ip address 4.4.4.4 255.255.255.255
ospf enable 1 area 0.0.0.0

bgp 65100
group ibgp internal
peer ibgp connect-interface LoopBack0
peer 1.1.1.1 as-number 65100
peer 1.1.1.1 group ibgp
peer 2.2.2.2 as-number 65100
peer 2.2.2.2 group ibgp
peer 3.3.3.3 as-number 65100
peer 3.3.3.3 group ibgp
peer 5.5.5.5 as-number 65100
peer 5.5.5.5 group ibgp

ipv4-family unicast
undo synchronization
reflector cluster-id 24.24.24.24
peer ibgp enable
peer ibgp reflect-client
peer ibgp advertise-community
peer 1.1.1.1 enable
peer 1.1.1.1 group ibgp
peer 2.2.2.2 enable
peer 2.2.2.2 group ibgp
peer 3.3.3.3 enable
peer 3.3.3.3 group ibgp
peer 5.5.5.5 enable
peer 5.5.5.5 group ibgp

ospf 1
area 0.0.0.0

R5

router id 5.5.5.5

interface GigabitEthernet0/0/0
ip address 10.0.45.5 255.255.255.0
ospf enable 1 area 0.0.0.0

interface GigabitEthernet0/0/1
ip address 10.0.52.5 255.255.255.0

interface LoopBack0
ip address 5.5.5.5 255.255.255.255
ospf enable 1 area 0.0.0.0

bgp 65100
peer 10.0.52.2 as-number 65002
peer 10.0.52.2 password cipher % % ;^^:7p’wdXiw4.Pc;G9+<*7i% %
peer 10.0.52.2 valid-ttl-hops 255
group ibgp internal
peer ibgp connect-interface LoopBack0
peer 2.2.2.2 as-number 65100
peer 2.2.2.2 group ibgp
peer 4.4.4.4 as-number 65100
peer 4.4.4.4 group ibgp

ipv4-family unicast
undo synchronization
peer 10.0.52.2 enable
peer 10.0.52.2 route-policy finance export
peer 10.0.52.2 advertise-community
peer ibgp enable
peer ibgp next-hop-local
peer ibgp advertise-community
peer 2.2.2.2 enable
peer 2.2.2.2 group ibgp
peer 4.4.4.4 enable
peer 4.4.4.4 group ibgp

ospf 1
area 0.0.0.0

route-policy finance permit node 10
if-match community-filter oa

route-policy finance deny node 20
if-match as-path-filter finance

route-policy finance permit node 30

ip as-path-filter finance permit 65001$

ip community-filter basic oa permit 65001:1

sw1

interface Vlanif1
ip address 10.0.11.2 255.255.255.0

interface GigabitEthernet0/0/1
port link-type access

interface LoopBack0
ip address 11.1.1.1 255.255.255.0

interface LoopBack1
ip address 21.1.1.1 255.255.255.0

bgp 65001
peer 10.0.11.1 as-number 65100
peer 10.0.11.1 password cipher admin

ipv4-family unicast
undo synchronization
network 11.0.0.0
network 11.1.1.0 255.255.255.0
network 21.1.1.0 255.255.255.0
peer 10.0.11.1 enable
peer 10.0.11.1 route-policy attr export //发出去对端时调用策略
peer 10.0.11.1 advertise-community //开启bgp团体属性传递功能

route-policy attr permit node 10 //调用匹配出的oa网段
if-match ip-prefix com
apply community 65001:1 //打上标签

route-policy attr permit node 20 //其它放行

ip ip-prefix com index 10 permit 11.1.1.0 24 //匹配出oa的数据网段

SW2

interface Vlanif1
ip address 10.0.52.2 255.255.255.0

interface MEth0/0/1

interface GigabitEthernet0/0/1
port link-type access

interface LoopBack0
ip address 22.1.1.1 255.255.255.0

interface LoopBack1
ip address 32.1.1.1 255.255.255.0

bgp 65002
peer 10.0.52.5 as-number 65100
peer 10.0.52.5 password cipher admin

ipv4-family unicast
undo synchronization
network 22.1.1.0 255.255.255.0
network 32.1.1.0 255.255.255.0
peer 10.0.52.5 enable
peer 10.0.52.5 route-policy attr export
peer 10.0.52.5 advertise-community

route-policy attr permit node 10
if-match ip-prefix com
apply community 65002:2

route-policy attr permit node 20

ip ip-prefix com index 10 permit 22.1.1.0 24

SW3

interface Vlanif1
ip address 10.0.33.1 255.255.255.0

interface MEth0/0/1

interface GigabitEthernet0/0/1
port link-type access

interface LoopBack0
ip address 33.1.1.1 255.255.255.0

interface LoopBack1
ip address 43.1.1.1 255.255.255.0

bgp 65003
peer 10.0.33.3 as-number 65100
peer 10.0.33.3 password cipher Q`OT=C0XP2sPddVIN=17t&I#

ipv4-family unicast
undo synchronization
network 33.1.1.0 255.255.255.0
network 43.1.1.0 255.255.255.0
peer 10.0.33.3 enable
peer 10.0.33.3 route-policy attr export
peer 10.0.33.3 advertise-community

route-policy attr permit node 10
if-match ip-prefix com
apply community 65003:3

route-policy attr permit node 20

ip ip-prefix com index 10 permit 33.1.1.0 24

这篇关于华为bgp之多级RR及团体属性、正则表达式多种应用案例的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/575600

相关文章

CSS3中的字体及相关属性详解

《CSS3中的字体及相关属性详解》:本文主要介绍了CSS3中的字体及相关属性,详细内容请阅读本文,希望能对你有所帮助... 字体网页字体的三个来源:用户机器上安装的字体,放心使用。保存在第三方网站上的字体,例如Typekit和Google,可以link标签链接到你的页面上。保存在你自己Web服务器上的字

华为鸿蒙HarmonyOS 5.1官宣7月开启升级! 首批支持名单公布

《华为鸿蒙HarmonyOS5.1官宣7月开启升级!首批支持名单公布》在刚刚结束的华为Pura80系列及全场景新品发布会上,除了众多新品的发布,还有一个消息也点燃了所有鸿蒙用户的期待,那就是Ha... 在今日的华为 Pura 80 系列及全场景新品发布会上,华为宣布鸿蒙 HarmonyOS 5.1 将于 7

六个案例搞懂mysql间隙锁

《六个案例搞懂mysql间隙锁》MySQL中的间隙是指索引中两个索引键之间的空间,间隙锁用于防止范围查询期间的幻读,本文主要介绍了六个案例搞懂mysql间隙锁,具有一定的参考价值,感兴趣的可以了解一下... 目录概念解释间隙锁详解间隙锁触发条件间隙锁加锁规则案例演示案例一:唯一索引等值锁定存在的数据案例二:

Linux实现线程同步的多种方式汇总

《Linux实现线程同步的多种方式汇总》本文详细介绍了Linux下线程同步的多种方法,包括互斥锁、自旋锁、信号量以及它们的使用示例,通过这些同步机制,可以解决线程安全问题,防止资源竞争导致的错误,示例... 目录什么是线程同步?一、互斥锁(单人洗手间规则)适用场景:特点:二、条件变量(咖啡厅取餐系统)工作流

SpringBoot读取ZooKeeper(ZK)属性的方法实现

《SpringBoot读取ZooKeeper(ZK)属性的方法实现》本文主要介绍了SpringBoot读取ZooKeeper(ZK)属性的方法实现,强调使用@ConfigurationProperti... 目录1. 在配置文件中定义 ZK 属性application.propertiesapplicati

Java反射实现多属性去重与分组功能

《Java反射实现多属性去重与分组功能》在Java开发中,​​List是一种非常常用的数据结构,通常我们会遇到这样的问题:如何处理​​List​​​中的相同字段?无论是去重还是分组,合理的操作可以提高... 目录一、开发环境与基础组件准备1.环境配置:2. 代码结构说明:二、基础反射工具:BeanUtils

Python使用Tkinter打造一个完整的桌面应用

《Python使用Tkinter打造一个完整的桌面应用》在Python生态中,Tkinter就像一把瑞士军刀,它没有花哨的特效,却能快速搭建出实用的图形界面,作为Python自带的标准库,无需安装即可... 目录一、界面搭建:像搭积木一样组合控件二、菜单系统:给应用装上“控制中枢”三、事件驱动:让界面“活”

MySQL 表的内外连接案例详解

《MySQL表的内外连接案例详解》本文给大家介绍MySQL表的内外连接,结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录表的内外连接(重点)内连接外连接表的内外连接(重点)内连接内连接实际上就是利用where子句对两种表形成的笛卡儿积进行筛选,我

如何确定哪些软件是Mac系统自带的? Mac系统内置应用查看技巧

《如何确定哪些软件是Mac系统自带的?Mac系统内置应用查看技巧》如何确定哪些软件是Mac系统自带的?mac系统中有很多自带的应用,想要看看哪些是系统自带,该怎么查看呢?下面我们就来看看Mac系统内... 在MAC电脑上,可以使用以下方法来确定哪些软件是系统自带的:1.应用程序文件夹打开应用程序文件夹

Python函数返回多个值的多种方法小结

《Python函数返回多个值的多种方法小结》在Python中,函数通常用于封装一段代码,使其可以重复调用,有时,我们希望一个函数能够返回多个值,Python提供了几种不同的方法来实现这一点,需要的朋友... 目录一、使用元组(Tuple):二、使用列表(list)三、使用字典(Dictionary)四、 使