Cisco交换机与路由器命令总结

Cisco交换机与路由器命令总结

1.查看信息

show version    查看版本及引导信息 
show running-config    查看运行设置 
show startup-config    查看开机设置 
show interface g0/1    显示端口信息 
show ip router      显示路由信息 
show clock      查看系统时钟 
show log        查看日志 
show interface counters    查看接口流量 
show interface description  查看端口的连接状态与描述 
show interface status  查看端口的链接状态、所属vlan以及速率双工
show cdp neighbors  查看CDP邻居 
show processes cpu  查看设备CPU使用率   
show vlan br    查看vlan数据库   
show ip int brief //查看所有端口状况
show int des    //查看所有端口的描述
show int f0/1  //查看f0/1接口状态
show run int f0/1    //查看f0/1配置状况
show run int valn 180    //查看Vlan 的配置状态
show vtp stauts  //查看vtp 的状态
show clock      //查看交换机当前的时间
show ntp stauts    //查看ntp 是否同步
show ip ssh  //查看SSH配置

2.设置console登录的密码

(confing)#line console 0
(config-line)#password 123
(config-line)#login


3.设置进入特权模式的密码

(config)#enable password abc
(config)#login
 或者
(config)#enable secret 456
(config)#login

4.设置远程登入(telnet)的密码(登入后,如需进入特权模式,还需要设置进入特权模式的密码)

(config)#line vty 0 4
(config-line)#password 789
(config-lline)#login
说明:在全局配置模式下使用service password-encryption命令加密明文的口令
write保存设置


5.Cisco路由器与交换机口令恢复

#路由器的密码恢复:
1)重启路由器,并同时按下Ctrl+breack键中断IOS的加载,进入ROM monitor模式
2)将配置寄存器的值改为0x2142原值为0X2102,表示启动时忽略startup的配置
Rommom>confreg 0X2142
Rommom>reset
3)路由器将重启,将无法加载配置文件因此不会有登录密码
4)进入配置模式后,将配置文件手动加载回来
Router#copy startup-config running-config
5)通过show run命令查看路由器配置的密码,更改密码
6)修改配置寄存器的值,并保持配置
Router(config)#config-register 0x2102
Router(config)#exit
Router#copy running-config startup-config
#交换机的密码恢复:
1)拔掉交换机的电源插头
2)重新插好电源后,立即按住交换机上的mode键,当看到配置界面显示“switch”命令提示,松开”mode”键。进入故障恢复的简单IOS模式
3)使用命令“Flash_init”初始化Flash
4)将config,text文件名改成config.old
Switch:rename flash:config.text flash:config.old
5)重启交换机时将不会加载配置文件
Switch:boot
6)把配置文件的名字改回来
Switch#rename flash:config.old flash:config.text
7)手工加载配置文件
Switch#copy flash:config.text system:running-config
8)配置文件加载完成后,需要进入配置模式修改密码,最后保存配置,完成密码的恢复

6.常用的专用命令:

Switch(config)#no ip domain-lookup //禁用域名解析
witch(config)#line console 0            //进入控制台接口
Switch(config-line)#logging synchronous //使日志同步
Switch(config-line)#exec-timeout 0 0    //永不超时退出 (0分0秒)


7.全局设置

进入全局模式:  config terminal
设置交换机名称:    hostname hostname
设置访问用户及密码:  username username password password
设置特权密码密文:  enable secret password
设置将明文密码加密:  service password-encryption
设置路由器名:  hostname name
设置静态路由:  ip route destination subnet-mask next-hop
启动IP路由:  ip routing
启动IPX路由:  ipx routing
端口设置:  interface type slot/number
设置IP地址:  ip address address subnet-mask
设置IPX网络:  ipx network network
激活端口:  no shutdown
物理线路设置:  line type number
启动登录进程:  login [local|tacacs server]
设置登录密码:  password password
设置log存放路径:  logging 10.0.0.1
                  spanning-tree mode rapid_pvst
建立静态路由  ip route prefix mask {address | interface} [distance] [tag tag] [permanent]
Prefix :所要到达的目的网络
mask  :子网掩码
address :下一个跳的IP地址,即相邻路由器的端口地址。
interface  :本地网络接口
distance :管理距离(可选)
tag tag :tag值(可选)
permanent :指定此路由即使该端口关掉也不被移掉。
设置管理IP地址
int vlan 1
ip address 192.168.1.251 255.255.255.0 //
ip default-gateway 192.168.1.254 //设置默认路由,供其他网段访问


8.恢复出厂设置

en 
erase startup-config
delete flash:vlan.dat
reload 重启

9.设置errdisable

(config)#errdisable recovery cause all //开启errdiable 恢复的原因
(config)#errdisable recovery interval 300 //errdisable后300秒恢复


10.SNMP服务配置:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/0ba8e942cf11ecc047844776f9d8cde4.html