配置vlan

本文介绍了如何在交换机上创建VLAN,并为特定端口分配VLAN,同时配置VLAN接口的IP地址。通过具体操作步骤展示了如何将端口加入到指定的VLAN中,并设置VLAN接口的IP地址。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Continue with configuration dialog? [y/n]:                                          Continue with configuration dialog? [y/n]:                                          switch>       switch>enable        switch#             switch#show vlan                VLAN Name         Type       Media     Ports                                            ---- ------------ ---------- --------- ----------------------------------------                                                                               1    default      Static     ENET      Ethernet0/0/1       Ethernet0/0/2                                                                                                               Ethernet0/0/3       Ethernet0/0/4                                                                                                               Ethernet0/0/5       Ethernet0/0/                                                                                                            Ethernet0/0/7       Ethernet0/0/8                                                                                                               Ethernet0/0/9       Ethernet0/0/10                                                                                                                Ethernet0/0/11      Ethernet0/0/12                                                                         switch#  config t               switch(Config)#vlan 2                     switch(Config-Vlan2)#switch interface ethernet 0/0/11-12                                       Set the port Ethernet0/0/11 access vlan 2 successfully                                                      Set the port Ethernet0/0/12 access vlan 2 successfully                                                      switch(Config-Vlan2)#exit                         switch(Config)#exit                   switch#write            switch#conf t             switch(Config)#vlan 2                     switch(Config-Vlan2)#switchport interface ethernet ?                                                      <WORD>                   -- Interface list(input interface and/or the                                                                                                     interface ranges divided by semicolon(;). such                                                                                                          as e0/0/1;e0/0/3;e0/0/5-8) <1-100> character                                                                          switch(Config-Vlan2)#switchport interface ethernet 0/0/11-12                                                            Set the port Ethernet0/0/11 access vlan 2 successfully                                                      Set the port Ethernet0/0/12 access vlan 2 successfully                                                      switch(Config-Vlan2)#                     switch#show vlan                VLAN Name         Type                                   ---- ------------ ---------- --------- ----------------------------------------                                                                               1    default      Static     ENET      Ethernet0/0/1       Ethernet0/0/2                                                                                                               Ethernet0/0/3       Ethernet0/0/4                                                                                                               Ethernet0/0/5       Ethernet0/0/6                                                                                                               Ethernet0/0/7       Ethernet0/0/8                                                                                                               Ethernet0/0/9       Ethernet0/0/10                                                                         2    VLAN0002     Static     ENET      Ethernet0/0/11      Ethernet0/                                                                    switch#   write               switch#       Continue with configuration dialog? [y/n]:                                          switch(Config)#int vlan 1                         20:42:07: %LINK-5-CHANGED: Interface Vlan1, changed state to UP                                                               %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to UP                                                                          switch(Config-If-Vlan1)#ip address 192.168.13.1 255.255.255.0                                                             switch(Config-If-Vlan1)#int vlan 1                                  switch(Config-If-Vlan1)#int vlan 2                                  20:42:20: %LINK-5-CHANGED: Interface Vlan2, changed state to UP                                                               %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to UP                                                                          switch(Config-If-Vlan2)#ip address 192.168.14.1 255.255.255.                                                           switch(Config-If-Vlan2)#                        switch#write            switch#show run               Current configuration:                      !    hostname switch                  ! ! Vlan 1         vlan 1         ! Vlan 2         vlan 2         ! ! Interface Ethernet0/0/1                       ! Interface Ethernet0/0/2                       ! Interface Ethernet0/0/3                       ! Interface Ethernet0/0/4                       ! Interface Ethernet0/0/5                       ! Interface Ethernet0/0/6                       ! Interface Ethernet0/0/7                       ! Interface Ethernet0/0/8                       ! Interface Ethernet0/0/9                          switchport access vlan 2                           ! Interface Ethernet0/0/10                           switchport access vlan 2                           ! Interface Ethernet0/0/11                           switchport access vlan 2                           ! Interface Ethernet                    switchport access vlan 2                           ! ! interface Vlan1                  interface vlan 1                      ip address 192.168.13.1 255.255.255.0                                        ! ! interface Vlan2                  interface vlan 2                      ip address 192.168.14.1 255.255.255.0                                        ! ! switch#write            switch#       switch#       switch#       switch#       switch#       switch#conf           switch>       switch>       switch>       switch>       switch>       switch>       switch>       switch>en         switch#conf t             switch(Config)#int vlan 1                         19:48:11: %LINK-5-CHANGED: Interface Vlan1, changed state to UP                                                               %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to UP                                                                          switch(Config-If-Vlan1)#ip address 192.168.16.1 255.255.255.0                                                             switch(Config-If-Vlan1)#int vlan 2                                  19:48:34: %LINK-5-CHANGED: Interface Vlan2, changed state to UP                                                               switch(Config-If-Vlan2)#ip address 192.168.17.1 255.255.255.0                                                             switch(Config-If-Vlan2)#                        switch#write            switch#sh run             Current configuration:                      !    hostname switch                  ! ! Vlan 1         vlan 1         ! Vlan 2         vlan 2         ! ! Interface Ethernet0/0/1                       ! Interface Ethernet0/0/2                       ! Interface Ethernet0/0/3                       ! Interface Ethernet0/0/4                       ! Interface Ethernet0/0/5                       ! Interface Ethernet0/0/6                       ! Interface Ethernet0/0/7                       ! Interface Ethernet0/0/8                       ! Interface Ethernet0/0/9                       ! Interface Ethernet0/0/10                        ! Interface Ethernet0/0/11                           switchport access vlan 2                           ! Interface Ethernet0/0/12                           switchport access vlan 2                           ! ! interface Vlan1                  interface vlan 1                      ip address 192.168.16.1 255.255.255.0                                        ! ! interface Vlan2                  interface vlan 2                      ip address 192.168.17.1 255.255.255.0                                        ! ! switch#show vlan                VLAN Name         Type       Media     Ports ---- ------------ ---------- --------- ---------------------------------------- 1    default      Static     ENET      Ethernet0/0/1       Ethernet0/0/2                                        Ethernet0/0/3       Ethernet0/0/4                                        Ethernet0/0/5       Ethernet0/0/6                                        Ethernet0/0/7       Ethernet0/0/8                                        Ethernet0/0/9       Ethernet0/0/10 2    VLAN0002     Static     ENET      Ethernet0/0/11      Ethernet0/0/12 switch# switch(Config)# switch(Config)# switch(Config)#exit switch#sh vlan VLAN Name         Type       Media     Ports ---- ------------ ---------- --------- ---------------------------------------- 1    default      Static     ENET      Ethernet0/0/1       Ethernet0/0/2                                        Ethernet0/0/3       Ethernet0/0/4                                        Ethernet0/0/5       Ethernet0/0/6                                        Ethernet0/0/7       Ethernet0/0/8 2    VLAN0002     Static     ENET      Ethernet0/0/9       Ethernet0/0/10                                        Ethernet0/0/11      Ethernet0/0/12 switch#  20:44:52: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0/1 2,changed state to UP
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值