如何配置vlan

拓扑图如下:

1创建
2.将端口加入vlan里面
3查看vlan信息
=======================================
设备为3700交换机+3台pc主机
3台pc机的IP地址为:
pc1IP地址为:192.168.1.1 255.255.255.0
pc2IP地址为:192.168.1.2 255.255.255.0
pc3IP地址为:192.168.1.3 255.255.255.0
=========================================
配置vlan命令如下:
<Huawei>system-view                       //进系统视图
[Huawei]sysname SW-1                      //修改主机名为sw-1
[SW-1]vlan batch 10 20 30                //创建vlan 10 20 30
创建端口号为1配置如下:
[SW-1]port-group 1                    //创建端口组为1
[SW-1-port-group-1]group-member e0/0/1 e0/0/2        //添加端口组成员
[SW-1-port-group-1]port link-type access        //设置接入模式为access
[SW-1-port-group-1]port default vlan 10            //将默认的vlan1添加vlan10

创建端口号为2配置如下:
[SW-1]port-group 2                    //创建端口组为2
[SW-1-port-group-1]group-member e0/0/3 e0/0/5        //添加端口组成员
[SW-1-port-group-1]port link-type access        //设置接入模式为access
[SW-1-port-group-1]port default vlan 20            //将默认的vlan1添加vlan20

创建端口号为3配置如下:
[SW-1]port-group 3                    //创建端口组为3
[SW-1-port-group-1]group-member e0/0/6 e0/0/7        //添加端口组成员
[SW-1-port-group-1]port link-type access        //设置接入模式为access
[SW-1-port-group-1]port default vlan 30            //将默认的vlan1添加vlan30
============================================================================================
下面的是查看vlan的配置命令:
[SW-1]dis 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/8(D)     Eth0/0/9(D)     Eth0/0/10(U)    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(U)    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(D)                                     

20   common  UT:Eth0/0/3(D)     Eth0/0/4(D)     Eth0/0/5(D)                     

30   common  UT:Eth0/0/6(D)     Eth0/0/7(D)                                     


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                         
30   enable  default       enable  disable    VLAN 0030  
===============================================================================================
在三台主机中配置IP地址(这里已经配置过了):下面的就是ping了:
PC>ping 192.168.1.2

Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable

--- 192.168.1.2 ping statistics ---
  5 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss


如果出现ping不通 就对了 因为你只配了添加vlan的配置

发布了13 篇原创文章 · 获赞 9 · 访问量 730

猜你喜欢

转载自blog.csdn.net/qq_38936227/article/details/104268988