测品娱乐
您的当前位置:首页Cisco思科命令总结

Cisco思科命令总结

来源:测品娱乐
思科路由器|交换机配置命令

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

命令

R1>enable

R1#configure terminalR1(config)#interface g0/0

R1(config-if)#ip add 172.16.0.1 255.255.255.0R1(config-if)#no shutdownR1(config)#line vty 0 4

R1(config-line)#password ciscoR1(config-line)#loginExit

R1(config)#enable password ciscoEnd (Ctrl+Z)R1#show int g0/0

R1(config)#hostname Terminal-ServerR1(config)#enable secret ciscoR1(config)#no ip domain-lookupR1(config-line)#logging synchonousR1(config)#no ip routing

R1(config)#ip default-gateway 10.1.14.254R1#show line

R1(config)#line 33 48

R1(config-line)#transport input allR1(config)#int loopback 0R1(config)#ip host R1 1.1.1.1

R1(config)#alias exec crl clear line 33R1(config)#privilege exec level 0 clear lineR1(config)#banner motd

作用

从用户模式进入模式进入配置模式

进入千兆位以太网接口模式配置接口的IP地址打开接口

进入虚拟终端vty 0~vty 4配置虚拟终端密码为cisco

用户要进入路由器,需要先进行登录退回到上一级模式

配置进入模式的密码为cisco,密码不加密直接回到模式显示g0/0接口信息

配置路由器的主机名为Terminal-Server

配置进入模式的密码为cisco,密码加密路由器不使用DNS服务器解析主机的IP地址

对路由器上的提示信息进行同步,防止信息干扰我们输入命令关闭路由器的路由功能

配置路由器访问其他网段时所需的网关显示各线路的状态进入33~38线路模式允许所有协议进入线路进入Loopback0环回接口

为1.1.1.1主机起一个主机名R1为命令起一个别名

把命令clear line 的等级改为0,在用户模式下也可以执行它设置用户登录路由器时的提示信息

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

命令

R1#clock set hh:mm:ss month day yearR1#show clockR1#show history

R1#terminal no editingR1#terminal editing

R1#terminal histroy size 50

R1#copy running-config startup-configR1(config-if)#clock rate 128000R1#show version

R1#show running-configR1#show startup-configR1#show interface s0/0/0R1#show flash

R1#show controllers s0/0/0R1#show ip arp

R1#copy running-config tftpR1#copy tftp running-configR1#copy flash tftp

rommon 1>confreg 0x2142rommon 1>i (boot)

R1#copy startup-config running-configR1(config)#config-register 0x2102R1#reload

R1#delete flashR1#copy tftp flashrommon 1>tftpdnldR1#show cdp

R1#show cdp interfaceR1#show cdp neighbors

作用

设置路由器的时间显示路由器的时间显示历史命令

关闭CLI的编辑功能打开CLI的编辑功能

修改历史命令缓冲区的大小

把内存中的配置文件保存到NVRAM中配置串口上的时钟(DCE端)显示路由器的IOS版本等信息显示内存中的配置文件显示NVRAM中的配置文件显示接口的信息

显示FLASH的有关信息显示s0/0/0的控制器信息显示路由器中的arp表

把内存中的配置文件复制到TFTP服务器上把TFTP服务器上的配置文件复制到内存中把FLASH中的IOS保存到TFTP服务器上在rommon模式下修改配置寄存器的值在rommon模式下重启路由器

把NVRAM中的配置文件复制到内存中修改配置寄存器值为0x2102重启路由器

删除FLASH中的IOS

从TFTP服务器上复制IOS到FLASH中

在rommon模式下,从TFTP服务器下载IOS显示CDP运行信息

显示CDP在各接口的运行情况显示CDP邻居信息

R1#show cdp entry R2R1#clear cdp table

R1(config-if)#no cdp enableR1(config)#no cdp run / cdp runR1(config)#cdp timer 30R1(config)#cdp holdtime 120显示CDP邻居R2的详细信息清除CDP邻居表接口下关闭CDP

关闭/打开整个路由器的CDPCDP每30 s发送一次

让邻居为本设备发送的CDP消息保持120 s

