Lokve博客 - ensp
type: channel
link: http://blog.lokve.cn/index.php/tag/ensp/
items: ensp VLANIF三层通信实验
items: ensp RIPv2动态路由实验
items: ensp AR单臂路由实验

ensp VLANIF三层通信实验
type: item
date: 2025-11-24T16:31:00+08:00
description: 前言当一个企业组网当中，分配不同网段的同时，例如财务部想和技术部相互访问，但是两个部门网络VLAN和IP地址规划都不相同的情况下，需要相互访问通信，这个时候二层走不通的时候就可以走三层。本次实验则是模拟核心交换机，接入两台不同VLAN的PC电脑实现本地三层转发。实验需求实现不同VLAN和IP的两台PC电脑能相互访问。为极大模拟真实环境，则将使用DHCP自动下发IP地址。实验拓扑实验配置VLAN创建并放行 复制 <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]un in en Info: Information center is disabled. [Huawei]sys SW1 [SW1]vlan b 10 20 #分别创建vlan10 20 [SW1]int g 0/0/01 [SW1-GigabitEthernet0/0/1]p l a [SW1-GigabitEthernet0/0/1]p d v 10 [SW1-GigabitEthernet0/0/1]int g 0/0/2 [SW1-GigabitEthernet0/0/2]p l a [SW1-GigabitEthernet0/0/2]p d v 20 VLANIF配置 + 接口DHCP地址池 复制 [SW1]dhcp en [SW1]int vlan 10 [SW1-Vlanif10]ip add 172.16.1.1 24 [SW1-Vlanif10]dhcp select interface [SW1-Vlanif10]int vlan 20 [SW1-Vlanif20]ip add 172.16.2.1 24 [SW1-Vlanif20]dhcp select interface 两台PC设置IP获取方式为DHCP查看两台PC分别获取的IP地址PC1：172.16.1.254/24 PC2：172.16.2.254/24连通性测试PC1 Ping PC2通信

ensp RIPv2动态路由实验
type: item
date: 2025-11-24T11:30:48+08:00
description: 介绍RIPv2（Routing Information Protocol version 2）是基于距离向量算法的动态路由协议，采用UDP端口520进行通信，通过组播地址224.0.0.9发送更新报文。该协议以跳数为路径选择指标，最大有效值为15，通过30秒定期更新和180秒失效检测机制维护路由表，240秒后删除无效条目。实验拓扑RIPv2基础命令启用RIP进程 复制 system-view rip 1 # 创建进程ID=1 version 2 # 指定RIPv2 宣告直连网段 复制 network 192.168.1.0 # 宣告R1的直连网段 network 10.0.0.0 # 宣告R1-R2间网段 关闭自动汇总（关键） 复制 undo summary # 避免子网信息丢失 RIPv2高级命令接口级优化 复制 interface GigabitEthernet0/0/0 rip metricin 2 # 修改入站度量值 rip split-horizon # 启用水平分割 路由过滤 复制 acl 2000 # 创建ACL rule deny source 192.168.2.0 0.0.0.255 rip filter-policy 2000 export # 禁止发布特定网段 实验配置SW1配置 - VLAN放行 复制 <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysn [Huawei]sysname SW1 [SW1]un in en Info: Information center is disabled. [SW1]vlan batch 10 20 Info: This operation may take a few seconds. Please wait for a moment...done. [SW1]int g0/0/1 [SW1-GigabitEthernet0/0/1]port link-type trunk [SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all [SW1-GigabitEthernet0/0/1]q [SW1]int g0/0/2 [SW1-GigabitEthernet0/0/2]port link-type access [SW1-GigabitEthernet0/0/2]port default vlan 10 [SW1-GigabitEthernet0/0/2]q [SW1]int g0/0/3 [SW1-GigabitEthernet0/0/3]port link-type access [SW1-GigabitEthernet0/0/3]port default vlan 20 [SW1-GigabitEthernet0/0/3]q AR1配置 - 单臂路由配置 复制 <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname AR1 [AR1]un in en Info: Information center is disabled. [AR1]int g0/0/1.10 [AR1-GigabitEthernet0/0/1.10]dot1q termination vid 10 # 配置子接口对VLAN 10的802.1Q标签 [AR1-GigabitEthernet0/0/1.10]ip address 172.16.10.1 24 [AR1-GigabitEthernet0/0/1.10]arp broadcast enable 启用子接口的ARP广播功能 [AR1-GigabitEthernet0/0/1.10]q [AR1]int g0/0/1.20 [AR1-GigabitEthernet0/0/1.20]dot1q termination vid 20 # 配置子接口对VLAN 20的802.1Q标签 [AR1-GigabitEthernet0/0/1.20]ip address 172.16.20.1 24 [AR1-GigabitEthernet0/0/1.20]arp broadcast enable 启用子接口的ARP广播功能 [AR1-GigabitEthernet0/0/1.20]q AR1配置 - DHCP全局地址池配置 复制 [AR1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment…

