如果你想考思科認證或者準備從事跟網絡設備相關的工作,對思科設備命令的熟悉是一項基礎的技能,下面講解下思科交換機常用命令及配置。
(01)打開思科交換CLI,首先進入的是用户模式,如果要進行配置操作需要進入特權模式。Switch>enableSwitch#
(02)從特權模式進入全局配置模式Switch#configure terminalSwitch(config)#
(03)在特權模式下可以對交換機進行命名,這樣在配置多台交換機時,避免將配置寫錯交換機。Switch(config)#hostname cisco-sw1
(04)配置交換端口密碼,登錄特權模式時需要輸入該密碼,避免設備被其他人使用。cisco-sw1(config)#enable password ciscops:password表示密碼為明文
(05)給交換機配置使能密碼,進入特權模式時需要輸入密碼才能進入,避免設備可以被其他人員使用。cisco-sw1(config)#enable secret ciscoswitchps:secret表示密碼用的密文
(06)交換機配置VLAN,並給將端口加入到該VLAN:cisco-sw1(config)#vlan 2cisco-sw1(config-vlan)#name testcisco-sw1(config-vlan)#exitcisco-sw1(config)#interface fastEthernet 0/1cisco-sw1(config-if)#switchport mode accesscisco-sw1(config-if)#switchport access vlan 2
(07)進入交換機某一端口switch> enableswitch#configure terminalswitch(conf)# interface fastehernet 0/1switch(conf-if)#
(08)show:查看命令,交換機的所有配置和其它相關信息都需要通過show命令查看。switch> enableswitch# show version 察看系統中的所有版本信息switch#show vlan id 1 查看交換機有關vlan配置信息switch#show running-configure 查看交換機當前起作用的配置信息switch#show interface fastethernet 0/1 察看交換機1 接口具體配置和統計信息switch#show mac-address-table 查看mac地址轉發表
(09)交換機恢復出廠switch> enableswitch# erase startup-configureswitch# reload
(10)telnet 遠程登錄設置:switch>enswitch#configure terminalswich(conf)#enable password cisco 以cisco 為特權模式密碼swich(conf)#interface vlan 1 以vlan 1端口作為遠程登錄的接口,其他端口亦可swich(conf-if)#ip address swich(conf-if)#no shutswich(conf-if)#exitswich(conf)line vty 0 4 設置0-4 個用户可以telnet 遠程登陸swich(conf-line)#password 123456swich(conf-line)#login
(11)SSH遠程登錄設置:Switch#conf tEnter configuration commands, one per line. End with CNTL/ch(config)#hostname cisco-sw1 交換機重新命名cisco-sw1(config)#ip domain-name 配置域名cisco-sw1(config)#line vty 0 4cisco-sw1(config-line)#transport input ssh 登錄方式為SSHcisco-sw1(config-line)#exitcisco-sw1(config)#crypto key generate rsa 配置祕鑰The name for the keys will be: hoose the size of the key modulus in the range of 360 to 2048 for yourGeneral Purpose Keys. Choosing a key modulus greater than 512 may takea few many bits in the modulus [512]: 1024 思科推薦使用1024% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]