第三章 静态路由命令汇总

命令

R1(config)#ip route 1.1.1.0 255.255.255.0 s0/1R1#show ip route

R1(config)#ip classless / no ip classlessR1#ping 2.2.2.2 source loopback 0

作用

配置静态路由查看路由表

打开/关闭有类路由功能指定源端口进行ping 测试

第四章 RIP命令汇总

命令

R1#show ip route

R1#show ip protocolsR1#show ip rip databaseR1#debug ip rip

R1#clear ip route *R1(config)#router rip

R1(config-router)#network 1.0.0.0R1(config-router)#version 2

R1(config-router)#no auto-summaryR1(config-if)#ip rip send versionR1(config-if)#ip rip receive version

R1(config-router)#passive-interface s0/1R1(config-router)#neighbor A.B.C.DR1(config-if)#ip summary-address rip ip maskR1(config)#key chain lgm作用

查看路由表

查看IP路由协议配置和统计信息查看RIP数据库

动态查看RIP的更新过程清除路由表启动RIP进程通告网络

定义RIP的版本关闭自动汇总

配置RIP发送的版本配置RIP接收的版本配置被动接口

配置单播更新的目标配置RIP手工汇总定义钥匙链

R1(config-keychain)#key <0-21474837>R1(config-keychain-key)#key-string ciscoR1(config-if)#ip rip triggered

R1(config-if)#ip rip authentication mode md5/textR1(config-if)#ip rip authention key-chain lgmR1(config-router)#timers basicR1(config-router)#maximum-pathsR1(config)#ip default-network配置Key ID

配置Key ID的密匙配置触发更新配置认证模式

配置认证使用的钥匙链配置更新的计时器配置等价路径的最大值向网络中注入默认路由

第五章 EIGR命令汇总

命令

R1#show ip eigrp neighborsR1#show ip eigrp topologyR1#show ip eigrp interfaceR1#show ip eigrp trafficR1#debug eigrp neighborsR1#debug eigrp packets

R1(config-if)#ip hello-interval eigrpR1(config-if)#ip hold-time eigrpR1(config)#router eigrp numberR1(config)#no auto-summary

R1(config-if)#ip authentication mode eigrp

R1(config-if)#ip authentication key-chain eigrpR1(config-router)#variance

R1(config-if)#delay <1-16777215>R1(config-if)#bandwidth 100R1(config-if)#ip summary-address eigrp

作用

查看EIGRP邻居表

查看EIGRP拓扑结构数据库

查看运行EIGRP路由协议的接口的状况

查看EIGRP发送和接收到的数据包的统计情况查看EIGRP动态建立邻居关系的情况显示发和接收的EIGRP数据包配置EIGRP的HELLO发送周期配置EIGRP的HELLO hold时间启动EIGRP路由进程关闭自动汇总

配置EIGRP的认证模式在接口上调用钥匙链配置非等价负载均衡配置接口下的延迟配置接口下的带宽手工路由汇总

第六章 OSPF命令汇总

命令

R1#show ip route

R1#show ip ospf neighborR1#show ip ospf databaseR1#show ip ospf interfaceR1#show ip ospf

R1#debug ip ospf adjR1#debug ip ospf eventsR1#debug ip ospf packet

R1(config)#router ospf process IDR1(config-router)#router-id 1.1.1.1

R1(config-router)#network 192.168.1.0 0.0.0.255 area ared idR1(config-if)#ip ospf network broadcast / point-to-pointR1(config-if)#ip ospf cost <1-65535>

R1(config-if)#ip ospf hello-interval <1-65535>sR1(config-if)#ip ospf dead-interval <1-65535>sR1(config-if)#ip ospf priority <0-255>

R1(config-router)#auto-cost reference-bandwidth <1-4294967>R1#clear ip ospf process

R1(config-router)#area area-id authenticationR1(config-if)#ip ospf authentication-key cisco

R1(config-router)#area area-id authentication message-digestR1(config-if)#ip ospf message-digest-key <1-255> md5 ciscoR1(config-if)#ip ospf authentication

R1(config-if)#ip ospf authentication message-digestR1(config-router)#default-information originate

