华为路由策略配置

一、AS_Path过滤

要求:

AR1 与AR2、AR2与AR3之间建立EBGP连接

AS10 的设备和AS30的设备无法相互通信

1. 启动设备

2. 配置IP地址

3. 配置路由器的EBGP对等体连接,引入直连路由

AR1bgp 10

AR1-bgprouter-id 1.1.1.1

AR1-bgppeer 200.1.2.2 as-number 20

AR1-bgpimport-route direct

AR2bgp 20

AR2-bgprouter-id 2.2.2.2

AR2-bgppeer 200.1.2.1 as-number 10

AR2-bgppeer 200.1.3.2 as-number 30

AR2-bgpimport-route direct

AR3bgp 30

AR3-bgprouter-id 3.3.3.3

AR3-bgppeer 200.1.3.1 as-number 20

AR3-bgpimport-route direct

验证:

查看BGP路由表

AR2 **:**display bgp routing-table

AR1 **:**display bgp routing-table

AR3 **:**display bgp routing-table

可以看到AR2发布自己引入的直连路由,向AR3发布了AS10引入的直连路由,向AR1发布了AS30引入的直连路由

pc1 和pc2可以通信

4. 配置AS_Path过滤

AR2ip as-path-filter path-filter1 deny 30

AR2ip as-path-filter path-filter1 permit .*

AR2ip as-path-filter path-filter2 deny 10

AR2ip as-path-filter path-filter2 permit .*

5. 应用AS_Path过滤

AR2bgp 20

AR2-bgppeer 200.1.2.1 as-path-filter path-filter1 export

AR2-bgppeer 200.1.3.2 as-path-filter path-filter2 export

验证:

pc1 和pc2不能通信

二、OSPF接收和发布路由过滤

要求:

OSPF 网络只能访问172.1.17.0/24、172.1.18.0/24和172.1.19.0/24三个网段的网络,AR3连接的网络只能访问172.1.18.0/24网段的网络

1. 启动设备

2. 配置IP地址

3. 配置OSPF

AR1ospf

AR1-ospf-1area 0

AR1-ospf-1-area-0.0.0.0network 192.168.1.0 0.0.0.255

AR2ospf

AR2-ospf-1area 0

AR2-ospf-1-area-0.0.0.0network 192.168.1.0 0.0.0.255

AR2-ospf-1-area-0.0.0.0network 192.168.2.0 0.0.0.255

AR2-ospf-1-area-0.0.0.0network 192.168.3.0 0.0.0.255

AR3ospf

AR3-ospf-1area 0

AR3-ospf-1-area-0.0.0.0network 192.168.2.0 0.0.0.255

AR4ospf

AR4-ospf-1area 0

AR4-ospf-1-area-0.0.0.0network 192.168.3.0 0.0.0.255

4. 在AR1上配置5条静态路由,并引入OSPF协议(5条静态路由为黑洞静态路由)

AR1ip route-static 172.1.16.0 24 NULL 0

AR1ip route-static 172.1.17.0 24 NULL 0

AR1ip route-static 172.1.18.0 24 NULL 0

AR1ip route-static 172.1.19.0 24 NULL 0

AR1ip route-static 172.1.20.0 24 NULL 0

AR1ospf

AR1-ospf-1import-route static

验证:

使用display ip routing-table在每台路由器上查看路由表,可以看到OSPF已经成功引入了上面的5条静态路由

5. 配置路由发布过滤策略(在AR1上配置IP地址前缀列表a2b,仅允许172.1.17.0/24、172.1.18.0/24和172.1.19.0/24三个网段的路由通过)

AR1ip ip-prefix a2b index 10 permit 172.1.17.0 24

AR1ip ip-prefix a2b index 20 permit 172.1.18.0 24

AR1ip ip-prefix a2b index 30 permit 172.1.19.0 24

调用前面创建的IP地址前缀列表a2b对发布的静态路由进行过滤

AR1ospf

AR1-ospf-1filter-policy ip-prefix a2b export static

验证:

使用display ip routing-table在除AR1的每台路由器上查看路由表,可以看到每台路由器仅接收到列表a2b中定义的3条路由

6. 配置路由器接收过滤策略(在AR3上配置一个IP地址前缀列表in,仅允许接收172.1.18.0/24的路由)

AR3ip ip-prefix in index 10 permit 172.1.18.0 24

AR3ospf

AR3-ospf-1filter-policy ip-prefix in import

验证:

使用display ip routing-table在AR3路由器上查看路由表,可以看到AR3路由器仅接收到列表in中定义的1条路由

相关推荐
程序员-Benothing6 小时前
Vim编辑器从入门到精通:模式、快捷键、配置、插件
linux·运维·服务器
通信大模型6 小时前
IEEE TCCN | 面向低空经济网络的Agentic AI驱动多无人机轨迹优化
网络·人工智能·无人机
m0_646429976 小时前
Docker 完整核心知识点总结(超通俗易懂版)
运维·docker·容器
wdfk_prog6 小时前
LWIP教程 09:从 `tcp_slowtmr()` 到 Fast Retransmit——TCP 超时重传与重复 ACK
服务器·网络·数据库·网络协议·tcp/ip
亚川楼宇自控系统数据中心厂家6 小时前
IBMS 集成管理系统:如何打通楼宇自控实现建筑一体化管控
运维
15Moonlight6 小时前
Linux网络(02):Socket 编程 UDP
linux·网络·udp
迪康Defender6 小时前
终端安全审批体系设计:如何平衡安全管控与业务连续性
运维·服务器·安全·运维开发·学习方法·业界资讯·远程工作
盛世宏博智慧档案7 小时前
一文读懂 PoE+Modbus TCP 温湿度传感器布线规范与故障排查
网络·网络协议·tcp/ip
liulilittle7 小时前
Linux 下 select 测试函数
linux·服务器·网络·数据库·c++·select·c