配置vlan与Trunk配置命令教程

拓扑图如下:

配置vlan与Trunk配置命令如下
条件:1)两台s3700交换机
2)pc机4台
3)创建vlan 10 20
===========================================================
SW1配置:
int e0/0/1:
<Huawei>system-view                     //进系统视图
[Huawei]sysname SW-1                    //修改主机名为SW-1
[SW-1]vlan batch 10 20                    //创建vlan10 20
[SW-1]int e0/0/1                    //进E0/0/1接口
[SW-1-Ethernet0/0/1]port link-type access        //设置接入模式为access
[SW-1-Ethernet0/0/1]port default vlan 10        //将默认的vlan1添加vlan10
=========================================================================
int e/0/2配置:
[SW-1-Ethernet0/0/1]int e0/0/2                    //从e0/0/1切换到e0/0/2
[SW-1-Ethernet0/0/2]port link-type access             //设置接入模式为access模式
[SW-1-Ethernet0/0/2]port default vlan 20            //添加vlan20
==================================================================================
int e0/0/3:
[SW-1-Ethernet0/0/2]int e0/0/3                //从e0/0/2切换到e0/0/3
[SW-1-Ethernet0/0/3]port link-type trunk        //设置接入模式为trunk模式
[SW-1-Ethernet0/0/3]port trunk allow-pass vlan all    //允许所有vlan通过
=================================================================================
查看vlan:
[SW-1-Ethernet0/0/3]dis 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/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)                                                     
             TG:Eth0/0/3(U)                                                     
20   common  UT:Eth0/0/2(U)                                                     
             TG: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                         
[SW-1-Ethernet0/0/3]
=============================================================================
sw2:
    int e0/0/1配置如下:
<Huawei>system-view                     //进系统视图
[Huawei]sysname SW-2                    //修改主机名为:SW-2
[SW-2]vlan batch 10 20                    //创建vlan30 40
[SW-2-Ethernet0/0/1]port link-type access        //设置接入模式为access模式
[SW-2-Ethernet0/0/1]port default vlan 10        //添加vlan30
=================================================================================
[SW-2-Ethernet0/0/1]int e0/0/2                //从e0/0/1切换到e0/0/2
[SW-2-Ethernet0/0/2]port link-type access        //设置接入模式access模式
[SW-2-Ethernet0/0/2]port default vlan 20        //添加vlan40
===============================================================================
[SW-2-Ethernet0/0/2]int e0/0/3                //从e0/0/2切换到e0/0/3
[SW-2-Ethernet0/0/3]port link-type trunk        //设置工作模式为Trunk模式
[SW-2-Ethernet0/0/3]port trunk allow-pass vlan all     //所有的vlan允许通过
===============================================================================
查看vlan:
[SW-2-Ethernet0/0/3]dis 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/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)                                                     
             TG:Eth0/0/3(U)                                                     

20   common  UT:Eth0/0/2(U)                                                     
             TG:Eth0/0/3(U)        
                                            
==================================================================

VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
30   enable  default       enable  disable    VLAN 0030                         
40   enable  default       enable  disable    VLAN 0040 
=====================================================================================
 

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

猜你喜欢

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