交换机基本状态:
switch: ;ROM状态, 路由器是rommon>
hostname> ;使用者模式
hostname# ;特权模式
hostname(config)# ;全域性配置模式
hostname(config-if)# ;介面状态
交换机口令设定:
switch>enable ;进入特权模式
switch#config terminal ;进入全域性配置模式
switch(config)#hostname ;设定交换机的 WordPress 主机名
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 ;设定登入口令 xx
switch#exit ;返回命令
交换机 VLAN 设定:
switch#vlan database ;进入 VLAN 设定
switch(vlan)#vlan 2 ;建 VLAN 2
switch(vlan)#no vlan 2 ;删 vlan 2
switch(config)#int f0/1 ;进入埠 1
switch(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 模式
交换机设定 IP 地址:
switch(config)#interface vlan 1 ;进入 vlan 1
switch(config-if)#ip address ;设定 IP 地址
switch(config)#ip default-gateway ;设定预设闸道器
switch#dir flash: ;检视快闪内存
交换机显示命令:
switch#write ;储存配置资讯
switch#show vtp ;检视 vtp 配置资讯
switch#show run ;检视当前配置资讯
switch#show vlan ;检视 vlan 配置资讯
switch#show interface ;检视埠资讯
switch#show int f0/0 ;检视指定埠资讯