ensp AR单臂路由实验
type: item
date: 2025-11-24T11:04:00+08:00
description: 介绍单臂路由（router-on-a-stick）是指在路由器的一个接口上通过配置子接口（或“逻辑接口”，并不存在真正物理接口）的方式，实现原来相互隔离的不同VLAN（虚拟局域网）之间的互联互通。路由器的物理接口可以被划分成多个逻辑接口，这些被划分后的逻辑接口被形象的称为子接口。值得注意的是这些逻辑子接口不能被单独的开启或关闭，也就是说，当物理接口被开启或关闭时，所有的该接口的子接口也随之被开启或关闭。实验拓扑操作步骤交换机端配置（VLAN划分与Trunk端口设置）路由器子接口创建与封装协议（Dot1Q）IP地址分配与路由配置代码实操SW1配置 - VLAN放行 复制 <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]un in en Info: Information center is disabled. [Huawei]sysname SW1 [SW1]vlan batch 10 20 Info: This operation may take a few seconds. Please wait for a moment...done. [SW1]int g0/0/1 [SW1-GigabitEthernet0/0/1]port link-type trunk [SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all [SW1-GigabitEthernet0/0/1]q [SW1]int g0/0/2 [SW1-GigabitEthernet0/0/2]port link-type access [SW1-GigabitEthernet0/0/2]port default vlan 10 [SW1-GigabitEthernet0/0/2]q [SW1]int g0/0/3 [SW1-GigabitEthernet0/0/3]port link-type access [SW1-GigabitEthernet0/0/3]port default vlan 20 [SW1-GigabitEthernet0/0/3]q AR1配置 - 单臂路由配置 复制 <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname AR1 [AR1]un in en Info: Information center is disabled. [AR1]int g0/0/1.10 [AR1-GigabitEthernet0/0/1.10]dot1q termination vid 10 # 配置子接口对VLAN 10的802.1Q标签 [AR1-GigabitEthernet0/0/1.10]ip address 172.16.10.1 24 [AR1-GigabitEthernet0/0/1.10]arp broadcast enable 启用子接口的ARP广播功能 [AR1-GigabitEthernet0/0/1.10]q [AR1]int g0/0/1.20 [AR1-GigabitEthernet0/0/1.20]dot1q termination vid 20 # 配置子接口对VLAN 20的802.1Q标签 [AR1-GigabitEthernet0/0/1.20]ip address 172.16.20.1 24 [AR1-GigabitEthernet0/0/1.20]arp broadcast enable 启用子接口的ARP广播功能 [AR1-GigabitEthernet0/0/1.20]q AR1配置 - DHCP全局地址池 复制 [AR1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [AR1]ip pool vlan10 [AR1-ip-pool-vlan10]network 172.16.10.0 mask 24 [AR1-ip-pool-vlan10]gateway-list 172.16.10.1 [AR1-ip-pool-vlan10]static-bind ip-address 172.16.10.10 mac-address 5489-9854-3DF0 # 静态绑定 [AR1-ip-pool-vlan10]dis this [V200R003C00] # ip pool vlan10 gateway-list 172.16.10.1 ne…