交换机基本命令
交换机配置命令大全

交换机配置命令大全交换机是网络中非常重要的设备,它可以实现局域网内计算机之间的数据传输和通信。
在进行交换机的配置时,我们需要掌握一些基本的配置命令,以确保交换机能够正常运行并满足网络的需求。
下面将介绍一些常用的交换机配置命令,希望对大家有所帮助。
1. 设置交换机的主机名。
在配置交换机之前,我们首先需要设置交换机的主机名,以便在网络中进行识别和管理。
我们可以通过以下命令来设置交换机的主机名:```。
Switch(config)#hostname S1。
```。
这条命令将交换机的主机名设置为S1,您也可以根据实际情况进行修改。
2. 配置交换机的管理IP地址。
为了实现对交换机的远程管理,我们需要为交换机配置一个IP地址。
我们可以通过以下命令来配置交换机的管理IP地址:```。
Switch(config)#interface vlan 1。
Switch(config-if)#ip address 192.168.1.1 255.255.255.0。
Switch(config-if)#no shutdown。
```。
这条命令将VLAN 1接口的IP地址设置为192.168.1.1,子网掩码为255.255.255.0,并启用该接口。
3. 配置交换机端口。
在实际网络中,我们需要对交换机的端口进行配置,以满足不同设备的连接需求。
以下是一些常用的端口配置命令:```。
Switch(config)#interface fastethernet 0/1。
Switch(config-if)#switchport mode access。
Switch(config-if)#switchport access vlan 10。
```。
这条命令将FastEthernet 0/1端口设置为接入模式,并将该端口划分到VLAN 10中。
4. 配置交换机的VLAN。
VLAN是虚拟局域网的缩写,它可以将一个物理局域网划分成多个逻辑上的局域网。
交换机基本配置命令汇总大全

交换机基本配置命令汇总大全一、交换机基本操作:1.1进入特权模式Switch>enableSwitch#1.2返回用户模式Switch#exitPress RETURN to get started!Switch>二、配置模式:全局配置模式[主机名(config)#]:配置交换机的整体参数2.1子模式:1.线路配置模式[主机名(config-line)#]:配置交换机的线路参数2.接口配置模式[主机名(config-if)#]:配置交换机的接口参数2.2进入、退出全局配置模式Switch#configure terminalSwitch(config)#exitSwitch#2.3进入、退出线路配置模式Switch(config)#line console0Switch(config-line)#exitSwitch(config)#2.4进入、退出接口配置模式Switch(config)#interface fastEthernet0/1Switch(config-if)#exitSwitch(config)#2.5从子模式下直接返回特权模式Switch(config-if)#endSwitch#三、交换机操作帮助:Ø支持命令简写(按TAB键将命令补充完整)Ø在每种操作模式下直接输入“?”显示该模式下所有的命令Ø命令空格“?”显示命令参数并对其解释说明Ø“字符?”显示以该字符开头的命令Ø命令历史缓存:(Ctrl+P)显示上一条命令,(Ctrl+N)显示下一条命令Ø错误提示信息四、交换机显示命令:Ø显示交换机硬件及软件的信息Switch#show versionØ显示当前运行的配置参数Switch#show running-configØ显示保存的配置参数Switch#show configure五、常用交换机flash中的命令:5.1将当前运行的配置参数复制到flashSwitch#write memoryBuilding configuration...[OK]Switch#5.2清空flashSwitch#delete flash:config.textSwitch#5.3交换机重新启动:Switch#reloadSystem configuration has been modified.Save?[yes/no]:n Proceed with reload?[confirm]5.4配置交换机主机名:Switch(config)#hostname S2126G-1S2126G-1(config)#5.5配置交换机口令:1)配置交换机的登陆密码S2126G(config)#enable secret level10star“0”表示输入的是明文形式的口令2)配置交换机的特权密码S2126G(config)#enable secret level150star“0”表示输入的是明文形式的口令六、常用交换机配置命令:6.1为交换机分配管理IPS2126G(config)#interface vlan1S2126G(config-if)#ip address{IP address}{IP subnetmask}[secondary]6.2将接口启用S2126G(config-if)#no shutdown6.3将接口关闭S2126G(config-if)#shutdown6.4配置接口速率S2126G(config-if)#speed[10|100|auto]6.5配置接口双工模式S2126G(config-if)#duplex[auto|full|half]七、显示接口状态:S2126G#show interface八、测定目的端的可达性:S2126G>ping{IP address}九、从TFTP服务器下载配置参数:S2126G#copy tftp startup-config十、管理交换机MAC地址表:10.1查看MACS2126G#show mac-address-table10.2配置MACS2126G(config)#mac-address-table aging-time<10-1000000> 10.3查看MACS2126G#show mac-address-table aging-time十一、VLAN的配置:11.1添加一个VLANS2126G(config)#vlan<1-4094>S2126G(config-vlan)#11.2为VLANS2126G(config-vlan)#name名字十二、将交换机端口分配到VLAN12.1配置Port VLANSwitch(config-if)#switchport access vlan<1-4094>12.2配置Tag VLANSwitch(config-if)#switchport mode trunk1)配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan<1-4094> Native VLAN即PVID,默认情况下每个trunk口的native VLAN是12)从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlanexcept vlan-list注:VLAN1不可被清除3)在主干链路中允许所有VLANSwitch(config-if)#switchport trunk allowed vlan all4)向主干链路中加入VLANSwitch(config-if)#switchport trunk allowed vlanadd vlan-list12.3VLAN1.显示全部的VLAN:Switch#show vlan2.显示单独的VLAN:Switch#show vlan id<1-4094>十三、RSTP的配置:13.1启用生成树:S2126G(config)#spanning-tree13.2配置交换机优先级:S2126G(config)#spanning-tree priority<0-61440>“0”或“4096”的倍数(RSTP BPDU该值后12bit全0)13.3配置交换机端口优先级:S2126G(config-if)#spanning-tree port-priority<0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)13.4生成树helloS2126G(config)#spanning-tree hello-time<1-10>13.5生成树的验证:Switch#show spanning-treeSwitch#show spanning-tree interface<接口名称><接口编号>十四、三层交换机路由功能:14.1开启三层交换机的路由功能Switch(config)#ip routing14.2开启端口的三层路由功能Switch(config)#interface fastethernet0/1Switch(config-if)#no switchport(这样就可以为某一端口配置IP)Switch(config-if)#ip address192.168.1.1255.255.255.0 Switch(config-if)#no shutdown。
交换机常用命令

