当前位置:文档之家› Cisco常见思科命令总结

Cisco常见思科命令总结

Cisco常见思科命令总结
Cisco常见思科命令总结

思科路由器|交换机配置命令

第一章 实验拓扑、终端服务器配置

命令作用

R1>enable从用户模式进入特权模式

R1#configure terminal进入配置模式

R1(config)#interface g0/0进入千兆位以太网接口模式

R1(config-if)#ip add 172.16.0.1 255.255.255.0配置接口的IP地址

R1(config-if)#no shutdown打开接口

R1(config)#line vty 0 4进入虚拟终端vty 0~vty 4

R1(config-line)#password cisco配置虚拟终端密码为cisco

R1(config-line)#login用户要进入路由器,需要先进行登录

Exit退回到上一级模式

R1(config)#enable password cisco配置进入特权模式的密码为cisco,密码不加密

End (Ctrl+Z)直接回到特权模式

R1#show int g0/0显示g0/0接口信息

R1(config)#hostname Terminal-Server配置路由器的主机名为Terminal-Server

R1(config)#enable secret cisco配置进入特权模式的密码为cisco,密码加密

R1(config)#no ip domain-lookup路由器不使用DNS服务器解析主机的IP地址

R1(config-line)#logging synchonous对路由器上的提示信息进行同步,防止信息干扰我们输入命令R1(config)#no ip routing关闭路由器的路由功能

R1(config)#ip default-gateway 10.1.14.254配置路由器访问其他网段时所需的网关

R1#show line显示各线路的状态

R1(config)#line33 48进入33~38线路模式

R1(config-line)#transport input all允许所有协议进入线路

R1(config)#int loopback0进入Loopback0环回接口

R1(config)#ip host R1 1.1.1.1为1.1.1.1主机起一个主机名R1

R1(config)#alias exec crl clear line 33为命令起一个别名

R1(config)#privilege exec level 0 clear line把命令clear line 的等级改为0,在用户模式下也可以执行它

R1(config)#banner motd设置用户登录路由器时的提示信息

第二章 路由器基本配置命令汇总

命令作用

R1#clock set hh:mm:ss month day year设置路由器的时间

R1#show clock显示路由器的时间

R1#show history显示历史命令

R1#terminal no editing关闭CLI的编辑功能

R1#terminal editing打开CLI的编辑功能

R1#terminal histroy size 50修改历史命令缓冲区的大小

R1#copy running-config startup-config把内存中的配置文件保存到NVRAM中

R1(config-if)#clock rate 128000配置串口上的时钟(DCE端)

R1#show version显示路由器的IOS版本等信息

R1#show running-config显示内存中的配置文件

R1#show startup-config显示NVRAM中的配置文件

R1#show interface s0/0/0显示接口的信息

R1#show flash显示FLASH的有关信息

R1#show controllers s0/0/0显示s0/0/0的控制器信息

R1#show ip arp显示路由器中的arp表

R1#copy running-config tftp把内存中的配置文件复制到TFTP服务器上R1#copy tftp running-config把TFTP服务器上的配置文件复制到内存中R1#copy flash tftp把FLASH中的IOS保存到TFTP服务器上rommon 1>confreg 0x2142在rommon模式下修改配置寄存器的值rommon 1>i (boot)在rommon模式下重启路由器

R1#copy startup-config running-config把NVRAM中的配置文件复制到内存中

R1(config)#config-register 0x2102修改配置寄存器值为0x2102

R1#reload重启路由器

R1#delete flash删除FLASH中的IOS

R1#copy tftp flash从TFTP服务器上复制IOS到FLASH中rommon 1>tftpdnld在rommon模式下,从TFTP服务器下载IOS R1#show cdp显示CDP运行信息

R1#show cdp interface显示CDP在各接口的运行情况

R1#show cdp neighbors显示CDP邻居信息

R1#show cdp entry R2显示CDP邻居R2的详细信息

R1#clear cdp table清除CDP邻居表

R1(config-if)#no cdp enable接口下关闭CDP

R1(config)#no cdp run / cdp run关闭/打开整个路由器的CDP

R1(config)#cdp timer 30CDP每30 s发送一次

R1(config)#cdp holdtime 120让邻居为本设备发送的CDP消息保持120 s

