news 2026/6/19 16:43:07

BGP策略实验

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
BGP策略实验

1.配置ip,路由,broadcast

[r1]int g 0/0/0 [r1-GigabitEthernet0/0/0]ip add 12.0.0.1 24 [r1-GigabitEthernet0/0/0]int g 0/0/1 [r1-GigabitEthernet0/0/1]ip add 13.0.0.1 24 [r1-GigabitEthernet0/0/1]int g 0/0/2 [r1-GigabitEthernet0/0/2]ip add 15.0.0.1 24 [r1-GigabitEthernet0/0/2]q [r1]int l 0 [r1-LoopBack0]ip add 1.1.1.1 32 [r1-LoopBack0]int l 1 [r1-LoopBack1]ip add 192.168.100.1 24 [r1-LoopBack1]ospf network-type broadcast [r2]int g 0/0/0 [r2-GigabitEthernet0/0/0]ip add 24.0.0.2 24 [r2-GigabitEthernet0/0/0]int g 0/0/1 [r2-GigabitEthernet0/0/1]ip add 12.0.0.2 24 [r2-GigabitEthernet0/0/1]int l 0 [r2-LoopBack0]ip add 2.2.2.2 32 [r2-LoopBack0]int l 1 [r2-LoopBack1]ip add 192.168.20.1 24 [r2-LoopBack1]ospf network-type broadcast [r3]int g 0/0/0 [r3-GigabitEthernet0/0/0]ip add 34.0.0.3 24 [r3-GigabitEthernet0/0/0]int g 0/0/1 [r3-GigabitEthernet0/0/1]ip add 13.0.0.3 24 [r3-GigabitEthernet0/0/1]int l 0 [r3-LoopBack0]ip add 3.3.3.3 32 [r3-LoopBack0]int l 1 [r3-LoopBack1]ip add 192.168.30.1 24 [r3-LoopBack1]ospf network-type broadcast [r4]int g 0/0/0 [r4-GigabitEthernet0/0/0]ip add 24.0.0.4 24 [r4-GigabitEthernet0/0/0]int g 0/0/1 [r4-GigabitEthernet0/0/1]ip add 34.0.0.4 24 [r4-GigabitEthernet0/0/1]int l 0 [r4-LoopBack0]ip add 192.168.1.1 24 [r4-LoopBack0]int l 1 [r4-LoopBack1]ip add 192.168.2.1 24 [r4-LoopBack1]int l 2 [r4-LoopBack2]ip add 192.168.3.1 24 [r5]int g 0/0/0 [r5-GigabitEthernet0/0/0]ip add 15.0.0.5 24 [r5-GigabitEthernet0/0/0]int l 0 [r5-LoopBack0]ip add 192.168.10.1 24 [r5-LoopBack0]int l 1 [r5-LoopBack1]ip add 192.168.11.1 24 [r5-LoopBack1]int l 2 [r5-LoopBack2]ip add 192.168.12.1 24

2.AS 123 配置ospf