作用

查看路由表

查看OSPF邻居的基本信息查看OSPF拓扑结构数据库查看OSPF 路由器接口的信息查看OSPF进程及其细节

查看OSPF邻接关系创建或中断的过程显示OSPF发生的事件

显示路由器收到的所有的OSPF数据包启动OSPF路由进程配置路由器ID

通告网络及网络所在的区域配置接口网络类型配置接口Cost值配置Hello间隔

配置OSPF邻居的死亡时间配置接口优先级配置参考带宽清除OSPF进程

启动区域简单口令认证配置认证密码

启动区域MD5认证配置key ID及密匙

启用链路简单口令认证启用链路MD5认证

向OSPF区域注入默认路由

第七章 HDLC、PPP命令汇总

命令

R1(config-if)#encapsulation hdlcR1(config-if)#encapsulation PPP

R1(config-if)#ppp pap sent-username R1 password 123R1(config-if)#ppp authentication papR1(config-if)#user R1 password 123R1#debug ppp authentication

R1(config-if)#ppp authentication chap

作用

把接口的封装改为HDLC把接口的封装改为PPP

PAP认证时,向对方发送用户名R1和密码123PPP的认证方式为PAP

为对方创建用户R1,密码为123打开PPP的认证调试过程PPP的认证方式为CHAP

第八章 帧中继命令汇总

命令

R1(config)#frame-relay switching

R1(config-if)#encapsulation frame-relayR1(config-if)#frame-relay lmi-type ciscoR1(config-if)#frame-relay intf-type dce

R1(config-if)#frame-relay route dlci interface s0/0 dlciR1#show frame-relay routeR1#show frame pvcR1#show frame lmi

R1#show frame-relay map

R1(config-if)#no frame-relay inverse-arpR1(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作用

把路由器当成帧中继交换机接口封装成帧中继配置LMI的类型

配置接口是帧中继的DCE还是DTE配置帧中继交换表显示帧中继交换表显示帧中继PVC状态显示帧中继LMI信息查看帧中继映射关闭帧中继自动映射打开水平分割

创建点到多点子接口创建点到点子接口

在点到点子接口上配置DLCI

第九章 ACL命令汇总

命令

R1#show ip access-lists

R1#clear access-list counters

R1(config)#access-list <1-199> permit / denyR1(config-if)#ip access-group

R1(config-line)#access-class <1-199> in / outR1(config)#ip access-list standard / extendedR1(config)#time-range time

R1(config)#username username password passwordR1(config-line)#autocommand

作用

查看所定义的IP访问控制列表将访问控制列表计数器清零定义ACL

在接口下应用ACL在vty下应用ACL定义命名的ACL定义时间范围建立本地数据库定义自动执行的命令

第十章 DHCP命令汇总

命令

R1#show ip dhcp poolR1#show ip dhcp bindingR1#show ip dhcp databaseR1#show ip interface

R1#debug ip dhcp server eventsR1(config)#service dhcp

R1(config)#no ip dhcp conflict loggingR1(config)#ip dhcp poolR1(dhcp-config)#network

R1(dhcp-config)#default-routerR1(dhcp-config)#domain-name

R1(dhcp-config)#netbios-name-serverR1(dhcp-config)#dns-serverR1(dhcp-config)#option 150 ipR1(dhcp-config)#lease

作用

查看DHCP地址池的信息查看DHCP的地址绑定情况查看DHCP数据库查看接口信息

动态查看DHCP服务器的事件开启DHCP服务关闭DHCP冲突日志配置DHCP分配的地址池

DHCP服务器要分配的网络的掩码默认网关域名

WINS服务器域名服务器FTP服务器配置租期

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

配置DHCP中继的地址

第十一章 NAT命令汇总

命令

R1#clear ip nat translation *R1#show ip nat translationR1#show ip nat statisticsR1#debug ip nat

R1(config)#ip nat inside source staticR1(config-if)#ip nat insideR1(config-if)#ip nat outsideR1(config)#ip nat pool

R1(config)#ip nat inside source list access-list-number pool name

R1(config)#ip nat inside source list access-list-number pool name overload

