配置密码:

2960>en ;第一次密码为空
2960h#conf t ;进入全局配置模式
2960(config)#hostname swa ;设置交换机名
2960(config)#enable secret aaa ;设置特权加密口令为 aaa
2960(config)#enable password aax ;设置特权非密口令为 aax
2960(config)#line console 0 ;进入控制台口(Rs232)
2960(config-line)#password aa ;设置登录口令aa
2960(config-line)#login ;登录要求口令验证
2960(config-line)#line vty 0 4 ;进入虚拟终端virtual tty
2960(config-line)#password a ;设置登录口令a
2960(config-line)#login ;登录要求口令验证
2960(config-line)#exit ;返回上一层
2960(config)#exit ;返回上一层
2960#sh run ;看配置信息
2960#exit ;返回命令

配置Vlan

新建一个Vlan的命令

Switch>enable     进入特权模式

Switch#configure terminal      进入全局配置模式

Switch (config)# vlan vlan-id     创建一个Vlan或者进入Vlan配置模式

Switch (config-vlan)# name vlan-name 给Vlan命名(取消设置:no name)

Switch (config-vlan)# mtu mtu-size 设置最大通讯量(取消设置:no mtu)

Switch (config-vlan)#remote-span    开启远程流量监控(关闭:no remote-span)

Switch (config-vlan)# end 回到特权模式

Switch#show vlan {name vlan-name | id vlan-id}        查看当前配置

Switch#copy running-config startup config 保存配置

删除Vlan的命令

Switch>enable     进入特权模式

Switch#configure terminal      进入全局配置模式

Switch (config)# no vlan vlan-id       删除Vlan

Switch (config)# end 回到特权模式

Switch#show vlan brief    查看删除情况

Switch#copy running-config startup config 保存配置

端口加入特定Vlan的命令

Switch>enable     进入特权模式

Switch#configure terminal      进入全局配置模式

Switch (config)# interface interface-id    进入端口配置

Switch (config-if)# switchport mode access     将接口的模式设为访问模式

Switch (config-if)# switchport access vlan vlan-id 将端口加入指定的Vlan(恢复端口默认配置:default interface interface-id)

Switch (config-if)# end       回到特权模式

Switch#show running-config interface interface-id     查看端口模式

Switch#show interfaces interface-id switchport 查看端口详细配置

Switch#copy running-config startup-config 保存配置

批量端口加入特定Vlan的命令

int range fa0/1 - 10

switchport   access   VLan   V2

将特定端口设为trunk

2960-01(config)#default interface fastEthernet 0/1    端口恢复默认值    

2960-01(config)#interface fastethernet0/1            进入端口模式

2960-01(config-if)#switchport mode trunk           设置端口为trunk模式

2960-01(config-if)#switchport nonegotiate          将接口设置为不协商模式

2960-01(config-if)end

2960-01#wr

启用snmp

Switch>enable     进入特权模式

Switch#configure terminal      进入全局配置模式

Switch (config)# snmp-server community string [view view-name] [ro | rw] [access-list-number]

(关闭snmp: no snmp-server)

(删除团体字符: no snmp-server community string)    配置snmp团体字符并开启snmp代理服务

String: 团体口令字符(所有SNMP命令中只有设置团体口令的snmp-server community是必须的,其它的都是可选的.)

View: view 可以用于限定哪些MIB分支不能用本community-string存取预先用snmp-server view定义

ro | rw: ro获得MIB对象信息;rw获得并可以修改MIB对象信息

access-list-number:访问列表号

Switch (config)#access-list access-list-number {deny |

permit} source [source-wildcard]     配置拒绝或者允许访问snmp代理服务的IP地址,访问列表号为上一步指定的列表号

Switch (config)#end    回到特权模式

Switch#show running-config 查看配置

Switch#copy running-config startup-config 保存配置

cisco2960口令恢复

交换机口令恢复的步骤

⒈串口线连接到到交换机的console口。

⒉先按住交换机面板上的mode键,然后打开电源。

⒊初始化flash

>flash_init

⒋更名含有password的配置文件。

>rename flash:config.text flash:config.old

⒌启动交换机。

>boot

⒍进入特权模式。

>enable

⒎此时开机是已忽略password

#rename flash:config.old flash:config.text

⒏copy配置文件到当前系统中。

#copy flash:config.text system:running-config

⒐修改口令。

#configure terminal

#enable secret

⒑保存配置。

#write