第三章 静态路由命令汇总

命令作用

R1(config)#ip route 1.1.1.0 255.255.255.0 s0/1配置静态路由

R1#show ip route查看路由表

R1(config)#ip classless / no ip classless打开/关闭有类路由功能

R1#ping 2.2.2.2 source loopback 0指定源端口进行ping 测试

第四章 RIP命令汇总

命令作用

R1#show ip route查看路由表

R1#show ip protocols查看IP路由协议配置和统计信息

R1#show ip rip database查看RIP数据库

R1#debug ip rip动态查看RIP的更新过程

R1#clear ip route *清除路由表

R1(config)#router rip启动RIP进程

R1(config-router)#network 1.0.0.0通告网络

R1(config-router)#version 2定义RIP的版本

R1(config-router)#no auto-summary关闭自动汇总

R1(config-if)#ip rip send version配置RIP发送的版本

R1(config-if)#ip rip receive version配置RIP接收的版本

R1(config-router)#passive-interface s0/1配置被动接口

R1(config-router)#neighbor A.B.C.D配置单播更新的目标

R1(config-if)#ip summary-address rip ip mask配置RIP手工汇总

R1(config)#key chain lgm定义钥匙链

R1(config-keychain)#key <0-2147483647>配置Key ID

R1(config-keychain-key)#key-string cisco配置Key ID的密匙

R1(config-if)#ip rip triggered配置触发更新

R1(config-if)#ip rip authentication mode md5/text配置认证模式

R1(config-if)#ip rip authention key-chain lgm配置认证使用的钥匙链

R1(config-router)#timers basic配置更新的计时器

R1(config-router)#maximum-paths配置等价路径的最大值

R1(config)#ip default-network向网络中注入默认路由

第五章 EIGR命令汇总

命令作用

R1#show ip eigrp neighbors查看EIGRP邻居表

R1#show ip eigrp topology查看EIGRP拓扑结构数据库

R1#show ip eigrp interface查看运行EIGRP路由协议的接口的状况

R1#show ip eigrp traffic查看EIGRP发送和接收到的数据包的统计情况R1#debug eigrp neighbors查看EIGRP动态建立邻居关系的情况

R1#debug eigrp packets显示发和接收的EIGRP数据包

R1(config-if)#ip hello-interval eigrp配置EIGRP的HELLO发送周期

R1(config-if)#ip hold-time eigrp配置EIGRP的HELLO hold时间

R1(config)#router eigrp number启动EIGRP路由进程

R1(config)#no auto-summary关闭自动汇总

R1(config-if)#ip authentication mode eigrp配置EIGRP的认证模式

R1(config-if)#ip authentication key-chain eigrp在接口上调用钥匙链

R1(config-router)#variance配置非等价负载均衡

R1(config-if)#delay <1-16777215>配置接口下的延迟

R1(config-if)#bandwidth 100配置接口下的带宽

R1(config-if)#ip summary-address eigrp手工路由汇总

第六章 OSPF命令汇总

命令作用

R1#show ip route查看路由表

R1#show ip ospf neighbor查看OSPF邻居的基本信息

R1#show ip ospf database查看OSPF拓扑结构数据库

R1#show ip ospf interface查看OSPF 路由器接口的信息

R1#show ip ospf查看OSPF进程及其细节

R1#debug ip ospf adj查看OSPF邻接关系创建或中断的过程R1#debug ip ospf events显示OSPF发生的事件

R1#debug ip ospf packet显示路由器收到的所有的OSPF数据包R1(config)#router ospf process ID启动OSPF路由进程

R1(config-router)#router-id 1.1.1.1配置路由器ID

R1(config-router)#network 192.168.1.0 0.0.0.255 area ared id通告网络及网络所在的区域

R1(config-if)#ip ospf network broadcast / point-to-point配置接口网络类型

R1(config-if)#ip ospf cost <1-65535>配置接口Cost值

R1(config-if)#ip ospf hello-interval <1-65535>s配置Hello间隔

R1(config-if)#ip ospf dead-interval <1-65535>s配置OSPF邻居的死亡时间

R1(config-if)#ip ospf priority <0-255>配置接口优先级

R1(config-router)#auto-cost reference-bandwidth <1-4294967>配置参考带宽

