其他分享
首页 > 其他分享> > VLAN配置学习总结

VLAN配置学习总结

作者:互联网

VLAN配置学习总结

创建VLAN的命令(以华为设备为例)

在系统模式下进行操作

[SW1] vlan 20  //单个创建vlan

[SW1-vlan20] description  vlan-test vlan20   //相关描述信息将改变显示的描述  20   enable  default       enable  disable    vlan-test vlan10  

 

批量创建VLAN

[SW1] vlan batch 30 40 50 55  //批量创建VLAN命令,不连续创建VLAN

[SW1] vlan batch 60 to 65 //批量创建VLAN命令,这创建是连续的,也就是60,61,62,63,64,65

[SW1]  undo vlan batch 10 to 20  //批量删除VLAN命令,注意:10到20,可以是连续的,也可以是不连续的,在这个范围里的都将被删除。

 

显示VLAN 10相关信息

[SW1]  display vlan 10
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------

VID Type Ports
--------------------------------------------------------------------------------
10 common UT:GE0/0/1(U) GE0/0/2(U)

VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
10 enable default enable disable vlan-test vlan10

 

显示所有VLAN相关信息

[SW1] 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:GE0/0/11(D) GE0/0/12(D) GE0/0/13(D) GE0/0/14(D)
GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D)
GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D)
GE0/0/23(D) GE0/0/24(D)

10 common UT:GE0/0/1(U) GE0/0/2(U) GE0/0/3(U)

20 common UT:GE0/0/4(U) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D)

GE0/0/8(D) GE0/0/9(D) GE0/0/10(D)

30 common

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

1 enable default enable disable VLAN 0001
10 enable default enable disable vlan-test vlan10
20 enable default enable disable VLAN 0020
30 enable default enable disable VLAN 0030

 

设置交换机接口的连接类型并加入指定VLAN

[SW1] interface GigabitEthernet 0/0/1

[SW1-GigabitEthernet0/0/1] port link-type access   //设置接口类型

access  Access port
dot1q-tunnel  QinQ port
hybrid  Hybrid port
trunk  Trunk port

[SW1-GigabitEthernet0/0/1] port default vlan 10   //将本接口g0/0/1加入VLAN10 

 

设置网络接口组(这个功能很管用,在管理时比较高效,实现成批网络接口进行配置)

[SW1] port-group 10  //建立接口组

[SW1-port-group-10] group-member GigabitEthernet 0/0/1 GigabitEthernet 0/0/2   //多个接口批量加入接口组

[SW1-port-group-20] group-member GigabitEthernet 0/0/3 to GigabitEthernet 0/0/10  //多个接口批量连续加入接口组

[SW1-port-group-30] group-member GigabitEthernet 0/0/11 to GigabitEthernet 0/0/15

[SW1] dis port-group all   //显示接口组成员信息,以下为刚才创建的接口组及归类信息
Portgroup: 10
GigabitEthernet0/0/1
GigabitEthernet0/0/2

Portgroup: 20
GigabitEthernet0/0/3
GigabitEthernet0/0/4
GigabitEthernet0/0/5
GigabitEthernet0/0/6
GigabitEthernet0/0/7
GigabitEthernet0/0/8
GigabitEthernet0/0/9
GigabitEthernet0/0/10

Portgroup: 30
GigabitEthernet0/0/11
GigabitEthernet0/0/12
GigabitEthernet0/0/13
GigabitEthernet0/0/14
GigabitEthernet0/0/15

 

因为有接口组,接下来就可以成批操作接口,很方便。如下:

[SW1] port-group 10   //进入接口组10


[SW1-port-group-10] port link-type access  //整个接口组设置成access连接模式
[SW1-GigabitEthernet0/0/1] port link-type access
[SW1-GigabitEthernet0/0/2] port link-type access


[SW1-port-group-10] port default vlan 10  //整个接口组加入了vlan10
[SW1-GigabitEthernet0/0/1] port default vlan 10
[SW1-GigabitEthernet0/0/2] port default vlan 10

[SW1-port-group-20] port link-type access
[SW1-GigabitEthernet0/0/3] port link-type access
[SW1-GigabitEthernet0/0/4] port link-type access
[SW1-GigabitEthernet0/0/5] port link-type access
[SW1-GigabitEthernet0/0/6] port link-type access
[SW1-GigabitEthernet0/0/7] port link-type access
[SW1-GigabitEthernet0/0/8] port link-type access
[SW1-GigabitEthernet0/0/9] port link-type access
[SW1-GigabitEthernet0/0/10] port link-type access

[SW1-port-group-20] port default vlan 20
[SW1-GigabitEthernet0/0/3] port default vlan 20
[SW1-GigabitEthernet0/0/4] port default vlan 20
[SW1-GigabitEthernet0/0/5] port default vlan 20
[SW1-GigabitEthernet0/0/6] port default vlan 20
[SW1-GigabitEthernet0/0/7] port default vlan 20
[SW1-GigabitEthernet0/0/8] port default vlan 20
[SW1-GigabitEthernet0/0/9] port default vlan 20
[SW1-GigabitEthernet0/0/10] port default vlan 20

[SW1] display port vlan   //查看交换机接口对应vlan相关信息
Port            Link Type   PVID Trunk VLAN List
-------------------------------------------------------------------------------
GigabitEthernet0/0/1    access    10 -
GigabitEthernet0/0/2    access    10 -
GigabitEthernet0/0/3    access    20 -
GigabitEthernet0/0/4    access    20 -
GigabitEthernet0/0/5   access     20 -
GigabitEthernet0/0/6    access    20 -
GigabitEthernet0/0/7    access    20 -
GigabitEthernet0/0/8    access    20 -
GigabitEthernet0/0/9    access    20 -
GigabitEthernet0/0/10   access   20 -
GigabitEthernet0/0/11    hybrid    1 -
GigabitEthernet0/0/12    hybrid      1 -

标签:总结,配置,20,VLAN,GigabitEthernet0,GE0,SW1,port,vlan
来源: https://www.cnblogs.com/gucun-blog/p/16315990.html