华为单臂路由 与 策略路由

单臂路由

概念:如图大纲LSW1是二层交换机不具备三层路由功能,并且连接着不同的vlan,并使每个vlan都可以与外网通信,那么就要用单臂路由技术,原理是将图中的AR1的ge0/0/0接口逻辑上分为多个子接口,分别对应不同的vlan的网关。

LSW1配置:

复制代码
vlan batch 10 20
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 20

AR1配置

复制代码
interface GigabitEthernet0/0/0.10
 dot1q termination vid 10    //将子接口作为vlan 10的网关
 ip address 192.168.1.1 255.255.255.0 
 arp broadcast enable        //启用arp广播功能,不启用vlan间无法通信
#
interface GigabitEthernet0/0/0.20
 dot1q termination vid 20
 ip address 192.168.2.1 255.255.255.0 
 arp broadcast enable

效果:从pc1中tracert 192.168.2.2

策略路由

原理:使用基于原地址或者目标地址策略转发数据到下一个接口,策略路由不会影响路由表,案例如图所示

全局启用ospf协议,正常情况下pc1访问pc2路径为pc1--->AR1--->AR3--->pc2,先通过在AR1上通过策略路由将路径改为pc1--->AR1--->AR2--->AR3--->pc2

无论是使用策略路由前,还是之后,AR1路由表中去往192.168.2.0/24,都是下图:

拓扑图

AR1不配置策略路由时 pc1 tracert 192.168.2.2

AR1配置策略路由时 pc1 tracert 192.168.2.2

AR1配置:

复制代码
interface GigabitEthernet0/0/0
 ip address 13.1.1.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 12.1.1.1 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 192.168.1.1 255.255.255.0 

ospf 1 router-id 1.1.1.1 
 area 0.0.0.0 
  network 12.1.1.0 0.0.0.255 
  network 13.1.1.0 0.0.0.255 
  network 192.168.1.0 0.0.0.255 


以下策略路由:

抓取流量:
acl number 3000  
 rule 5 permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255

定义流分类:
traffic classifier dingxiang operator or
 if-match acl 3000

定义流行为:
traffic behavior bdingxing
 redirect ip-nexthop 12.1.1.2

定义流策略
traffic policy pdingxiang
 classifier dingxiang behavior bdingxing

在接口启用策略:
interface GigabitEthernet0/0/2
 ip address 192.168.1.1 255.255.255.0 
 traffic-policy pdingxiang inbound

AR2配置:

复制代码
interface GigabitEthernet0/0/0
 ip address 12.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 23.1.1.1 255.255.255.0 

ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 12.1.1.0 0.0.0.255 
  network 23.1.1.0 0.0.0.255 

AR3配置:

复制代码
interface GigabitEthernet0/0/0
 ip address 13.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 23.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 192.168.2.1 255.255.255.0

ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 13.1.1.0 0.0.0.255 
  network 23.1.1.0 0.0.0.255 
  network 192.168.2.0 0.0.0.255
相关推荐
小绫网络安全3 分钟前
【每日一讲】学习网络安全的一些注意事项
网络·安全·web安全
画中有画24 分钟前
自动化脚本开发最佳实践
运维·自动化
星恒讯工业路由器2 小时前
5G LAN + Wi-Fi 6融合组网:工业路由器如何为柔性产线“剪掉辫子”
网络·5g·工业路由器·工业物联网·5g la·柔性产线·5g工业路由
OH_TPC2 小时前
【鸿蒙优选三方库】@ohos/mpchart:让 HarmonyOS 应用的数据可视化开箱即用
华为·信息可视化·harmonyos·鸿蒙
SamChan903 小时前
PDF翻译API的JWT签名鉴权与速率限制设计:安全实战指南
网络·安全·pdf
江南风月3 小时前
如何使用WGCLOUD实现智能运维
运维·zabbix·运维开发·prometheus
xiaoxiangsiyan3 小时前
HCIA 网络技术基础核心模块详解
运维·网络·网络协议·tcp/ip·运维开发·网络基础
AGCSDNl4 小时前
葛姓的来源
网络
MuMuMu12235 小时前
工业园区 VOCs 绿岛集中治理:越华环保集团项目技术方案与工程实践
大数据·运维
漫路在线6 小时前
无境红日靶场五 wp
网络·安全·web安全