交换机1、恢复出厂设置#set default2、给vlan添加端口#vlan 100 (创建一个vlan100)#switchport interface ethernet 1/1 (将E1/1接口加入vlan100中)#switchport interface ethernet 1/2-5 (将E1/2-5 范围内加入到vlan100中)3、设置Trunk端口允许通过vlan#interface ethernet 1/5#switchport mode trunk (将E1/5设置为trunk模式)#switchport trunk allowed vlan 1;3;5-20 (允许通过的vlan段)#switchport forbidden vlan add vlan 10 (防止E1/5加入到vlan10中)4、光口,电口的转换#interface ethernet 1/1#media-type copper(电口)/fiber(光口)5、端口粘连#switchport port-security mac-address sticky (将自动学习到得mac地址粘连到接口上)6、端口过滤#mac-address-table blackhole address {mac-address} vlan 17、端口聚合#port-group 1 (创建一个port-group组)#interface ethernet 1/1-2#port-group 1 mode on(强制)、passive(被动)、active(主动)[两个不能是passive ,active 和passive 要一起使用]8、端口镜像#monitor session 1 source interface ethernet 1/0/1 both (将源E1/0/1的流量镜像到E1/0/2)#monitor session 1 destination interface ethernet 1/0/2 (将源session 1发送至E1/0/2中)9、设置用户自动退出特权模式的超时时间#exec timeout10、关闭端口的vlan入口规则#vlan ingress disable11、设定引入路由的缺省路由权值#default-metric12、设置MD5认证,采用MD5认证#ip ospf message-digest-key 1 MD5 password#ip ospf authentication message-digest13、绑定MAC地址①在端口安全中绑定#switchport port-security mac-address …….②AM中启动#am mac-ip-pool …….③全局配置模式下#mac-address-table static address {mac-address} vlan 1 interface e1/114、生成树#spanning-tree 开启生成树#spanning-tree mst configuration 域配置#instance 10 vlan 10,,2 配置vlan到instance的映射#spanning-tree mst 10 priority 配置映射域的优先级#spanning-tree mst 10 cost 4096 在接口中调整开销15、交换机VRRP①创建vlan②配置vlan接口IP③配置vrrp#router vrrp 1 创建VRRP组#interface vlan 10 关联vlan接口#virtual-ip 192.168.10.1 配置虚拟地址#priority 120 优先级#preempt-mode true/false 配置抢占模式#enable 开启VRRP16、DHCP#service dhcp 开启DHCP#network-address 配置地址池#default-router 配置网关#dns-service DNF服务器地址17、QOS一、在交换机上实现QOSA.采用ACL定义需要限速的数据流(1)#ip access-list standard yuangong …..定义访问控制列表名(2)#permit host 192.168.1.1 ……………..定义限速的数据流B.设置带宽限制和猝发数据量(3)#class-map yuangong…………………定义类图yuangong(4)#match access-group yuangong……...关联匹配的列表(5)#policy-map test……………………….定义策略表(6)#class yuangong……………………….关联类图(7)#police 1000000 655356 exceed-action drop…..设置数据流量限制C.将带宽限制策略应用到相应的端口上(8)#interface e1/0/1……………………….进入借口模式(9)#mls qos trust cos……………………...开启信任COS值(10)#service-policy input test………………应用策略表。
(完整版)锐捷交换机命令大全

