思科交换机-常用命令及配置

switch> 用户模式

1:进入特权模式enable

switch> enable

switch#

 

2:进入全局配置模式configure terminal

switch> enable

switch#configure terminal

switch(conf)#

 

3:交换机命名hostname name 以cisco001 为例

switch> enable

switch#c onfigure terminal

switch(conf)#hostname cisco001

cisco001(conf)#

 

4:配置使能口令(未加密)enable password cisco 以cisco 为例

switch> enable

switch#configure terminal

cisco001(conf)# enable password cisco

 

5:配置使能密码(加密)enable secret ciscolab 以cicsolab 为例

switch> enable

switch#configure terminal

switch(conf)# enable secret ciscolab

 

6:设置虚拟局域网vlan 1 interface vlan 1

switch> enable

switch#configure terminal

switch(conf)# interface vlan 1

switch(conf)# ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩码

switch (conf-if)#no shut 激活端口

switch (conf-if)#exit

switch (conf)#ip default-gateway 192.168.254 设置网关地址

 

7:进入交换机某一端口interface fastehernet 0/17 以17 端口为例

switch> enable

switch#configure terminal

switch(conf)# interface fastehernet 0/17

switch(conf-if)#

 

8:查看命令show

switch> enable

switch# show version 察看系统中的所有版本信息

show interface vlan 1 查看交换机有关ip 协议的配置信息

show running-configure 查看交换机当前起作用的配置信息

show interface fastethernet 0/1 察看交换机1 接口具体配置和统计信息

show mac-address-table 查看mac 地址表

 

9:交换机恢复出厂默认恢复命令

switch> enable

switch# erase startup-configure

switch# reload

 

10:交换机的密码恢复

拔下交换机电源线。

用手按着交换机的MODE 键,插上电源线

在switch:后执行flash_ini 命令:switch: flash_ini

查看flash 中的文件: switch: dir flash:

把“config.text”文件改名为“config.old”: switch: rename flash: config.text flash: config.old

执行boot: switch: boot

交换机进入是否进入配置的对话,执行no :

进入特权模式察看flash 里的文件: show flash :

把“config.old”文件改名为“config.text”: switch: rename flash: config.old flash: config.text

把“ config.text ” 拷入系统的“ running-configure ”: copy flash: config.text system :

running-configure

重新设置密码并保存。

 

11.交换机telnet 远程登录设置:

switch>en

switch#configure terminal

swich(conf)#enable password cisco 以cisco 为特权模式密码

swich(conf)#interface vlan 1 以vlan 1端口作为远程登录的接口,其他端口亦可

swich(conf-if)#ip address 192.168.1.1 255.255.255.0

swich(conf-if)#no shut

swich(conf-if)#exit

swich(conf)line vty 0 4 设置0-4 个用户可以telnet 远程登陆

swich(conf-line)#login

swich(conf-line)#password 123456

 

12.交换机ssh远程登录设置:

 a.设定一个非默认的hostname

Switch(config)#hostname cisco

 b.配置域名:

cisco(config)#ip domain-name test

c.指定加密长度:

cisco(config)#crypto key generate rsa

How many bits in the modulus [512]: 1024

% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

d.将vty线路下的登录方式改为 ssh

cisco(config)#line vty 0 4

cisco(config-line)#transport in ssh

 

13.配置vtp同步

说明:VTP(VLAN Trunking Protocol):是VLAN中继协议,它是思科私有协议。作用是同步各个交换机之间的VLAN信息。

posted @ 2017-09-05 20:48  时光x86  阅读(9007)  评论(0编辑  收藏  举报