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

如题所述

1.设置主机名/系统名 switch(config)# hostname “hostname” switch(enable) set system name name-string
2.设置登录口令 switch(config)# enable password level 1 password switch(enable) set password
switch(enable) set enalbepass
3.设置远程访问 switch(config)# inte***ce vlan 1
switch(config-if)# ip address ip-address netmask
switch(config-if)# ip default-gateway ip-address switch(enable) set inte***ce sc0 ip-address netmask broadcast-address
switch(enable) set inte***ce sc0 vlan
switch(enable) set ip route default gateway
4.启用和浏览CDP信息 switch(config-if)# cdp enable
switch(config-if)# no cdp enable switch(enable) set cdp {enable|disable} module/port
5、给交换机配置使能密码,进入特权模式时需要输入密码才能进入,避免设备可以被其他人员使用。cisco-sw1(config)#enable secret ciscoswitchps:secret表示密码用的密文
6、交换机配置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
7、进入交换机某一端口switch enableswitch#configure terminalswitch(conf)# interface fastehernet 0/1switch(conf-if)#
8、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地址转发表
9、交换机恢复出厂switch enableswitch# erase startup-configureswitch# reload
10、telnet 远程登录设置:switchenswitch#configure terminalswich(conf)#enable password cisco 以cisco 为特权模式密码swich(conf)#interface vlan 1 以vlan 1端口作为远程登录的接口,其他端口亦可swich(conf-if)#ip address 192.168.1.1 255.255.255.0swich(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/Z.Switch(config)#hostname cisco-sw1
交换机重新命名cisco-sw1(config)#ip domain-name cisco.com
配置域名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: cisco-sw1.cisco.comChoose 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 minutes.How many bits in the modulus [512]: 1024
思科推荐使用1024% Generating 1024 bit RSA keys, keys will be non-exportable
温馨提示:答案为网友推荐,仅供参考
相似回答