R1#clear ip ospf process清除OSPF进程

R1(config-router)#area area-id authentication启动区域简单口令认证

R1(config-if)#ip ospf authentication-key cisco配置认证密码

R1(config-router)#area area-id authentication message-digest启动区域MD5认证

R1(config-if)#ip ospf message-digest-key <1-255> md5 cisco配置key ID及密匙

R1(config-if)#ip ospf authentication启用链路简单口令认证

R1(config-if)#ip ospf authentication message-digest启用链路MD5认证

R1(config-router)#default-information originate向OSPF区域注入默认路由

第七章 HDLC、PPP命令汇总

命令作用

R1(config-if)#encapsulation hdlc把接口的封装改为HDLC

R1(config-if)#encapsulation PPP把接口的封装改为PPP

R1(config-if)#ppp pap sent-username R1 password 123PAP认证时,向对方发送用户名R1和密码123 R1(config-if)#ppp authentication pap PPP的认证方式为PAP

R1(config-if)#user R1 password 123为对方创建用户R1,密码为123

R1#debug ppp authentication打开PPP的认证调试过程

R1(config-if)#ppp authentication chap PPP的认证方式为CHAP

第八章 帧中继命令汇总

命令作用

R1(config)#frame-relay switching把路由器当成帧中继交换机

R1(config-if)#encapsulation frame-relay接口封装成帧中继

R1(config-if)#frame-relay lmi-type cisco配置LMI的类型

R1(config-if)#frame-relay intf-type dce配置接口是帧中继的DCE还是DTE

R1(config-if)#frame-relay route dlci interface s0/0 dlci配置帧中继交换表

R1#show frame-relay route显示帧中继交换表

R1#show frame pvc显示帧中继PVC状态

R1#show frame lmi显示帧中继LMI信息

R1#show frame-relay map查看帧中继映射

R1(config-if)#no frame-relay inverse-arp关闭帧中继自动映射

R1(config-if)#ip split-horizon打开水平分割

R1(config)#int s0/0/0.1 multipoint创建点到多点子接口

R1(config)#int s0/0/0.3 point-to-point创建点到点子接口

R1(config-subif)#frame-relay interface-dlci 104在点到点子接口上配置DLCI

第九章 ACL命令汇总

命令作用R1#show ip access-lists查看所定义的IP访问控制列表

R1#clear access-list counters将访问控制列表计数器清零

R1(config)#access-list <1-199> permit / deny定义ACL

R1(config-if)#ip access-group在接口下应用ACL

R1(config-line)#access-class <1-199> in / out在vty下应用ACL

R1(config)#ip access-list standard / extended定义命名的ACL

R1(config)#time-range time定义时间范围

R1(config)#username username password password建立本地数据库

R1(config-line)#autocommand定义自动执行的命令

第十章 DHCP命令汇总

命令作用R1#show ip dhcp pool查看DHCP地址池的信息

R1#show ip dhcp binding查看DHCP的地址绑定情况

R1#show ip dhcp database查看DHCP数据库

R1#show ip interface查看接口信息

R1#debug ip dhcp server events动态查看DHCP服务器的事件

R1(config)#service dhcp开启DHCP服务

R1(config)#no ip dhcp conflict logging关闭DHCP冲突日志

R1(config)#ip dhcp pool配置DHCP分配的地址池

R1(dhcp-config)#network DHCP服务器要分配的网络的掩码R1(dhcp-config)#default-router默认网关

R1(dhcp-config)#domain-name域名

R1(dhcp-config)#netbios-name-server WINS服务器

R1(dhcp-config)#dns-server域名服务器

R1(dhcp-config)#option 150 ip FTP服务器

R1(dhcp-config)#lease配置租期

R1(dhcp-config)#ip dhcp excluded-address排除地址段

R1(config-if)#ip helper-address配置DHCP中继的地址

第十一章 NAT命令汇总

命令作用

R1#clear ip nat translation *清除动态NAT表

R1#show ip nat translation查看NAT表

R1#show ip nat statistics查看NAT转换的统计信息

R1#debug ip nat动态查看NAT转换过程

R1(config)#ip nat inside source static配置静态NAT

R1(config-if)#ip nat inside配置NAT内部接口

R1(config-if)#ip nat outside配置NAT外部接口

