Cisco2960交换机配置(二)

vlan划分:

switch>en                 #进入特权模式
switch>输入登陆密码
switch#conf t                #进入全局配置模式
switch(config)#vlan 10 name aaa        #定义vlan10并命名为aaa,命名可以省略
switch(config)#exit            #退出
switch(config)#vlan 20        #定义vlan20
switch(config)#exit            #退出
switch(config)#interface range f0/1-10    #进入端口1-10
switch(config-if-rang)#switchport mode access    #设置端口链路为access
switch(config-if-rang)#switchport access vlan 10    #为端口设置vlan10
switch(config-if-rang)#exit    #退出
switch(config)#interface range f0/11-20    #进入端口11-20
switch(config-if-rang)#switchport mode access    #设置端口链路为access
switch(config-if-rang)#switchport access vlan 20    #为端口设置vlan10
switch(config-if-rang)#exit    #退出
switch(config)#int f0/24    #进入端口24
switch(config-if)#switchport mode trunk        #配置端口链路为trunk
switch(config-if)#exit
switch(config)#end            #回到特权模式
-------------------------------------------------------------------------------------------------
端口聚合:
聚合条件:端口号必须连续,端口工作速率、链路类型(trunk/access/Hybrid)工作方式(全双工)一致,链路两端同时配置切组别相同
switch>en                 #进入特权模式
switch>输入登陆密码
switch#conf t                #进入全局配置模式
switch(config)#interface range f0/1-4    #进入端口1-4,不同交换机允许的最大聚合端口数不同
switch(config-if-rang)#switchport mode trunk    #配置端口链路为trunk(一起配置保证链路类型一致)
switch(config-if-rang)#speed 100                #配置速率为100(一起配置保证链路类型一致)
switch(config-if-rang)#duplex half                #配置双工方式half/full/auto (一起配置保证链路类型一致)
switch(config-if-rang)#channel-group 1 mode on    #配置端口1-4聚合,组别为1并开启
switch(config-if-rang)#exit
switch(config)#port-channel load-balance det-ip    #配置端口负载平衡

-------------------------------------------------------------------------------------------------

恢复出厂设置:
上电后长按MODE键
switch:flash_init        #清除缓存
switch:load_helper        #获取登陆许可,提示Unknown cmd: load_helper则该命令无效,忽略即可
switch:dir flash:        #查看配置目录,注意结尾冒号区分半角全角。不同交换机命令不同dir_flash:/dir flash
switch:rename flash:config.text flash:config.old    #将配置文件改名使其失效
switch:dir flash:        #查看文件名是否修改成功
switch:boot            #重启交换机。由于没有配置文件,交换机会默认恢复出厂
出现“would you like to enter the initial configuration dialog? [yes/no]:”时,输入“no”
switch>en                #进入特权模式
switch#rename flash:config.old flash:config.text    #将配置文件恢复
switch#dir flash:        #查看是否修改成功
switch#copy flash:config.text system:running-config    #将配置文件载入
switch#conf t            #进入全局配置模式
switch(config)#no enable password    #删除密码
switch(config)#no enable secret        #删除加密的密码
switch(config)#end
switch#show running-config            #查看现行的配置
switch#copy running-config startup-config    #备份配置文件到NVRAM
------------------------------------------------------------------------------------------------
镜像端口配置:
SPAN指源和目的端口都在同一台机
RSPAN指源和目的端口不在同一台机
VSPAN可以镜像整个或数个VLAN到一个目的端口
switch>en                 #进入特权模式
switch>输入登陆密码
switch#conf t                #进入全局配置模式
switch(config)#monitor session 1 source interface gigabitEthernet 0/2-5 rx     #配置镜像源,源端口为2-5,both(双向)/rx(接收)/tx(发送)
switch(config)#monitor session 1 destination interface gigabitEthernet 0/6    #配置镜像目的端口为6
switch(config)#exit
switch#write            #保存配置
switch#show monitor        #查看配置结果
switch#conf t                #进入全局配置模式
switch(config)#no monitor session 1        #删除镜像端口
switch#write            #保存配置
switch#show monitor        #查看删除结果
创建VSPAN
monitor session 1 source vlan 10-12 rx
------------------------------------------------------------------------------------------------
端口关闭与启动
switch(config-if)#shutdown        #关闭
switch(config-if)#no shutdown    #开启

猜你喜欢

转载自blog.csdn.net/Chrisliuluo/article/details/110622497