华三交换机VLAN配置(基于接口划分)

一、前言

VLAN(Virtual Local Area Network,虚拟局域网)是将一个物理的LAN在逻辑上划分成多个广播域,一个VLAN就是一个子网,每个VLAN就是一个单独广播域,同一个VLAN可以直接二层通信,不同的VLAN间不能直接通信必须通过三层设备实现互相访问。

二、VLAN配置

组网拓扑

某企业网络采用 VLAN 技术实现部门间二层流量隔离,避免广播风暴并提升通信安全性。其中,部门 A 划分为 VLAN 100,使用 192.168.1.0/24 网段,终端网关为 192.168.1.1;部门 B 划分为 VLAN 200,使用 192.168.2.0/24 网段,终端网关为 192.168.2.1。基于端口的 VLAN 划分及VLAN 接口配置如下:

  • 同一 VLAN 内主机可实现二层互通,不同 VLAN 间主机二层隔离、三层互通;
  • 配置 Device A 作为部门 A 用户的网关,Device B 作为部门 B 用户的网关。

配置步骤

步骤 1 Device A 配置。

  1. 创建 VLAN 100,将接口加入 VLAN 100。

    [DeviceA] vlan 100
    [DeviceA-vlan100] port gigabitethernet 1/0/1
    [DeviceA-vlan100] quit

  2. 创建 Vlan-interface 100,配置VLANIF接口IP 地址。

    [DeviceA] interface Vlan-interface 100
    [DeviceA-Vlan-interface100] ip address 192.168.100.1 24
    [DeviceA-Vlan-interface100] quit

  3. 创建 VLAN 200,将接口加入 VLAN 200。

    [DeviceA] vlan 200
    [DeviceA-vlan200] port gigabitethernet 1/0/2
    [DeviceA-vlan200] quit

  4. 创建 Vlan-interface 200,配置VLANIF接口 IP 地址。

    [DeviceA] interface Vlan-interface 200
    [DeviceA-Vlan-interface200] ip address 192.168.200.2 24
    [DeviceA-Vlan-interface200] quit

  5. 互联Trunk链路类型配置,允许 VLAN 100 和 VLAN 200 的报文通过,取消VLAN 1 通过。

    [DeviceA] interface gigabitethernet 1/0/3
    [DeviceA-GigabitEthernet1/0/3] port link-type trunk
    [DeviceA-GigabitEthernet1/0/3] port trunk permit vlan 100 200
    [DeviceA-GigabitEthernet1/0/3] undo port trunk permit vlan 1
    [DeviceA-GigabitEthernet1/0/3] quit

步骤 2 Device B 配置。

  1. 创建 VLAN 100,将接口加入 VLAN 100。

    [DeviceB] vlan 100
    [DeviceB-vlan100] port gigabitethernet 1/0/1
    [DeviceB-vlan100] quit

  2. 创建 Vlan-interface 100,配置VLANIF接口 IP 地址。

    [DeviceB] interface Vlan-interface 100
    [DeviceB-Vlan-interface100] ip address 192.168.100.2 24
    [DeviceB-Vlan-interface100] quit

  3. 创建 VLAN 200,将接口加入 VLAN 200。

    [DeviceB] vlan 200
    [DeviceB-vlan200] port gigabitethernet 1/0/2
    [DeviceB-vlan200] quit

  4. 创建 Vlan-interface 200,配置VLANIF接口 IP 地址。

    [DeviceB] interface Vlan-interface 200
    [DeviceB-Vlan-interface200] ip address 192.168.200.1 24
    [DeviceB-Vlan-interface200] quit

  5. 互联Trunk链路类型配置,允许 VLAN 100 和 VLAN 200 的报文通过,取消VLAN 1 通过。

    [DeviceB] interface gigabitethernet 1/0/3
    [DeviceB-GigabitEthernet1/0/3] port link-type trunk
    [DeviceB-GigabitEthernet1/0/3] port trunk permit vlan 100 200
    [DeviceB-GigabitEthernet1/0/3] undo port trunk permit vlan 1
    [DeviceB-GigabitEthernet1/0/3] quit

步骤 3 验证配置结果。

查看 Device A 上 VLAN 100 和VLAN 200 的配置信息是否成功。

复制代码
[DeviceA] display vlan 100 

PC1和 PC3 互相能够 ping 通。查看 PC1 的 ARP 表有 PC3 的 IP 地址和 MAC地址对应的 ARP 表项。查看 PC3 的 ARP 表有 PC1 的 IP 地址和 MAC 地址对应的 ARP 表项。

#PC1 和 PC4 互相能够 ping 通。查看 PC1 的 ARP表中没有 PC4 的 ARP 表项。查看 PC4 的 ARP 表中也没有 PC1 的 ARP 表项。

相关推荐
Piko6147 小时前
H3C IRF2 堆叠实战:打造高可靠核心交换网络
运维·网络·笔记
茯苓gao10 小时前
嵌入式开发笔记:CANopen相关移位运算与通信协议术语详解
网络·嵌入式硬件·学习·信息与通信
万联WANFLOW10 小时前
SD-WAN 控制平面高可用怎么做?SDWAN 控制器挂了,全网会发生什么
运维·网络·分布式·架构
酱学编程11 小时前
【从零到一实现一个 AI Agent 框架 · 第四篇】04. 任务规划:拆解复杂目标 -
服务器·网络·数据库·人工智能
风行南方12 小时前
密码学之分组密码
网络·密码学
艾莉丝努力练剑13 小时前
OpenCode AI 编程:Ubuntu 24.04 环境安装与使用指南
linux·服务器·网络·人工智能·tcp/ip·ubuntu
谷雪_65814 小时前
Linux 网络命名空间:从内核原理到企业级容器网络架构全景实战
linux·网络·架构
liulilittle14 小时前
KCC 拥塞控制算法缺陷修复记录(26/07/05)
网络·tcp/ip·计算机网络·c·信息与通信·tcp·通信
Tian_Hang14 小时前
Eclipse Ditto 的权限策略
java·服务器·前端·网络·ide·ubuntu·eclipse
ai生成式引擎优化技术14 小时前
从知识连接到智能组织:WSaiOS认知网络的理论框架与系统设计摘要
网络·python·plotly·django·pygame