[r1]ospf 1 router-id 1.1.1.1 [r1-ospf-1]area 0 [r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0 [r1-ospf-1-area-0.0.0.0]network 192.168.100.1 0.0.0.0 [r1-ospf-1-area-0.0.0.0]network 12.0.0.1 0.0.0.0 [r1-ospf-1-area-0.0.0.0]network 13.0.0.1 0.0.0.0 [r2]ospf 1 router-id 2.2.2.2 [r2-ospf-1]area 0 [r2-ospf-1-area-0.0.0.0]network 12.0.0.2 0.0.0.0 [r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [r2-ospf-1-area-0.0.0.0]network 192.168.20.1 0.0.0.0 [r3]ospf 1 router-id 3.3.3.3 [r3-ospf-1]area 0 [r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [r3-ospf-1-area-0.0.0.0]network 192.168.30.1 0.0.0.0 [r3-ospf-1-area-0.0.0.0]network 13.0.0.3 0.0.0.0

3.配置bgp

[r1]bgp 123 [r1-bgp]route-select [r1-bgp]router-id 1.1.1.1 [r1-bgp]peer 15.0.0.5 as-number 500 [r1-bgp]peer 2.2.2.2 as-number 123 [r1-bgp]peer 2.2.2.2 connect-interface LoopBack 0 [r1-bgp]peer 2.2.2.2 next-hop-local [r1-bgp]peer 3.3.3.3 as-number 123 [r1-bgp]peer 3.3.3.3 connect-interface LoopBack 0 [r1-bgp]peer 3.3.3.3 next-hop-local [r2]bgp 123 [r2-bgp]router-id 2.2.2.2 [r2-bgp]peer 24.0.0.4 as-number 400 [r2-bgp]peer 1.1.1.1 as-number 123 [r2-bgp]peer 1.1.1.1 connect-interface LoopBack 0 [r2-bgp]peer 1.1.1.1 next-hop-local [r3]bgp 123 [r3-bgp]router-id 3.3.3.3 [r3-bgp]peer 34.0.0.4 as-number 400 [r3-bgp]peer 1.1.1.1 as-number 123 [r3-bgp]peer 1.1.1.1 connect-interface LoopBack 0 [r3-bgp]peer 1.1.1.1 next-hop-local [r4]bgp 400 [r4-bgp]router-id 4.4.4.4 [r4-bgp]peer 24.0.0.2 as-number 123 [r4-bgp]peer 34.0.0.3 as-number 123 [r5]bgp 500 [r5-bgp]router-id 5.5.5.5 [r5-bgp]peer 15.0.0.1 as-number 123 [r1]bgp 123 [r1-bgp]network 192.168.20.0 24 [r1-bgp]network 192.168.30.0 24 [r1-bgp]network 192.168.100.0 24 [r2]bgp 123 [r2-bgp]network 192.168.20.0 24 [r2-bgp]network 192.168.30.0 24 [r2-bgp]network 192.168.100.0 24 [r3]bgp 123 [r3-bgp]network 192.168.20.0 24 [r3-bgp]network 192.168.30.0 24 [r3-bgp]network 192.168.100.0 24

4.使用Preval策略

[r4]ip ip-prefix aa permit 192.168.10.0 24 [r4]route-policy aa permit node 10 Info: New Sequence of this List. [r4-route-policy]if-match ip-prefix aa [r4-route-policy]apply preferred-value 100 [r4-route-policy]q [r4]route-policy aa permit node 20 Info: New Sequence of this List. [r4-route-policy]q [r4]bgp 400 [r4-bgp]peer 24.0.0.2 route-policy aa import

5.使用As_Path策略

[r4]ip ip-prefix bb permit 192.168.11.0 24 [r4]route-policy aa permit node 15 Info: New Sequence of this List. [r4-route-policy]if-match ip-prefix bb [r4-route-policy]apply as-path 123 123 500 overwrite

6.配置MED策略

[r2]ip ip-prefix aa permit 192.168.12.0 24 [r2]route-policy aa permit node 10 Info: New Sequence of this List. [r2-route-policy]if-match ip-prefix aa [r2-route-policy]apply cost 200 [r2-route-policy]q [r2]route-policy aa permit node 20 Info: New Sequence of this List. [r2-route-policy]q [r2]bgp 123 [r2-bgp]peer 24.0.0.4 route-policy aa export [r3]ip ip-prefix aa permit 192.168.12.0 24 [r3]route-policy aa permit node 10 Info: New Sequence of this List. [r3-route-policy]if-match ip-prefix aa [r3-route-policy]apply cost 20 [r3-route-policy]q [r3]route-policy aa permit node 20 Info: New Sequence of this List. [r3-route-policy]q [r3]bgp 123 [r3-bgp]peer 34.0.0.4 route-policy aa export

7.使用Local Preference策略

[r1]ip ip-prefix aa permit 192.168.1.0 24 [r1]ip ip-prefix bb permit 192.168.2.0 24 [r1]route-policy aa permit node 10 Info: New Sequence of this List. [r1-route-policy]if-match ip-prefix aa [r1-route-policy]apply local-preference 200 [r1-route-policy]q [r1]route-policy aa permit node 20 Info: New Sequence of this List. [r1-route-policy]q [r1]route-policy bb permit node 10 Info: New Sequence of this List. [r1-route-policy]if-match ip-prefix bb [r1-route-policy]apply local-preference 200 [r1-route-policy]q [r1]route-policy bb permit node 20 Info: New Sequence of this List. [r1-route-policy]q [r1]bgp 123 [r1-bgp]peer 2.2.2.2 route-policy aa import [r1-bgp]peer 3.3.3.3 route-policy bb import

8.配置负载均衡

[r1]bgp 123 [r1-bgp]maximum load-balancing 2 [r5]ip as-path-filter 1 deny ^123$ [r5]ip as-path-filter 1 permit .* [r5]bgp 500 [r5-bgp]peer 15.0.0.1 as-path-filter 1 import [r1]ip ip-prefix cc permit 192.168.3.0 24 [r1]route-policy aa permit node 15 Info: New Sequence of this List. [r1-route-policy]if-match ip-prefix cc [r1-route-policy]apply community no-export [r1-route-policy]q [r1]route-policy bb permit node 15 Info: New Sequence of this List. [r1-route-policy]if-match ip-prefix cc [r1-route-policy]apply community no-export
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/7 5:24:47

STC8单片机PWM驱动LED呼吸灯:从寄存器配置到代码实现的保姆级教程

STC8单片机PWM驱动LED呼吸灯:从寄存器配置到代码实现的保姆级教程 第一次看到LED呼吸灯效果时,那种柔和渐变的明暗变化总让人着迷。这种效果背后其实隐藏着单片机PWM技术的精妙运用。对于STC8系列单片机来说,它的增强型PWM模块为LED亮度控制提…

作者头像 李华
网站建设 2026/6/6 2:46:32

openclaw添加与更换服务商模型

一、添加大模型 目前我电脑上配置的服务商为智谱,现在想添加deepseek模型 deepseek官方的方法慎用 会改变原来的配置,变为默认的模型 目前还是使用修改openclaw.json等文件方便 主要修改的地方有"agents"模块、"models"模块、&qu…

作者头像 李华
网站建设 2026/6/6 2:42:06

数字孪生技术演进与工业4.0应用实践

1. 数字孪生技术演进与核心架构2002年,Michael Grieves在密歇根大学首次提出数字孪生概念时,可能没想到这项技术会在20年后成为工业4.0的核心支柱。数字孪生的本质是通过数据驱动的方式,在虚拟空间构建物理实体的动态镜像。这个镜像不是简单的…

作者头像 李华
网站建设 2026/6/6 2:41:06

OBS Virtual Cam 完全指南:从基础安装到高级应用

OBS Virtual Cam 完全指南:从基础安装到高级应用 【免费下载链接】obs-virtual-cam obs-studio plugin to simulate a directshow webcam 项目地址: https://gitcode.com/gh_mirrors/ob/obs-virtual-cam OBS Virtual Cam 是一款专为 OBS Studio 设计的插件&a…

作者头像 李华