华为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

相关文章

Python中随机休眠技术原理与应用详解

《Python中随机休眠技术原理与应用详解》在编程中,让程序暂停执行特定时间是常见需求,当需要引入不确定性时,随机休眠就成为关键技巧,下面我们就来看看Python中随机休眠技术的具体实现与应用吧... 目录引言一、实现原理与基础方法1.1 核心函数解析1.2 基础实现模板1.3 整数版实现二、典型应用场景2

Python Dash框架在数据可视化仪表板中的应用与实践记录

《PythonDash框架在数据可视化仪表板中的应用与实践记录》Python的PlotlyDash库提供了一种简便且强大的方式来构建和展示互动式数据仪表板,本篇文章将深入探讨如何使用Dash设计一... 目录python Dash框架在数据可视化仪表板中的应用与实践1. 什么是Plotly Dash?1.1

Android Kotlin 高阶函数详解及其在协程中的应用小结

《AndroidKotlin高阶函数详解及其在协程中的应用小结》高阶函数是Kotlin中的一个重要特性,它能够将函数作为一等公民(First-ClassCitizen),使得代码更加简洁、灵活和可... 目录1. 引言2. 什么是高阶函数?3. 高阶函数的基础用法3.1 传递函数作为参数3.2 Lambda

Java 中实现异步的多种方式

《Java中实现异步的多种方式》文章介绍了Java中实现异步处理的几种常见方式,每种方式都有其特点和适用场景,通过选择合适的异步处理方式,可以提高程序的性能和可维护性,感兴趣的朋友一起看看吧... 目录1. 线程池(ExecutorService)2. CompletableFuture3. ForkJoi

mss32.dll文件丢失怎么办? 电脑提示mss32.dll丢失的多种修复方法

《mss32.dll文件丢失怎么办?电脑提示mss32.dll丢失的多种修复方法》最近,很多电脑用户可能遇到了mss32.dll文件丢失的问题,导致一些应用程序无法正常启动,那么,如何修复这个问题呢... 在电脑常年累月的使用过程中,偶尔会遇到一些问题令人头疼。像是某个程序尝试运行时,系统突然弹出一个错误提

Java中&和&&以及|和||的区别、应用场景和代码示例

《Java中&和&&以及|和||的区别、应用场景和代码示例》:本文主要介绍Java中的逻辑运算符&、&&、|和||的区别,包括它们在布尔和整数类型上的应用,文中通过代码介绍的非常详细,需要的朋友可... 目录前言1. & 和 &&代码示例2. | 和 ||代码示例3. 为什么要使用 & 和 | 而不是总是使

Python循环缓冲区的应用详解

《Python循环缓冲区的应用详解》循环缓冲区是一个线性缓冲区,逻辑上被视为一个循环的结构,本文主要为大家介绍了Python中循环缓冲区的相关应用,有兴趣的小伙伴可以了解一下... 目录什么是循环缓冲区循环缓冲区的结构python中的循环缓冲区实现运行循环缓冲区循环缓冲区的优势应用案例Python中的实现库

C++字符串提取和分割的多种方法

《C++字符串提取和分割的多种方法》在C++编程中,字符串处理是一个常见的任务,尤其是在需要从字符串中提取特定数据时,本文将详细探讨如何使用C++标准库中的工具来提取和分割字符串,并分析不同方法的适用... 目录1. 字符串提取的基本方法1.1 使用 std::istringstream 和 >> 操作符示

SpringBoot整合MybatisPlus的基本应用指南

《SpringBoot整合MybatisPlus的基本应用指南》MyBatis-Plus,简称MP,是一个MyBatis的增强工具,在MyBatis的基础上只做增强不做改变,下面小编就来和大家介绍一下... 目录一、MyBATisPlus简介二、SpringBoot整合MybatisPlus1、创建数据库和

浅析CSS 中z - index属性的作用及在什么情况下会失效

《浅析CSS中z-index属性的作用及在什么情况下会失效》z-index属性用于控制元素的堆叠顺序,值越大,元素越显示在上层,它需要元素具有定位属性(如relative、absolute、fi... 目录1. z-index 属性的作用2. z-index 失效的情况2.1 元素没有定位属性2.2 元素处