【第一部分】交换机支持的命令:1.交换机基本状态:switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态2.交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令switch(config)#enable password xxa ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xxswitch#exit ;返回命令3.交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2 switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain;设置发vtp域名switch(config)#vtp password;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式4.交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address;设置IP地址switch(config)#ip default-gateway;设置默认网关switch#dir flash: ;查看闪存5.交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息【第二部分】路由器支持的命令:1.路由器显示命令:router#show run ;显示配置信息router#show interface ;显示接口信息router#show ip route ;显示路由信息router#show cdp nei ;显示邻居信息router#reload ;重新起动2.路由器口令设置:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname;设置交换机的主机名router(config)#enable secret xxx ;设置特权加密口令router(config)#enable password xxb ;设置特权非密口令router(config)#line console 0 ;进入控制台口router(config-line)#line vty 0 4 ;进入虚拟终端router(config-line)#login ;要求口令验证router(config-line)#password xx ;设置登录口令xx router(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令3.路由器配置:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟router(config-if)#ip address;设置IP地址router(config-if)#ip address second ;设置第二个IProuter(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address;设置子接口IProuter(config-subif.1)#encapsulation dot1q;绑定vlan中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导4.路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置文件rommon>confreg 0x2102 ;恢复配置文件rommon>reset;重新引导rommon>copy xmodem: flash: ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP rommon>TFTP_FILE=c2600.bin ;指定下载的文件rommon>tftpdnld ;从tftp下载rommon>dir flash: ;查看闪存内容rommon>boot ;引导IOS5.静态路由:ip route;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例6.动态路由:router(config)#ip routing ;启动路由转发router(config)#router rip ;启动RIP路由协议。
(完整版)华为交换机命令大全

