|
1, 删除配置信息到出厂配置
Switch#delete flash:vlan.dat 先删除VLAN配置文件
Switch#erase start 再删除全部配置
Erasing the nvram filesystem willremove all files! Continue? [confirm]
[OK]
Erase of nvram: complete
Switch#reload 重新启动
Proceed with reload? [confirm]
2, 保存配置
方法1: Switch#write
方法2: Switch#copy run start
设置主机名
Switch#conf t
Switch(config)#hostname XXX
3,设置IP地址和缺省网关
Switch(config)#int vlan1
Switch(config-if)#ip address192.168.1.10 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#ip default-gateway192.168.1.100
4, 增加VLAN。Catalyst 2900XL系列交换机最大支持64个激活的VLAN,
VLAN ID 号从1-1005。
Switch# vlan database
Switch(vlan)# vlan vlan-id name vlan-name
Switch# show vlan name vlan-name
Switch(vlan)# no vlan vlan-id //删除VLAN
5. 将端口加入VLAN。
Switch# configure terminal
Switch(config)# interface interface
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan vlan-id
Switch(config-if)# show interface interface-id switchport
---------------------
例如:
(
将端口加入到VLAN中
Switch(config)#int f0/4
Switch(config-if)#switchportmode access
Switch(config-if)#switchport access vlan 3
)
————————————————————————————————————
2900XL VLAN config
--------------------------------------------------------------------------------
Switch# vlan database
Switch(vlan)# vtp domain domain-name
Switch(vlan)# vtp domain domain-name password password-value
Switch(vlan)# vtp server
Switch(vlan)# show vtp status
若想Disable VTP,只须将VTP模式改为transparent
即Switch(vlan)# vtp transparent
2. 激活VTP V2(交换机默认的是VTP V1)。
Switch# vlan database
Switch(vlan)# vtp v2-mode
Switch# show vtp status
3. 增加VLAN。Catalyst 2900XL系列交换机最大支持64个激活的VLAN,
VLAN ID 号从1-1005。
Switch# vlan database
Switch(vlan)# vlan vlan-id name vlan-name
Switch# show vlan name vlan-name
Switch(vlan)# no vlan vlan-id //删除VLAN
4. 将端口加入VLAN。
Switch# configure terminal
Switch(config)# interface interface
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan vlan-id
Switch(config-if)# show interface interface-id switchport
5. 配置trunk 端口。
Switch# configure terminal
Switch(config)# interface interface
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation isl
Switch(config-if)# end
Switch# show interface interface switchport
Switch# copy running-config startup-config
6. 配置trunk 上允许的VLAN。
Switch(config)# interface interface
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan remove vlan-id-range
Switch(config-if)# switchport trunk allowed vlan add vlan-id-range
Switch(config-if)# end
Switch# show interface interface switchport allowed-vlan
若想取消trunk端口,只需
Switch(config-if)# no switchport mode
7. 使用STP实现负载。
实现负载分担有两种方法:
1) 使用端口优先级。
配置:
Switch_1(config-if)# interface fa0/1
Switch_1(config-if)# spanning-tree vlan 8 9 10 port-priority 10
Switch_1(config)# interface fa0/2
Switch_1(config-if)# spanning-tree vlan 3 4 5 6 port-priority 10
2) 使用路径值。例如:
Switch_1(config)# interface fa0/1
Switch_1(config-if)# spanning-tree vlan 2 3 4 cost 30
Switch_1(config)# interface fa0/2
Switch_1(config-if)# spanning-tree vlan 8 9 10 cost 30
注:VTP(VLAN Trunking Protocol):是VLAN中继协议,也被称为虚拟局域网干道协议。
它是一个OSI参考模型第二层的通信协议,主要用于管理在同一个域的网络范围内VLANs的建立、删除和重命名。在一台VTP Server 上配置一个新的VLAN时,该VLAN的配置信息将自动传播到本域内的其他所有交换机。这些交换机会自动地接收这些配置信息,使其VLAN的配置与VTP Server保持一致,从而减少在多台设备上配置同一个VLAN信息的工作量,而且保持了VLAN配置的统一性。
VTP通过网络(ISL帧或cisco私有DTP帧)保持VLAN配置统一性。VTP在系统级管理增加,删除,调整的VLAN,自动地将信息向网络中其它的交换机广播。此外,VTP减小了那些可能导致安全问题的配置。便于管理,只要在vtp server做相应设置,vtp client会自动学习vtp server上的vlan信息
* 当使用多重名字VLAN能变成交叉--连接。
* 当它们是错误地映射在一个和其它局域网,VLAN能变成内部断开。
VTP有三种工作模式:VTP Server、VTP Client 和 VTP Transparent。 一般,一个VTP域内的整个网络只设一个VTP Server。VTP Server维护该VTP域中所有VLAN 信息列表,VTP Server可以建立、删除或修改VLAN。VTP Client虽然也维护所有VLAN信息列表,但其VLAN的配置信息是从VTP Server学到的,VTP Client不能建立、删除或修改VLAN。VTP Transparent相当于是一上独立的交换机,它不参与VTP工作,不从VTPServer学习VLAN的配置信息,而只拥有本设备上自己维护的VLAN信息。VTP Transparent可以建立、删除和修改本机上的 VLAN信息。
思科2960交换机,命令大全
cisco 交换机2960配置配置密码:
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
版权声明:本文为博主原创文章,未经博主允许不得转载。 |
|
|
|
|
|
|