zoukankan      html  css  js  c++  java
  • 华为交换机划分VLAN

    1. 业务需求:公司现有生产部、测试工程部、财务部计算机连接在2台华为S 3700交换机上,各个部门只能访问自己部门的网络,请划分VLAN,并用命令行进行配置?逻辑拓扑图如下:

    • 生产部 PC 1、PC 2需要互相通信
    • 测试工程部 PC 3、PC 4、PC 7、PC 8需要互相通信
    • 财务部PC 5、PC 6需要互相访问
    • 其它网络均不互通

     在LSW 1交换机进行如下命令行配置:

    <Huawei>system-view             #切换系统视图
    [Huawei]sysname office            #将交换机命名为office
    [office]vlan batch 10 20 30            #批量创建vlan 10 20 30
    [office]vlan 10            #进入vlan 10
    [office-vlan10]description produce            #描述vlan 10为produce
    [office-vlan10]quit            #退出
    
    [office]vlan 20            #进入vlan 20
    [office-vlan20]description test            #描述vlan 20为test
    [office-vlan20]quit            #退出
    
    [office]vlan 30            #进入vlan 30
    [office-vlan30]description finance        #描述vlan 30为finance
    [office-vlan30]quit            #退出
    
    #接口配置
    [office]interface Ethernet0/0/1                #进入e0/0/1接口视图
    [office-Ethernet0/0/1]port link-type access            #链路类型access
    [office-Ethernet0/0/1]port default vlan 10        #划分至vlan 10
    [office-Ethernet0/0/1]quit            #退出
    
    [office]interface e0/0/2                #进入e0/0/2接口视图
    [office-Ethernet0/0/2]port link-type access            #链路类型access
    [office-Ethernet0/0/2]port default vlan 10        #划分至vlan 10
    [office-Ethernet0/0/2]quit            #退出
    
    [office]interface e0/0/3                #进入e0/0/3接口视图
    [office-Ethernet0/0/3]port link-type access            #链路类型access
    [office-Ethernet0/0/3]port default vlan 20        #划分至vlan 20
    [office-Ethernet0/0/3]quit            #退出
    
    [office]interface e0/0/4                #进入e0/0/4接口视图
    [office-Ethernet0/0/4]port link-type access            #链路类型access
    [office-Ethernet0/0/4]port default vlan 20        #划分至vlan 20
    [office-Ethernet0/0/4]quit            #退出
    
    [office]interface e0/0/5                #进入e0/0/5接口视图
    [office-Ethernet0/0/5]port link-type access            #链路类型access
    [office-Ethernet0/0/5]port default vlan 30        #划分至vlan 30
    [office-Ethernet0/0/5]quit            #退出
    
    [office]interface e0/0/6                #进入e0/0/6接口视图
    [office-Ethernet0/0/6]port link-type access            #链路类型access
    [office-Ethernet0/0/6]port default vlan 30        #划分至vlan 30
    [office-Ethernet0/0/6]quit            #退出
    
    [office]interface e0/0/7                #进入e0/0/7接口视图
    [office-Ethernet0/0/7]port link-type trunk            #链路类型trunk
    [office-Ethernet0/0/7]port trunk allow-pass vlan all          #允许所有vlan通过  
    [office-Ethernet0/0/7]quit            #退出
    
    #查看vlan信息 [office]display vlan #查看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/7(U) 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) TG:Eth0/0/7(U) 20 common UT:Eth0/0/3(U) Eth0/0/4(U) TG:Eth0/0/7(U) 30 common UT:Eth0/0/5(U) Eth0/0/6(U) TG:Eth0/0/7(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 10 enable default enable disable produce 20 enable default enable disable test 30 enable default enable disable finance
    #查询端口信息 [office]display port vlan #查询端口信息如下: Port Link Type PVID Trunk VLAN List ------------------------------------------------------------------------------- Ethernet0/0/1 access 10 - Ethernet0/0/2 access 10 - Ethernet0/0/3 access 20 - Ethernet0/0/4 access 20 - Ethernet0/0/5 access 30 - Ethernet0/0/6 access 30 - Ethernet0/0/7 trunk 1 1-4094 Ethernet0/0/8 hybrid 1 - Ethernet0/0/9 hybrid 1 - Ethernet0/0/10 hybrid 1 - Ethernet0/0/11 hybrid 1 - Ethernet0/0/12 hybrid 1 - Ethernet0/0/13 hybrid 1 - Ethernet0/0/14 hybrid 1 - Ethernet0/0/15 hybrid 1 - Ethernet0/0/16 hybrid 1 - Ethernet0/0/17 hybrid 1 - Ethernet0/0/18 hybrid 1 - Ethernet0/0/19 hybrid 1 - Ethernet0/0/20 hybrid 1 - Ethernet0/0/21 hybrid 1 - Ethernet0/0/22 hybrid 1 - GigabitEthernet0/0/1 hybrid 1 - GigabitEthernet0/0/2 hybrid 1 -

     在LSW 2交换机上进行如下配置:

    <Huawei>system-view             #切换系统视图
    [Huawei]sysname test            #交换机命名test
    [test]vlan 20            #创建vlan 20
    [test-vlan20]description test            #为vlan 20描述test
    [test-vlan20]quit            #退出
    
    #接口配置
    [test]interface e0/0/1            #进入e0/0/1 接口视图
    [test-Ethernet0/0/1]port link-type access        #链路类型access
    [test-Ethernet0/0/1]port default vlan 20        #划分至vlan 20
    [test-Ethernet0/0/1]quit            #退出
    
    [test]interface e0/0/2            #进入e0/0/2 接口视图
    [test-Ethernet0/0/2]port link-type access        #链路类型access
    [test-Ethernet0/0/2]port default vlan 20        #划分至vlan 20
    [test-Ethernet0/0/2]quit            #退出
    
    [test]interface e0/0/3            #进入e0/0/3 接口视图
    [test-Ethernet0/0/3]port link-type trunk        #链路类型trunk
    [test-Ethernet0/0/3]port trunk allow-pass vlan all        #允许所有vlan通过
    [test-Ethernet0/0/3]quit            #退出    
    
    [test]display vlan             #查看vlan信息如下:
    
    
    The total number of vlans is : 2
    --------------------------------------------------------------------------------
    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/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)                                      
    
    20   common  UT:Eth0/0/1(U)     Eth0/0/2(U)                                     
                 TG:Eth0/0/3(U)                                                     
    
    
    VID  Status  Property      MAC-LRN Statistics Description      
    --------------------------------------------------------------------------------
    
    1    enable  default       enable  disable    VLAN 0001                         
    20   enable  default       enable  disable    test         

    各部门网络通信验证:在各PC上测试,每个部门计算机只能访问自己部门的网络,其它部门网络无法通信,满足业务需求

  • 相关阅读:
    iOS 'The sandbox is not sync with the Podfile.lock错误
    iOS __strong __weak @Strongify @Weakify
    iOS Debug日志 viewhierarchy调试笔记
    网易163 docker镜像
    mysql 双主复制 windows10
    (转) MySQL常用Json函数
    springboot 不同环境读取不同配置
    Mysql Cluster7.5.6 windows10 部署安装
    SourceTree 免登录跳过初始设置
    Java Object to Class
  • 原文地址:https://www.cnblogs.com/xiykj/p/14085309.html
Copyright © 2011-2022 走看看