switch>用户模式
1:进入特权模式enable
switch>enable
switch#
2:进入全局配置模式configureterminal
switch>enable
switch#configureterminal
switch(conf)#
3:交换机命名hostnameaptech2950以aptech2950为例
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch-2950
aptech2950(conf)#
4:配置使能口令enablepasswordcisco以cisco为例
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch2950
aptech2950(conf)#enablepasswordcisco
5:配置使能密码enablesecretciscolab以cicsolab为例
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch2950
aptech2950(conf)#enablesecretciscolab
6:设置虚拟局域网vlan1interfacevlan1
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch2950
aptech2950(conf)#interfacevlan1
aptech2950(conf-if)#ipaddress192.168.1.1255.255.255.0配置交换机端口ip和子网掩
码
aptech2950(conf-if)#noshut是配置处于运行中
aptech2950(conf-if)#exit
aptech2950(conf)#ipdefault-gateway192.168.254设置网关地址
7:进入交换机某一端口interfacefastehernet0/17以17端口为例
switch>enable
switch#configureterminalswitch(conf)#hostnameaptch2950
aptech2950(conf)#interfacefastehernet0/17
aptech2950(conf-if)#
8:查看命令show
switch>enable
switch#showversion察看系统中的所有版本信息
showinterfacevlan1查看交换机有关ip协议的配置信息
showrunning-configure查看交换机当前起作用的配置信息
showinterfacefastethernet0/1察看交换机1接口具体配置和统计信息
showmac-address-table查看mac地址表
showmac-address-tableaging-time查看mac地址表自动老化时间
9:交换机恢复出厂默认恢复命令
switch>enable
switch#erasestartup-configure
switch#reload
10:双工模式设置
switch>enable
switch#configureterminal
switch2950(conf)#hostnameaptch-2950
aptech2950(conf)#interfacefastehernet0/17以17端口为例
aptech2950(conf-if)#duplexfull/half/auto有full,half,auto三个可选
项
11:cdp相关命令
switch>enable
switch#showcdp查看设备的cdp全局配置信息
showcdpinterfacefastethernet0/17查看17端口的cdp配置信息
showcdptraffic查看有关cdp包的统计信息
showcdpnerghbors列出与设备相连的cisco设备
12:csico2950的密码恢复
拔下交换机电源线。
用手按着交换机的MODE键,插上电源线
在switch:后执行flash_ini命令:switch:flash_ini
查看flash中的文件:switch:dirflash:
把“config.text”文件改名为“config.old”:switch:renameflash:config.textflash:config.old
执行boot:switch:boot
交换机进入是否进入配置的对话,执行no:
进入特权模式察看flash里的文件:showflash:把“config.old”文件改名为“config.text”:switch:renameflash:config.oldflash:config.text
把“config.text”拷入系统的“running-configure”:copyflash:config.textsystem:
running-configure
把配置模式重新设置密码存盘,密码恢复成功。
13:交换机telnet远程登录设置:
switch>en
switch#configureterminal
switch(conf)#hostnameaptech-2950
aptech2950(conf)#enablepasswordcisco以cisco为特权模式密码
aptech2950(conf)#interfacefastethernet0/1以17端口为telnet远程登录端口
aptech2950(conf-if)#ipaddress192.168.1.1255.255.255.0
aptech2950(conf-if)#noshut
aptech2950(conf-if)#exit
aptech2950(conf)linevty04设置0-4个用户可以telnet远程登陆
aptech2950(conf-line)#login
aptech2950(conf-line)#passwordedge以edge为远程登录的用户密码
主机设置:
ip192.168.1.2主机的ip必须和交换机端口的地址在同一网络
段
netmask255.255.255.0
gate-way192.168.1.1网关地址是交换机端口地址
运行:
telnet192.168.1.1
进入telnet远程登录界面
password:edge
aptech2950>en
password:cisco
aptech#
14:交换机配置的重新载入和保存
设置完成交换机的配置后:
aptech2950(conf)#reload
是否保存(y/n)y:保存设置信息n:不保存设置信息
1.在基于IOS的交换机上设置主机名/系统名:
switch(config)#hostnamehostname
在基于CLI的交换机上设置主机名/系统名:
switch(enable)setsystemnamename-string
2.在基于IOS的交换机上设置登录口令:
switch(config)#enablepasswordlevel1password在基于CLI的交换机上设置登录口令:
switch(enable)setpassword
switch(enable)setenalbepass
3.在基于IOS的交换机上设置远程访问:
switch(config)#interfacevlan1
switch(config-if)#ipaddressip-addressnetmask
switch(config-if)#ipdefault-gatewayip-address
在基于CLI的交换机上设置远程访问:
switch(enable)setinterfacesc0ip-addressnetmaskbroadcast-address
switch(enable)setinterfacesc0vlan
switch(enable)setiproutedefaultgateway
4.在基于IOS的交换机上启用和浏览CDP信息:
switch(config-if)#cdpenable
switch(config-if)#nocdpenable
为了查看Cisco邻接设备的CDP通告信息:
switch#showcdpinterface[typemodle/port]
switch#showcdpneighbors[typemodule/port][detail]
在基于CLI的交换机上启用和浏览CDP信息:
switch(enable)setcdp{enable|disable}module/port
为了查看Cisco邻接设备的CDP通告信息:
switch(enable)showcdpneighbors[module/port][vlan|duplex|capabilities|detail]
5.基于IOS的交换机的端口描述:
switch(config-if)#descriptiondescription-string
基于CLI的交换机的端口描述:
switch(enable)setportnamemodule/numberdescription-string
6.在基于IOS的交换机上设置端口速度:
switch(config-if)#speed{10|100|auto}
在基于CLI的交换机上设置端口速度:
switch(enable)setportspeedmoudle/number{10|100|auto}
switch(enable)setportspeedmoudle/number{4|16|auto}
7.在基于IOS的交换机上设置以太网的链路模式:
switch(config-if)#duplex{auto|full|half}
在基于CLI的交换机上设置以太网的链路模式:
switch(enable)setportduplexmodule/number{full|half}
8.在基于IOS的交换机上配置静态VLAN:
switch#vlandatabase
switch(vlan)#vlanvlan-numnamevlaswitch(vlan)#exit
switch#configureteriminal
switch(config)#interfaceinterfacemodule/number
switch(config-if)#switchportmodeaccess
switch(config-if)#switchportaccessvlanvlan-num
switch(config-if)#end
在基于CLI的交换机上配置静态VLAN:
switch(enable)setvlanvlan-num[namename]
switch(enable)setvlanvlan-nummod-num/port-list
9.在基于IOS的交换机上配置VLAN中继线:
switch(config)#interfaceinterfacemod/port
switch(config-if)#switchportmodetrunk
switch(config-if)#switchporttrunkencapsulation{isl|dotlq}
switch(config-if)#switchporttrunkallowedvlanremovevlan-list
switch(config-if)#switchporttrunkallowedvlanaddvlan-list
在基于CLI的交换机上配置VLAN中继线:
switch(enable)settrunkmodule/port[on|off|desirable|auto|nonegotiate]
Vlan-range[isl|dotlq|dotl0|lane|negotiate]
10.在基于IOS的交换机上配置VTP管理域:
switch#vlandatabase
switch(vlan)#vtpdomaindomain-name
在基于CLI的交换机上配置VTP管理域:
switch(enable)setvtp[domaindomain-name]
11.在基于IOS的交换机上配置VTP模式:
switch#vlandatabase
switch(vlan)#vtpdomaindomain-name
switch(vlan)#vtp{sever|cilent|transparent}
switch(vlan)#vtppasswordpassword
在基于CLI的交换机上配置VTP模式:
switch(enable)setvtp[domaindomain-name][mode{sever|cilent|transparent}][password
password]
12.在基于IOS的交换机上配置VTP版本:
switch#vlandatabase
switch(vlan)#vtpv2-mode
在基于CLI的交换机上配置VTP版本:
switch(enable)setvtpv2enable
13.在基于IOS的交换机上启动VTP剪裁:
switch#vlandatabase
switch(vlan)#vtppruning在基于CLI的交换机上启动VTP剪裁:
switch(enable)setvtppruningenable
14.在基于IOS的交换机上配置以太信道:
switch(config-if)#portgroupgroup-number[distribution{source|destination}]
在基于CLI的交换机上配置以太信道:
switch(enable)setportchannelmoudle/port-rangemode{on|off|desirable|auto}
15.在基于IOS的交换机上调整根路径成本:
switch(config-if)#spanning-tree[vlanvlan-list]costcost
在基于CLI的交换机上调整根路径成本:
switch(enable)setspantreeportcostmoudle/portcost
switch(enable)setspantreeportvlancostmoudle/port[costcost][vlan-list]
16.在基于IOS的交换机上调整端口ID:
switch(config-if)#spanning-tree[vlanvlan-list]port-priorityport-priority
在基于CLI的交换机上调整端口ID:
switch(enable)setspantreeportpri{mldule/port}priority
switch(enable)setspantreeportvlanpri{module/port}priority[vlans]
17.在基于IOS的交换机上修改STP时钟:
switch(config)#spanning-tree[vlanvlan-list]hello-timeseconds
switch(config)#spanning-tree[vlanvlan-list]forward-timeseconds
`switch(config)#spanning-tree[vlanvlan-list]max-ageseconds
在基于CLI的交换机上修改STP时钟:
switch(enable)setspantreehellointerval[vlan]
switch(enable)setspantreefwddelaydelay[vlan]
switch(enable)setspantreemaxageagingtiame[vlan]
18.在基于IOS的交换机端口上启用或禁用PortFast特征:
switch(config-if)#spanning-treeportfast
在基于CLI的交换机端口上启用或禁用PortFast特征:
switch(enable)setspantreeportfast{module/port}{enable|disable}
19.在基于IOS的交换机端口上启用或禁用UplinkFast特征:
switch(config)#spanning-treeuplinkfast[max-update-ratepkts-per-second]
在基于CLI的交换机端口上启用或禁用UplinkFast特征:
switch(enable)setspantreeuplinkfast{enable|disable}[rateupdate-rate][all-protocolsoff|on]
20.为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使
用下列命令:switch(config)#clusterenablecluster-name