• 【eNSP】VLAN基础配置


    一、基于接口划分VLAN(Access接口和Trunk接口)

    在这里插入图片描述

    1、创建VLAN

    LSW1

    [LSW1]vlan batch 10 20
    Info: This operation may take a few seconds. Please wait for a moment...done.
    
    
    • 1
    • 2
    • 3

    LSW2

    [LSW2]vlan batch 10 20
    Info: This operation may take a few seconds. Please wait for a moment...done.
    
    
    • 1
    • 2
    • 3

    2、配置Access接口和Trunk接口

    (1)配置Trunk接口

    LSW1
    [LSW1]interface Ethernet 0/0/1
    [LSW1-Ethernet0/0/1]port link-type trunk                 # 将该接口设置为trunk链路类型,可以传输多个VLAN的数据。
    [LSW1-Ethernet0/0/1]port trunk pvid vlan 1               # 将该接口的Native VLAN设置为VLAN 1,该接口上接收到的未打上VLAN标签的数据将被认为属于VLAN 1。
    [LSW1-Ethernet0/0/1]port trunk allow-pass vlan 10 20     # 允许该接口通过的VLAN列表为VLAN 10和VLAN 20,只有这两个VLAN的数据可以通过该接口传输。
    
    • 1
    • 2
    • 3
    • 4
    LSW2
    [LSW2]interface Ethernet 0/0/1
    [LSW2-Ethernet0/0/1]port link-type trunk
    [LSW2-Ethernet0/0/1]port trunk pvid vlan 1
    [LSW2-Ethernet0/0/1]port trunk allow-pass vlan 10 20
    
    • 1
    • 2
    • 3
    • 4

    (2)配置Access接口

    LSW1
    [LSW1-Ethernet0/0/1]interface Ethernet 0/0/2
    [LSW1-Ethernet0/0/2]port link-type access     # 将该接口设置为access链路类型,只能传输单个VLAN的数据。
    [LSW1-Ethernet0/0/2]port default vlan 10      # 将该接口的默认VLAN设置为VLAN 10,该接口上接收到的未打上VLAN标签的数据将被认为属于VLAN 10。
    [LSW1-Ethernet0/0/2]interface Ethernet 0/0/3
    [LSW1-Ethernet0/0/3]port link-type access
    [LSW1-Ethernet0/0/3]port default vlan 20
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    LSW2
    [LSW2-Ethernet0/0/1]interface Ethernet 0/0/2
    [LSW2-Ethernet0/0/2]port link-type access
    [LSW2-Ethernet0/0/2]port default vlan 20
    [LSW2-Ethernet0/0/2]interface Ethernet 0/0/3
    [LSW2-Ethernet0/0/3]port link-type access
    [LSW2-Ethernet0/0/3]port default vlan 10
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    二、基于接口划分VLAN(Hybrid接口)

    在这里插入图片描述

    1、创建VLAN

    LSW1

    [LSW1]vlan batch 10 20 100
    Info: This operation may take a few seconds. Please wait for a moment...done.
    
    
    • 1
    • 2
    • 3

    LSW2

    [LSW2]vlan batch 10 20 100
    Info: This operation may take a few seconds. Please wait for a moment...done.
    
    
    • 1
    • 2
    • 3

    2、Hybrid配置

    LSW1

    [LSW1]interface Ethernet 0/0/2
    [LSW1-Ethernet0/0/2]port link-type hybrid                # 将该接口设置为hybrid链路类型,可以同时传输 tagged 和 untagged 的数据。
    [LSW1-Ethernet0/0/2]port hybrid pvid vlan 10             # 将该接口的Native VLAN设置为VLAN 10,即该接口上接收到的未打上VLAN标签的数据将被认为属于VLAN 10。
    [LSW1-Ethernet0/0/2]port hybrid untagged vlan 10 100     # 将该接口设置为untagged模式,该接口上接收到的数据将被自动打上VLAN 10和VLAN 100的标签。
    [LSW1-Ethernet0/0/2]interface Ethernet 0/0/3
    [LSW1-Ethernet0/0/3]port link-type hybrid 	
    [LSW1-Ethernet0/0/3]port hybrid pvid vlan 20
    [LSW1-Ethernet0/0/3]port hybrid untagged vlan 20 100
    [LSW1-Ethernet0/0/3]interface Ethernet 0/0/1
    [LSW1-Ethernet0/0/1]port link-type hybrid
    [LSW1-Ethernet0/0/1]port hybrid tagged vlan 10 20 100    # 接口的标记VLAN为VLAN 10、VLAN 20和VLAN 100。
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    LSW2

    [LSW2]interface Ethernet 0/0/1	
    [LSW2-Ethernet0/0/1]port link-type hybrid 	
    [LSW2-Ethernet0/0/1]port hybrid tagged vlan 10 20 100
    [LSW2-Ethernet0/0/1]interface Ethernet 0/0/2	
    [LSW2-Ethernet0/0/2]port link-type hybrid 
    [LSW2-Ethernet0/0/2]port hybrid pvid vlan 100
    [LSW2-Ethernet0/0/2]port hybrid untagged vlan 10 20 100
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    3、验证

    [LSW1]display vlan
    The total number of vlans is : 4
    --------------------------------------------------------------------------------
    U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
    MP: Vlan-mapping;               ST: Vlan-stacking;
    #: ProtocolTransparent-vlan;    *: Management-vlan;
    --------------------------------------------------------------------------------
    
    VID  Type    Ports                                                          
    --------------------------------------------------------------------------------
    1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(D)     
                    Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)     
                    Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)    
                    Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)    
                    Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)    
                    Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      
    
    10   common  UT:Eth0/0/2(U)                                                     
                 TG:Eth0/0/1(U)                                                     
    
    20   common  UT:Eth0/0/3(U)                                                     
    
                 TG:Eth0/0/1(U)                                                     
    
    100  common  UT:Eth0/0/2(U)     Eth0/0/3(U)                                     
    
                 TG:Eth0/0/1(U)                                                     
    
    
    VID  Status  Property      MAC-LRN Statistics Description      
    --------------------------------------------------------------------------------
    
    1    enable  default       enable  disable    VLAN 0001                         
    10   enable  default       enable  disable    VLAN 0010                         
    20   enable  default       enable  disable    VLAN 0020                         
    100  enable  default       enable  disable    VLAN 0100                         
    [LSW1]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37

    三、基于MAC地址划分VLAN

    在这里插入图片描述

    1、创建VLAN并管理MAC地址

    [LSW1]vlan 10
    [LSW1-vlan10]
    [LSW1-vlan10]mac-vlan mac-address 5489-9867-42FE     # 将MAC地址5489-9867-42FE添加到VLAN 10中。
    [LSW1-vlan10]mac-vlan mac-address 5489-9861-0375
    [LSW1-vlan10]q
    [LSW1]vlan 20
    [LSW1-vlan20]mac-vlan mac-address 5489-9810-68BE
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    2、加入VLAN

    [LSW1]interface Ethernet 0/0/1
    [LSW1-Ethernet0/0/1]port link-type hybrid 
    [LSW1-Ethernet0/0/1]port hybrid untagged vlan 10
    [LSW1-Ethernet0/0/1]interface Ethernet 0/0/2
    [LSW1-Ethernet0/0/2]port hybrid untagged vlan 10
    [LSW1-Ethernet0/0/2]q
    [LSW1]interface Ethernet 0/0/3
    [LSW1-Ethernet0/0/3]port link-type hybrid 
    [LSW1-Ethernet0/0/3]port hybrid untagged vlan 20
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    3、开启基于MAC地址划分VLAN功能

    [LSW1]interface Ethernet 0/0/1
    [LSW1-Ethernet0/0/1]mac-vlan enable
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [LSW1-Ethernet0/0/1]interface Ethernet 0/0/2
    [LSW1-Ethernet0/0/2]mac-vlan enable
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [LSW1-Ethernet0/0/2]interface Ethernet 0/0/3
    [LSW1-Ethernet0/0/3]mac-vlan enable
    Info: This operation may take a few seconds. Please wait for a moment...done.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    4、验证

    [LSW1]display vlan
    The total number of vlans is : 3
    --------------------------------------------------------------------------------
    U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
    MP: Vlan-mapping;               ST: Vlan-stacking;
    #: ProtocolTransparent-vlan;    *: Management-vlan;
    --------------------------------------------------------------------------------
    
    VID  Type    Ports                                                          
    --------------------------------------------------------------------------------
    1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(D)     
                    Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)     
                    Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)    
                    Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)    
                    Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)    
                    Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      
    
    10   common  UT:Eth0/0/1(U)     Eth0/0/2(U)                                     
    
    20   common  UT:Eth0/0/3(U)                                                     
    
    
    VID  Status  Property      MAC-LRN Statistics Description      
    --------------------------------------------------------------------------------
    
    1    enable  default       enable  disable    VLAN 0001                         
    10   enable  default       enable  disable    VLAN 0010                         
    20   enable  default       enable  disable    VLAN 0020                         
    
    [LSW1]display mac-vlan mac-address all
    ---------------------------------------------------
    MAC Address     MASK            VLAN    Priority   
    ---------------------------------------------------
    5489-9861-0375  ffff-ffff-ffff  10      0          
    5489-9810-68be  ffff-ffff-ffff  20      0          
    5489-9867-42fe  ffff-ffff-ffff  10      0          
    
    Total MAC VLAN address count: 3 
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
  • 相关阅读:
    【C++】异常机制
    myeclipse怎么打开server窗口
    Abnova丨Abnova 定制兔单克隆抗体开发工作流程
    Driver8833电机驱动模块的使用(STM32为主控)
    Kotlin 初阶/高阶函数
    【目标检测】YOLOv5在Android上的部署
    大前端CPU优化技术--NEON指令介绍
    CCNA-DHCP(动态主机配置协议)
    找不到d3dcompiler_43.dll,无法继续执行代码如何解决
    react基础知识3
  • 原文地址:https://blog.csdn.net/ZXW_NUDT/article/details/133699180