交换机基本配置.docx
《交换机基本配置.docx》由会员分享,可在线阅读,更多相关《交换机基本配置.docx(15页珍藏版)》请在冰点文库上搜索。
交换机基本配置
v交換機基本配置
NB產線常用交換機有CISCO交換機和3COM交換機﹐其中CISCO交換機又包括CISCO2950和CISCO3550兩種﹐而這兩種交換機的常用配置又基本相同﹐故在此針對CISCO2950介紹如下﹕
1.交換機命名
switch>enable
在此處輸入密碼
switch#configureterminal
switch(config)#hostnameNB05-RIN01-CISCO2950
NB05-RIN01-CISCO2950(config)#nohostname#恢復默認值
switch(config)#exit
switch#copyrunning-configstartup-config
switch#exit
switch>exit
2.交換機IP
switch>enable
在此處輸入密碼
switch#configureterminal
switch(config)#interfacevlan1
switch(config-if)#ipaddress172.16.10.10255.255.255.0
switch(config-if)#noipaddress#取消IP地址
switch(config-if)#noshutdown開放端口
switch(config-if)#CTRL+Z
switch#copyrunning-configstartup-config
switch#showipint
switch#exit
switch>exit
3.交換機安全設置
switch>enable
switch#configureterminal
switch(config)#enablepasswordfoxconn
switch(config)#enablesecretchinamis
switch(config)#lineconsole0
switch(config-line)#login
switch(config-line)#passwordfoxconn
switch(config-line)#exit
switch(config)#linevty04
switch(config-line)#login
switch(config-line)#passwordfoxconn
switch(config-line)#CTRL+Z
switch#showrunning-config
switch#copyrunning-configstartup-config
switch#exit
switch>exit
4.交換機VLAN設置
switch>enable
在此處輸入密碼
switch#vlnadatabase
switch(config-data)#vlan2namerunin
switch(config-data)#vlan3namepre-test
switch(config-data)#vlan4nameddl
取消VLAN用如下命令
switch(config-data)#novlan2
switch(config-data)#novlan3
switch(config-data)#novlan4
switch(config-data)#exit
switch#configureterminal
switch(config)#interfacefastethernet1
switch(config-if)#noshutdown#啟用端口
switch(config-if)#shutdown#關閉端口
switch(config-if)#switchportaccessmode
switch(config-if)#switchportaccessvlan2
switch(config-if)#interfacefastethernet2
switch(config-if)#noshutdown
switch(config-if)#swithportmodeaccess
switch(config-if)#swithportaccessvlan3
switch(config-if)#interfacefastethernet3
switch(config-if)#noshutdown
switch(config-if)#switchportaccessmode
switch(config-if)#switchportaccessvlan4
switch(config-if)#CTRL+Z
switch#showvlan
switch#showipinterfaces
switch#copyrunning-configstartup-config
switch#exit
switch>exit
5.交換機配置備份
目的﹕在交換機配置改變時快速還原﹐在需要相同配置的交換機上快速配置。
條件﹕一台TFTPSERVER(任何裝有TFTPSERVER.EXE軟件的電腦均可作為TFTPSERVER,并且戶要有上傳下載的權限﹐有兩種方式可供選擇﹐一是用本地電腦﹐用于本地備份﹔二是用局域網中的一台電腦﹐用于網絡備份。
)一台交換機﹐若是本地備份﹐需要一條直通線連接電腦跟交換機的任一以太網口﹐并要確保在交換機端能PING通電腦﹔若是網絡配置則不需要直通線。
配置﹕如下所示
switch>enable
在此處輸入密碼
switch#showrunning-config
switch#showstartup-config
switch#copyrunning-configtftp
#這時需要提供SERVER的IP地址和備份文件在SERVER上的文件名﹐若直接輸入回車則取默認值。
switch#copyrunning-configtftp
#同上
還原則如下﹕
switch#copytftprunning-config
#同上
switch#copytftpstartup-config
#同上
6.常用命令
switch#showversion查看交換機的硬件平台軟件版本
switch#showinterfaces查看交換機的接口狀態
switch#showrunning-config查看運行配置
switch#showstartup-config查看配置文件
switch#showvlan查看交換機上配置的VLAN
switch#showipinterfaces查看具體的接口所屬的具體VLAN
switch#showmac-address-table查看交換機上連接工站的MAC地址
switch#showcdpneighborsdetail查看交換機所連的周邊設備