R1(config)#ip nat pool配置动态NAT地址池

R1(config)#ip nat inside source list access-list-number pool name配置动态NAT

R1(config)#ip nat inside source list access-list-numbe r pool name overload配置PAT

第十二章 交换机基本配置命令汇总

命令作用

S1(config-if)#duples {full|half|auto}配置以太口的双工属性

S1(config-if)#speed {10|100|1000|auto}配置以太口的速率

S1(config)#ip default-gateway 172.16.0.254配置默认网关

S1(config-if)#switch mode access把端口以为访问模式

S1(config-if)#switch port-security打开交换机的端口安全功能

S1(config-if)#switch port-security maximum 1该端口下的MAC条目最大数量为1

S1(config-if)#switch port-security violation配置交换机端口安全

S1(config-if)#switch port-security mac-address MAC地址允许指定MAC地址的设备接入本接口S1#show mac-address-table显示MAC地址表

S1(config-if)#mac-address XXXX.XXXX.XXXX改变接口的MAC地址

rename flash;config.text flash;config.old将FLASH中的文件改名

copy xmodem; flash;c2950-i6q412-mz.121-22.EA5a.bin通过Xmodem模式把文件复制到FLASH中boot重启交换机

第十三章 VLAN、Trunk和VTP命令汇总

命令作用

S1#vlan database进入到VLAN Database配置模式

S1(vlan)#vlan 2 name VLAN2创建VLAN 2

S1(config-if)#switch access vlan 2把端口划分到VLAN 2中

S1(config)#interface range f0/2 - 3批量配置接口的属性

S1#show vlan查看VLAN的信息

S1(config-if)#switchport trunk encanpsulation配置Trunk链路的封装类型

S1(config-if)#switch mode trunk把接口配置为Trunk

S1#show interface f0/13 trunk查看交换机端口的Trunk状态

S1(config-if)#switchport nonegotiate Trunk链路上不发送Trunk协商包

S1(config)#vtp mode server配置交换机为VTP server

S1(config)#vtp domain NAME配置VTP域名

S1(config)#vtp password cisco配置VTP的密码

S1(config)#vtp mode client配置交换机为VTP client

S3(vlan)#vtp transparent配置交换机为VTP transparent

S1#show vtp status显示VTP的状态

S1(config)#vtp pruning启用VTP修剪

S1(config)#vtp version 2VTP版本为 2

S1(config)#interface port-channel 1创建以太通道

S1(config-if)#channel-group 1 mode on把接口加入到以太通道中,并指明以太通道模式

S1(config)#port-channel load-balance dst-mac配置EtherChannel的负载平衡方式

S1#show etherchannel summary查看EtherChannel的简单信息

第十四章 STP命令汇总

命令作用

S1#show spanning-tree查看STP树信息

S1(config)#spanning-tree vlan 1 priority 4096配置VLAN1的桥优先级

S1(config)#spanning-tree portfast配置为Portfast,当有设备接入时立即进入转发状态

S1(config)#spanning-tree uplinkfast配置Uplinkfast特性

S1(config)#spanning-tree backbonefast配置Backbonefast特性

S1(config)#spanning-tree mode rapid-pvst把STP的运行模式设为RSTP+PVST

S1(config-if)#spanning-tree link-type point-to-point把接口的链路类型改为点对点

S1(config)#spanning-tree mode mst把生成树的模式改为MST

S1(config)#spanning-tree mst configuration进入MST的配置模式

S1(config-mst)#name TEST-MST命名MST的名字

S1(config-mst)#revision 1配置MST的revision号

S1(config-mst)#instance 1 vlan 1-2把VLAN 1和VLAN 2的生成树映射到实例1

S1(config-if)##spanning-tree guard root在接口下配置Root Guard特性

S1(config-if)#spanning-tree bpduguard enable在接口上配置Bpduguard特性

第十五章 VLAN间路由命令汇总

命令作用

S1(config)#int g0/0.1创建子接口

S1(config-subif)#encap dot1q 1 native子接口承载哪个VLAN的流量以及封装类型S1(config)#ip routing打开路由功能

S1(config-if)#no switchport接口不作为交换机接口

S1(config)#ip cef开启CEF功能

相关主题
文本预览
相关文档 最新文档