Switch>enable //进入特权模式
Switch#configure terminal //进入配置模式
Switch(config)#hostname S2960 //修改主机名称
S2960(config)#no ip domain-lookup //关闭域名查找功能
S2960(config)#line console 0 //配置console口
S2960(config-line)#logging synchronous //开启日志同步
S2960(config-line)#exec-timeout 0 0 //配置超时时间为0
S2960(config-line)#password 123456 //配置console口密码(超级终端)
S2960(config-line)#login //开启登录密码
S2960(config)#enable secret 123456 //配置特权密码
S2960(config)#line vty 0 4 //允许虚拟终端0到4即5个用户同时telnet这台设备
S2960(config-line)#password 123456 //telnet登录的密码
S2960(config-line)#login //开启远程登录
S2960(config-line)#logging synchronous //开启日志同步
S2960(config-line)#exec-timeout 5 30 //配置控制台EXEC会话超时时间为5分30秒,防止用户忘记注销或离开
S2960(config)#service password-encryption //打开加密服务,show run的时候看到的密码加密。
S2960(config)#username admin password 123456 //设置全局的用户名和密码。
S2960(config)#banner motd #this is cisco 2960# //配置远程登录提示信息
S2960(config)#interface vlan 1 //配置默认vlan
S2960(config-if)#ip address 192.168.1.2 255.255.255.0 //配置管理IP地址
S2960(config-if)#no shutdown //启用端口
S2960(config)#vlan 100 //增加新的vlan 100
S2960(config-vlan)#name IT //设置Vlan的名称为IT
S2960(config)#interface fa0/2 //进入2号端口
S2960(config-if)#switchport mode access //将端口配置为access模式
S2960(config-if)#switchport access vlan 100 //将2号端口划分到vlan 100中
S2960#show vlan brief //显示vlan信息
S2960(config)#interface fastEthernet 0/1 //进入1号端口
S2960(config-if)#description SL //配置描述信息
S2960(config)#interface f 0/24 //进入24端口
S2960(config-if)#switchport mode trunk //将端口配置为trunk模式