华为交换机基本配置命令详解1、配置文件相关命令[Quidway]display current-configuration 显示当前生效的配置[Quidway]display saved-configuration显示flash中配置文件,即下次上电启动时所用的配置文件reset saved-configuration 檫除旧的配置文件reboot 交换机重启display version 显示系统版本信息2、基本配置[Quidway]super password 修改特权用户密码[Quidway]sysname 交换机命名[Quidway]interface ethernet 1/0/1 进入接口视图[Quidway]interface vlan 1进入接口视图[Quidway-Vlan-interfacex]ip address 10.1.1.11 255.255.0.0配置VLAN的IP地址[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.1.1.1静态路由=网关3、telnet配置[Quidway]user-interface vty 0 4 进入虚拟终端[S3026-ui-vty0-4]authentication-mode password 设置口令模式[S3026-ui-vty0-4]set authentication-mode password simple xmws123设置口令[S3026-ui-vty0-4]user privilege level 3 用户级别4、端口配置[Quidway-Ethernet1/0/1]duplex {half|full|auto} 配置端口工作状态[Quidway-Ethernet1/0/1]speed {10|100|auto} 配置端口工作速率[Quidway-Ethernet1/0/1]flow-control 配置端口流控[Quidway-Ethernet1/0/1]mdi {across|auto|normal} 配置端口平接扭接[Quidway-Ethernet1/0/1]port link-type {trunk|access|hybrid} 设置端口工作模式[Quidway-Ethernet1/0/1]undo shutdown 激活端口[Quidway-Ethernet1/0/2]quit 退出系统视图5、链路聚合配置[DeviceA] link-aggregation group 1 mode manual 创建手工聚合组1[Qw_A] interface ethernet 1/0/1 将以太网端口Ethernet1/0/1加入聚合组1 [Qw_A-Ethernet1/0/1] port link-aggregation group 1[Qw_A-Ethernet1/0/1] interface ethernet 1/0/2 将以太网端口Ethernet1/0/1加入聚合组1[Qw_A-Ethernet1/0/2] port link-aggregation group 1[Qw_A] link-aggregation group 1 service-type tunnel # 在手工聚合组的基础上创建t unnel业务环回组。
华为交换机基本切换的命令行

一、华为交换机基本切换的命令行1、用户视图2、系统视图system-view进系统视图命令[HUAWEI]进系统试图状态3、接口视图[HUAWEI]interface GigabitEthernet 0/0/1进接口视图命令进第一接口[Huawei-GigabitEthernet0/0/1]进接口视图状态4、退出命令视图[HUAWEI]quit5、配置主机名[huawei]sysname6、显示系统IOS名称以及版本信息[huawei]dis version7、查看交换机当前配置信息[huawei]display current-configuration8、显示已保存的配置信息[huawei]display saved-configuration9、保存当前配置信息save10、删除已保存的配置信息#reset saved-configuration11、进入接口视图[huawei]interface g0/0/1[huawei-GigabitEthernet]12、配置接口类型[huawei-GigabitEthernet]port link-type access [huawei-GigabitEthernet]port default vlan 213、shutdown命令用来关闭当前接口。
14、undo shutdown命令用来开启当前接口。
15、display interface命令用来查看接口当前运行状态和接口统计信息16、display interface brief命令用来查看接口状态和配置的简要信息。
17、display ip interface brief命令用来查看接口与IP相关的简要信息,包括IP地址、子网掩码、物理链路和协议的Up/Down状态以及处于不同状态的接口数目。
二、划分vlanvlan 2quitintervlan 2ip add 192.168.1.254 24 quitvlan 3quitintervlan 3ip add 192.168.2.254 24 quitinter g0/0/1port link-type access port default vlan 2 quitinter g0/0/2port link-type trunk port trunk all vlan 2 to 3 quit。
华为交换机常见命令

一、清空配置:<HUAWEI> reset saved-configuration(清楚下次启动时使用的配置文件信息)然后重启设备,重启设备室提示保存信息,选择“NO”。
<HUAWEI> reset saved-configurationWarning: The action will delete thesaved configuration in the device.The configuration will be erased toreconfigure. Continue? [Y/N]:yWarning: Now clearing the configuration inthe device.Info: Succeeded in clearing the configuration in the device.<HUAWEI> rebootInfo: The system is now comparing the configuration, pleasewait.Warning: The configuration has been modified, and it will be saved tothe next startup saved-configuration file flash:/vrpcfg.zip. Continue?[Y/N]:n //此处请选择“N”Info: If want to reboot with saving diagnosticinformation, input 'N' and then execute 'reboot save diagnostic-information'.System will reboot! Continue?[Y/N]:y二、通过STelnet/Telnet登录交换机设置新的Console口登录密码# 以登录用户界面的认证方式为密码认证,密码为Huawei@123为例,配置如下。
交换机路由器命令大全(结合配置实例)

交换机路由器命令大全(结合配置实例)交换机路由器命令大全(结合配置实例)交换机和路由器是计算机网络中常用的网络设备,用于实现数据包的转发和路由选择。
在实际应用中,我们需要使用命令来配置交换机和路由器的各项参数。
本文将给出交换机和路由器常用命令的大全,并结合实际配置示例进行说明。
一、交换机命令1. 查看交换机基本信息查看交换机型号、固件版本、序列号等基本信息:show version2. 配置交换机端口设置交换机接口的速率、全双工模式等参数:interface interface_namespeed speed_valueduplex {full | half}3. 查看交换机端口状态查看交换机端口的连接状态、速率、工作模式等信息:show interfaces status4. 配置交换机VLAN创建VLAN和端口关联,实现VLAN的隔离和管理:vlan vlan_idname vlan_nameinterface interface_name5. 查看交换机MAC表显示交换机学习到的MAC地址和对应的端口:show mac-address-table6. 配置交换机链路聚合将多个物理端口绑定为一个逻辑端口,提高带宽和冗余性:interface port-channel channel_numberdescription description_textswitchport mode trunk/access7. 交换机Spanning Tree配置配置交换机的Spanning Tree协议参数,避免网络环路:spanning-tree vlan vlan_idpriority priority_value二、路由器命令1. 查看路由表显示路由器的路由表,包括直连路由、静态路由和动态路由表项:show ip route2. 配置静态路由手动配置路由器的静态路由表,指定目的网络和下一跳信息:ip route destination_network subnet_mask next_hop_ip3. 配置路由器接口配置路由器的接口参数,包括IP地址、子网掩码、描述等:interface interface_nameip address ip_address subnet_maskdescription description_text4. 配置路由器OSPF协议配置路由器之间的OSPF动态路由协议,实现网络的动态路由选择:router ospf process_idnetwork network_address wildcard_mask area area_number5. 配置路由器ACL配置路由器的访问控制列表,用于控制数据包的流量:access-list access_list_number permit/deny source destination6. 配置路由器NAT配置路由器的网络地址转换功能,实现内网与外网的互通:interface interface_nameip nat inside/outside三、配置实例1. 配置交换机端口接口GigabitEthernet0/1配置为100Mbps全双工模式:interface GigabitEthernet0/1speed 100duplex full2. 配置交换机VLAN创建VLAN10,将接口GigabitEthernet0/1划分到VLAN10:vlan 10name VLAN10interface GigabitEthernet0/13. 配置路由器接口将接口GigabitEthernet0/0配置为192.168.1.1/24的IP地址:interface GigabitEthernet0/0ip address 192.168.1.1 255.255.255.0description LAN interface4. 配置静态路由配置路由器的静态路由表,将目的网络192.168.2.0/24指向下一跳192.168.1.2:ip route 192.168.2.0 255.255.255.0 192.168.1.25. 配置路由器ACL设置访问控制列表,允许源IP地址为192.168.1.0/24的流量通过:access-list 1 permit 192.168.1.0 0.0.0.2556. 配置路由器NAT设置路由器的NAT,将内部接口GigabitEthernet0/1地址转换为公网地址:interface GigabitEthernet0/1ip nat inside以上是交换机和路由器常用命令的大全以及配置实例。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1、Switch> 用户模式
2、Switch>enable 进入特权模式
Switch#
3、Switch#config terminal 进入全局模式
Switch(config)#
4、Switch(config)#interface f0/1 进入接口模式
Switch(config-if)#
5、Switch(config)#line console 0 进入line模式
Switch(config-line)#
exit 退回上层
end 结束所有操作
6、Switch(config)#hostname aaa 配置主机名
7、switch#show running-config 查看配置情况
8、Switch(config)#enable password 111 设置使能密码(明文)
9、Switch(config)#enable secret 111 设置使能密码(密文)
Switch(config)#line console 0 设置console密码
Switch(config-line)#password 333
Switch(config-line)#login
10、Switch(config)#interface vlan1
Switch(config-if)#ip address 192.168.1.1 255.255.255.0 设置IP地址Switch(config-if)#no shutdown
11、Switch(config)#ip default-gateway 192.168.1.10 设置网关
12、Switch#show mac-address-table 查看MAC地址表
13、Switch#show cdp cdp全局配置信息
14、Switch#show cdp interface f0/1 cdp接口配置信息
15、Switch#show cdp traffic cdp包的配置信息
16、Switch#show cdp neighbors cdp邻居基本信息
17、Switch#show cdp neighbors detail cdp邻居详细信息
Switch#show cdp neighbors entry
18、Switch#copy running-config startup-config
Switch#write 保存交换机配置信息
19、Switch#erase startup-config 恢复出厂信息
Switch#reload 重新加载
20、交换机密码恢复
*断开电源
*按住MODE键,加电(等待数秒)
*switch:出现此符号
*switch:flash_init 初始化flash
*switch:dir flash: (查看文件,可省去)
*switch:rename config.text config.old 改名
*switch:boot 重启
*switch>enable 进入特权
*switch#dir flash: (查看文件,可省去)
*switch#rename config.old config.text改名
*switch#copy flash:config.text running-config 复制到系统内
*switch#confit terminal 进入全局模式
*switch(config)#enable password 222 设置新密码
21、switch#show vlan-sw brief 查看vlan
22、switch#vlan database 进入vlan模式
switch(vlan)#vlan 20 name bbb 创建vlan并命名
23、switch(vlan)#no vlan 20 删除vlan
24、添加端口到vlan(单个)
switch(config)#interface f0/1 进入接口模式
switch(config-if)#switchport access vlan 10 添加至vlan10
switch(config-if)#end 退出
switch#show vlan brief (id) 验证vlan
switch(config)#show running-config interface f0/1(查看某接口)25、添加端口到vlan(批量)
switch(config)#interface range f0/1 - 5
switch(config-if-range)#switchport access vlan 10
26、switch(config)#interface f0/1 进入接口
switch(config-if)#switchport mode trunk 设置为trunk(永久)
switch(config-if)#switchport mode dynamic desirable/auto(其它trunk)
switch(config-if)#switchport trunk allowed vlan remove 10 移除vlan10) switch(config-if)#switchport trunk allowed vlan add 20 添加vlan20 27、switch#show interface f0/1 switchport 查看接口模式
show ip interface brief。