清除动态NAT表查看NAT表

查看NAT转换的统计信息动态查看NAT转换过程配置静态NAT配置NAT内部接口配置NAT外部接口配置动态NAT地址池配置动态NAT配置PAT

作用

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

命令

S1(config-if)#duples {full|half|auto}S1(config-if)#speed {10|100|1000|auto}S1(config)#ip default-gateway 172.16.0.254S1(config-if)#switch mode accessS1(config-if)#switch port-security

S1(config-if)#switch port-security maximum 1S1(config-if)#switch port-security violation

S1(config-if)#switch port-security mac-address MAC地址S1#show mac-address-table

S1(config-if)#mac-address XXXX.XXXX.XXXXrename flash;config.text flash;config.old

copy xmodem; flash;c2950-i6q412-mz.121-22.EA5a.binboot

作用

配置以太口的双工属性配置以太口的速率配置默认网关

把端口以为访问模式

打开交换机的端口安全功能该端口下的MAC条目最大数量为1配置交换机端口安全

允许指定MAC地址的设备接入本接口显示MAC地址表改变接口的MAC地址将FLASH中的文件改名

通过Xmodem模式把文件复制到FLASH中重启交换机

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

命令

S1#vlan database

S1(vlan)#vlan 2 name VLAN2S1(config-if)#switch access vlan 2S1(config)#interface range f0/2 - 3S1#show vlan

S1(config-if)#switchport trunk encanpsulationS1(config-if)#switch mode trunkS1#show interface f0/13 trunk

S1(config-if)#switchport nonegotiateS1(config)#vtp mode serverS1(config)#vtp domain NAMES1(config)#vtp password ciscoS1(config)#vtp mode clientS3(vlan)#vtp transparentS1#show vtp status

S1(config)#vtp pruningS1(config)#vtp version 2

S1(config)#interface port-channel 1

S1(config-if)#channel-group 1 mode on

S1(config)#port-channel load-balance dst-macS1#show etherchannel summary

作用

进入到VLAN Database配置模式创建VLAN 2

把端口划分到VLAN 2中批量配置接口的属性查看VLAN的信息

配置Trunk链路的封装类型把接口配置为Trunk

查看交换机端口的Trunk状态Trunk链路上不发送Trunk协商包配置交换机为VTP server配置VTP域名配置VTP的密码

配置交换机为VTP client

配置交换机为VTP transparent显示VTP的状态启用VTP修剪VTP版本为 2创建以太通道

把接口加入到以太通道中,并指明以太通道模式配置EtherChannel的负载平衡方式查看EtherChannel的简单信息

第十四章 STP命令汇总

命令

S1#show spanning-tree

S1(config)#spanning-tree vlan 1 priority 4096S1(config)#spanning-tree portfast

作用

查看STP树信息

配置VLAN1的桥优先级

配置为Portfast,当有设备接入时立即进入转发状态

S1(config)#spanning-tree uplinkfastS1(config)#spanning-tree backbonefastS1(config)#spanning-tree mode rapid-pvst

S1(config-if)#spanning-tree link-type point-to-pointS1(config)#spanning-tree mode mst

S1(config)#spanning-tree mst configurationS1(config-mst)#name TEST-MSTS1(config-mst)#revision 1S1(config-mst)#instance 1 vlan 1-2S1(config-if)##spanning-tree guard root

S1(config-if)#spanning-tree bpduguard enable配置Uplinkfast特性配置Backbonefast特性

把STP的运行模式设为RSTP+PVST把接口的链路类型改为点对点把生成树的模式改为MST进入MST的配置模式命名MST的名字

配置MST的revision号

把VLAN 1和VLAN 2的生成树映射到实例1在接口下配置Root Guard特性在接口上配置Bpduguard特性

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

命令

S1(config)#int g0/0.1

S1(config-subif)#encap dot1q 1 nativeS1(config)#ip routing

S1(config-if)#no switchportS1(config)#ip cef

作用

创建子接口

子接口承载哪个VLAN的流量以及封装类型打开路由功能

接口不作为交换机接口开启CEF功能

因篇幅问题不能全部显示,请点此查看更多更全内容