思科设备命令大全

模式转换命令

  • 用户模式----特权模式,使用命令"enable"

  • 特权模式----全局配置模式,使用命令"config t"

  • 全局配置模式----接口模式,使用命令"interface+接口类型+接口号"

  • 全局配置模式----线控模式,使用命令"line+接口类型+接口号"

注:

  • 用户模式:查看初始化的信息.

  • 特权模式:查看所有信息、调试、保存配置信息

  • 全局模式:配置所有信息、针对整个路由器或交换机的所有接口

  • 接口模式:针对某一个接口的配置

  • 线控模式:对路由器进行控制的接口配置

 基本配置命令

命令描述
enable从用户模式进入特权模式
configure terminal进入配置模式
interface g0/0进入千兆以太网接口模式
ip address 172.16.0.1 255.255.0.0配置接口的ip 地址
no shutdown打开接口
line vty 0 4进入虚拟终端vty 0 - vty 4
password CISCO配置密码
login用户要进入路由器,需要先进行登录
exit退回到上一级模式
enable password CISCO配置进入特权模式的密码,密码不加密
end直接回到特权模式
show int g0/0显示g0/0 接口的信息
hostname Terminal-Server配置路由器的主机名
enable secret ccielab配置进入特权模式的密码,密码加密
no ip domain-lookup路由器不使用DNS 服务器解析主机的IP 地址
logging synchronous路由器上的提示信息进行同步,防止信息干扰我们输入命令
no ip routing关闭路由器的路由功能
ip default-gateway 10.1.14.254配置路由器访问其他网段时所需的网关
show line显示各线路的状态
line 33 48进入33-48 线路模式
transport input all允许所有协议进入线路
int loopback0进入loopback0 接口
ip host R1 2033 1.1.1.1为1.1.1.1 主机起一个主机名
alias exec cr1 clear line 33为命令起一个别名
privilege exec level 0 clear line把命令clear line 的等级改为0,在用户模式下也可以执行它
banner motd设置用户登录路由器时的提示信
clock set设置路由器的时间
show clock显示路由器的时间
show history显示历史命令
terminal no editing关闭CLI 的编辑功能
terminal editing打开CLI 的编辑功能
terminal history size 50修改历史命令缓冲区的大小
copy running-config startup-config把内存中的配置文件保存到NVRAM 中
clock rate 128000配置串口上的时钟(DCE 端)
show version显示路由器的IOS 版本等信息
show running-config显示内存中的配置文件
show startup-config显示NVRAM 中的配置文件
show interface s0/0/0显示接口的信息
show flash显示flash 的有关信息
show controllers s0/0/0显示s0/0/0 的控制器信息
show ip arp显示路由器中的arp 表
copy running-config tftp把内存中的配置文件拷贝到tftp 服务器上
copy tftp running-config把tftp 服务器上的配置文件拷贝到内存中
copy flash:c2800nm-adventerprisek9-mz.124-11.T1.bin tftp把flash 中的IOS 拷贝到tftp 服务器上
confreg 0x2142在rommon 模式下修改配置寄存器值
i在rommon 模式下重启路由器
copy startup-config running-config把NVRAM 中的配置文件拷贝到内存中
config-register 0x2102修改配置寄存器值
reload重启路由器
delete flash:c2800nm-adventerprisek9-mz.124-11.T1.bin删除flash 中的IOS
copy tftp flash从tftp 服务器上拷贝IOS 到flash 中
tftpdnldrommon 模式下,从tftp 服务器下载IOS
show cdp显示CDP 运行信息
show cdp interface显示CDP 在各接口的运行情况
show cdp neighbors显示CDP 邻居信息
show cdp entry R2显示CDP 邻居R2 的详细信息
clear cdp table清除CDP 邻居表
no cdp enable接口下关闭CDP
no cdp run/ cdp run关闭/打开整个路由器的CDP
cdp timer 30 CDP每30 秒发送一次
cdp holdtime 120让邻居为本设备发送的CDP 消息保持120 秒

静态路由相关配置

命令描述
ip route X.X.X.X 掩码 接口或者下一条ip地址配置静态路由
show ip route查看路由表
ip classless/ no ip classless打开/关闭有类路由功能
ping 2.2.2.2 source loopback 0指定源端口进行ping 测试

 

RIP命令汇总

命令描述
show ip route查看路由表
show ip protocols查看IP 路由协议配置和统计信息
show ip rip database查看RIP 数据库
debug ip rip动态查看RIP 的更新过程
clear ip route *清除路由表
router rip启动RIP 进程
network通告网络
version定义RIP 的版本
no auto-summary关闭自动汇总
ip rip send version配置RIP 发送的版本
ip rip receive version配置RIP 接收的版本
passive-interface配置被动接口
neighbor配置单播更新的目标
ip summary-address rip配置RIP 手工汇总
key chain定义钥匙链
key key-id配置Key ID
key-string配置Key ID 的密匙
ip rip triggered配置触发更新
ip rip authentication mode配置认证模式
ip rip authentication key-chain配置认证使用的钥匙链
timers basic配置更新的计时器
maximum-paths配置等价路径的最大值
ip default-network向网络中注入默认路由

EIGRP相关配置命令

命令描述
show ip eigrp neighbors查看EIGRP 邻居表
show ip eigrp topology查看EIGRP 拓扑结构数据库
show ip eigrp interface查看运行EIGRP 路由协议的接口的状况
show ip eigrp traffic查看EIGRP 发送和接收到的数据包的统计情况
debug eigrp neighbors查看EIGRP 动态建立邻居关系的情况
debug eigrp packets显示发送和接收的EIGRP 数据包
ip hello-interval eigrp配置EIGRP 的HELLO 发送周期
ip hold-time eigrp配置EIGRP 的HELLO hold 时间
router eigrp XX启动EIGRP 路由进程
no auto-summary关闭自动汇总
ip authentication mode eigrp配置EIGRP 的认证模式
ip authentication key-chain eigrp在接口上调用钥匙链
variance配置非等价负载均衡
delay配置接口下的延迟
bandwidth配置接口下的带宽
ip summary-address eigrp手工路由汇总

OSPF相关配置命令

命令描述
show ip route查看路由表
show ip ospf neighbor查看OSPF 邻居的基本信息
show ip ospf database查看OSPF 拓扑结构数据库
show ip ospf interface查看OSPF 路由器接口的信息
show ip ospf查看OSPF 进程及其细节
debug ip ospf adj显示OSPF 邻接关系创建或中断的过程
debug ip ospf events显示OSPF 发生的事件
debug ip ospf packet显示路由器收到的所有的OSPF 数据包
router ospf启动OSPF路由进程
router-id配置路由器ID
network通告网络及网络所在的区域
ip ospf network配置接口网络类型
ip ospf cost配置接口cost 值
ip ospf hello-interval配置hello 间隔
ip ospf dead-interval配置OSPF 邻居的死亡时间
ip ospf priority配置接口优先级
auto-cost reference-bandwidth配置参考带宽
clear ip ospf process清除OSPF 进程
area area-id authentication启动区域简单口令认证
ip ospf authentication-key  cisco配置认证密码
area area-id authentication message-digest启动区域MD5 认证
area area-id range区域间路由汇总
area area-id stub把某区域配置成末节区域
area area-id stub no-summary把某区域配置成完全末节区域
area area-id nssa把某区域配置成NSSA 区域
area area-id virtual-link配置虚链路
ip ospf message-digest-key key-id md5 key配置key ID 及密匙
ip ospf authentication启用链路简单口令认证
ip ospf authentication message-digest启用链路MD5 认证
default-information originate 向OSPF区域注入默认路由
show ip route查看路由表
show ip ospf neighbor查看OSPF 邻居的基本信息
show ip ospf database查看OSPF 拓扑结构数据库
show ip ospf interface查看OSPF 路由器接口的信息
show ip ospf查看OSPF 进程及其细节
show ip ospf database router查看类型1 的LSA 的全部信息
redistribute路由协议重分布
summary-address外部路由汇总
encapsulation frame-relay接口封装帧中继
no frame-relay inverse-arp关闭帧中继逆向ARP 解析
frame-relay interface-dlci帧中继映射
frame-relay map ip帧中继映射

IS-IS基本配置命令

命令描述
show clns neighbors查看CLNS 邻居
show clns protocols查看CLNS 路由协议相关的信息
show clns interface查看CLNS 接口状态的信息
show clns route查看CLNS L2 路由
clear clns route清除CLNS 路由表
clear isis *清除IS-IS 链路状态数据库
show clns traffic查看CLNS 协议的统计信息
show isis hostname查看主机名和系统ID 的动态对应关系
show isis database查看IS-IS 链路状态数据库
show isis topology查看IS-IS 拓扑结构信息
show isis route查看CLNS L1 的路由表
show frame-relay map查看帧中继映射
show ip protocols查看和IP 路由协议相关的信息
router isis启动IS-IS 路由进程
net配置NET 地址
ip router isis接口下启用IS-IS
is-type配置IS-IS 路由器类型
area-password配置区域认证
isis password配置邻居认证
domain-password domain配置域认证
default-information originate向IS-IS 网络注入默认路由
summary-address配置区域间路由汇总
isis circuit-type配置接口电路类型
frame-relay map clns配置CLNS 映射

BGP基本配置命令

命令描述
show tcp brief查看TCP 连接信息摘要
show ip bgp neighbors查看邻居的TCP 和BGP 连接的详细信息
show ip bgp summary查看BGP 连接的摘要信
show ip bgp查看BGP 表的信息
show ip bgp community查看BGP 团体属性
clear ip bgp *重置BGP 连接
router bgp启动BGP 进程
no synchronization关闭同步
synchronization打开同步
bgp router-id配置BGP 路由器ID
neighbor ip-address remote-as配置邻居路由器及所在的AS
neighbor ip-address update-source指定更新源
neighbor ip-address next-hop-self配置下一跳自我
route-reflector-client配置RR 客户端
network通告网络
aggregate-address配置地址聚合
ip prefix-list配置前缀列表
set origin egp设置起源代码为EGP
set as-path prepend配置追加AS-PATH
set local-preference设置本地优先级属性值
bgp default local-preference设置默认本地优先级属性值
bgp confederation identifier配置联邦ID
bgp confederation peers配置联邦EBGP 对等的成员
set community local-AS设置团体属性
neighbor ip-address send-community开启发送团体属性的能力

二层链路封装

命令描述
encapsulation hdlc把接口的封装改为hdlc
encapsulation ppp把接口的封装改为ppp
ppp pap sent-username R1 password 123456 pap认证时,向对方发送用户名R1 和密码123456
ppp authentication papPPP 的认证方式为pap
username R1 password 123456为对方创建用户R1,密码为123456
debug ppp authentication打开ppp 的认证调试过程
ppp authentication chapPPP 的认证方式为chap

帧中继相关配置命令

命令描述
frame-relay switching把路由器当成帧中继交换机
encapsulation frame-relay接口封装成帧中继
frame-relay lmi-type cisco配置LMI 的类型
frame-relay intf-type dce配置接口是帧中继的DCE 还是DTE
frame-relay route配置帧中继交换表
show frame-relay route显示帧中继交换表
show frame pvc显示帧中继PVC 状态
show frame lmi显示帧中继LMI 信息
show frame-relay map查看帧中继映射
no frame-relay inverse-arp关闭帧中继自动映射
ip split-horizon打开水平分割
int s0/0/0.1 multipoint创建点到多点子接口
int s0/0/0.3 point-to-point创建点到点子接口
frame-relay interface-dlci 104在点到点子接口上配置DLCI

ACL 相关配置命令

命令描述
show ip access-lists查看所定义的IP 访问控制列表
clear access-list counters将访问控制列表计数器清零
access-list定义ACL
ip access-group在接口下应用ACL
access-class在vty 下应用ACL
ip access-list定义命名的ACL
time-range time定义时间范围
username username password password建立本地数据库
autocommand定义自动执行的命令

DHCP 相关配置命令

命令描述
show ip dhcp pool查看DHCP 地址池的信息
show ip dhcp binding查看DHCP 的地址绑定情况
show ip dhcp database查看DHCP 数据库
show ip interface查看接口信息
debug ip dhcp server events动态查看DHCP 服务器的事件
service dhcp开启DHCP 服务
no ip dhcp conflict logging关闭DHCP 冲突日志
ip dhcp pool配置DHCP 分配的地址池
network DHCP服务器要分配的网络和掩码
default-router默认网关
domain-name域名
netbios-name-serverWINS 服务器
dns-server域名服务器
option 150 ipFTP 服务器
lease配置租期
ip dhcp excluded-address排除地址段
ip helper-address 配置DHCP中继的地址

NAT 相关配置命令

命令描述
clear ip nat translation *清除动态NAT 表
show ip nat translation查看NAT 表
show ip nat statistics查看NAT 转换的统计信息
debug ip nat动态查看NAT 转换过程
ip nat inside source static配置静态NAT
ip nat inside配置NAT 内部接口
ip nat outside配置NAT 外部接口
ip nat pool配置动态NAT 地址池
ip nat inside source list access-list-number pool name配置动态NAT
ip nat inside source list access-list-number pool name overload配置PAT

交换机基本配置命令

命令描述
duplex { full | half | auto }配置以太口的双工属性
speed { 10 | 100 | 1000 | auto }配置以太口的速率
ip default-gateway 172.16.0.254配置缺省网关
switch mode access把端口改为访问模式
switch port-securitiy打开交换机的端口安全功能
switch port-securitiy maximum 1允许该端口下的MAC 条目最大数量为1
switch port-securitiy violation{ protect | shutdown | restrict }配置交换机端口安全
switchport port-security mac-address  0019.5535.b828允许MAC 为0019.5535.b828 的设备接入本接口show mac-address-table 显示MAC 地址表
mac-address 12.12.12改变接口的MAC 地址
rename flash:config.text flash:config.old把flash 中的文件改名
copy xmodem:flash:c2950-i6q4l2-mz.121-22.EA5a.bin通过Xmodem 模式把文件拷贝到flash 中
boot重启交换机

VLAN与VTP配置命令

命令描述
vlan database进入到vlan database 配置模式
vlan 2 name VLAN2创建vlan 2
switch access vlan 2把端口划分到VLAN 2 中
interface range f0/2 - 3批量配置接口的属性
show vlan查看VLAN 的信息
switchport trunk encanpsulation配置trunk 链路的封装类型
switch mode trunk把接口配置为trunk
show interface f0/13 trunk查看交换机端口的trunk 状态
switchport nonegotiate Trunk链路上不发送trunk 协商包
vtp mode server配置交换机为VTP server
vtp domain VTP-TEST配置VTP 域名
vtp password cisco配置VTP 的密码
vtp mode client配置交换机为VTP client
vtp transparent配置交换机为VTP transparent
show vtp status显示vtp 的状态
vtp pruning启用VTP 修剪
vtp version 2VTP 版本为2
interface port-channel 1创建以太通道
channel-group 1 mode on把接口加入到以太网通道中,并指明以太通道模式
port-channel load-balance dst-mac配置etherChannel 的负载平衡方式
show etherchannel summary查看etherchannel 的简要信息

生成树STP配置命令

命令描述
show spanning-tree查看STP 树信息
spanning-tree vlan 1 priority 4096配置VLAN1 的桥优先级
spanning-tree portfast配置接口为portfast,当有设备接入时立即进入转发状态
spanning-tree uplinkfast配置uplinkfast 特性
spanning-tree backbonefast配置backbonefast 特性
spanning-tree mode rapid-pvst把STP 的运行模式设为RSTP+PVST
spanning-tree link-type point-to-point把接口的链路类型改为点对点
spanning-tree mode mst把生成树的模式改为MST
spanning-tree mst configuration进入MST 的配置模式
name TEST-MST命名MST 的名字
revision 1配置MST 的revision 号
instance 1 vlan 1-2把VLAN 1 和VLAN 2 的生成树映射到实例1
spanning-tree guard root在接口上配置root guard 特性
spanning-tree bpduguard enable在接口上配置bpduguard 特性

trunk基本配置

命令描述
int g0/0.1创建子接口
encapture dot1q 1 native指明子接口承载哪个VLAN 的流量以及封装类型,同时该VLAN 是native vlan
ip routing打开路由功能
no switchport接口不作为交换机接口
ip cef开启CEF 功能

HSRP 基本配置命令

命令描述
standby 1 ip 192.168.13.254启用 HSRP 功能,并设置虚拟IP 地址
standby 1 priority 120配置本路由器的HSRP 优先级
standby 1 preempt配置HSRP 抢占
standby 1 timers 3 10设置HSRP 的HELLO time 和HOLD time
standby 1 authentication md5 key-string  cisco配置HSRP 认证密码,认证方式为MD5
show standby brief查看HSRP 的简要情况
standby 1 track Serial0/0/0 30跟踪s0/0/0 接口,当接口故障时,HSRP 优先级降低30
vrrp 1 ip 192.168.13.254启用 VRRP 功能,并设置虚拟IP 地址
vrrp 1 priority 120配置本路由器的VRRP 优先级
vrrp 1 preempt配置VRRP 抢占
vrrp 1 authentication md5 key-stringcisco 配置VRRP 认证密码,认证方式为MD5
track 100 interface Serial0/0/0定义一个跟踪目标号,被跟踪对象为s0/0/0
line-protocol接口
vrrp 1 track 100 decrement 30跟踪目标100,当目标故障时,优先级降低30
show vrrp brief查看VRRP 的简要情况
glbp 1 ip 192.168.1.254启用 GLBP 功能,并设置虚拟IP 地址
glbp 1 priority 200配置本路由器的GLBP 优先级
glbp 1 preempt配置GLBP 抢占
glbp 1 authentication md5 key-string  cisco配置GLBP 认证密码,认证方式为MD5
show glbp查看GLBP 情况

重分布

命令描述
show ip route查看路由表
show ip protocols查看和路由协议相关的信息
redistribute配置路由协议重分布
default-metric配置默认种子度量值  ip prefix-list 定义前缀列表
distance eigrp配置EIGRP 默认管理距离
router-map基本配置命令
show ip policy查看策略路由及作用的接口
show route-map查看定义的所有路由策略及路由策略匹配的情况
debug ip policy动态查看策略路由的匹配情况
passive-interface配置被动接口
distribute-list配置分布控制列表
route-map定义路由策略
match定义匹配的条件
set定义对符合匹配条件的语句采取的行为
ip policy route-map应用路由策略
ip local policy route-map本地应用路由策略

IPv6基本配置命令

命令描述
show ipv6 route查看IPv6 路由表
show ipv6 interface查看IPv6 接口信息
show ipv6 protocols查看和IPv6 路由协议相关的信息
show ipv6 rip next-hops查看RIPng 的下一跳地址
show ipv6 rip database查看RIPng 的数据库
show ipv6 ospf neighbor查看OSPFv3 邻居的基本信息
show ipv6 ospf interface查看OSPFv3 路由器接口的信息
show ipv6 ospf database查看OSPFv3 拓扑结构数据库
show ipv6 ospf查看OSPFv3 进程及其细节
show ipv6 route eigrp查看IPv6 EIGRP 的路由
show ipv6 eigrp topology查看IPv6 EIGRP 的拓扑结构信息
show ipv6 eigrp neighbors查看IPv6 EIGRP 的邻居
debug ipv6 rip动态查看RIPng 的更新
ipv6 unicast-routing启动IPv6 流量转发
ipv6 address在接口下配置IPv6 地址
ipv6 route配置IPv6 静态路由
ipv6 router rip启动IPv6 RIPng 进程
split-horizon启用水平分割
poison-reverse启用毒化反转
ipv6 rip tag enable在接口上启用RIPng
ipv6 rip tag default-information originate向IPv6 RIPng 区域注入一条默认路由
ipv6 router ospf启动OSPFv3 路由进程
router-id配置路由器ID
default-information originate向OSPFv3 网络注入一条默认路由
ipv6 ospf process-id area area-id接口上启用OSPFv3,并声明接口所在区域
ipv6 router eigrp配置IPv6 EIGRP 路由协议
ipv6 eigrp接口下启用IPv6 EIGRP
maximum-paths配置能支持的等价路径的条数

组播相关命令

命令描述
ip multicast-routing启用组播路由功能
ip pim dense在接口上运行pim dense 协议
ip igmp join-group 237.0.0.1该接口加入到237.0.0.1 组中
show ip pim neighbor显示了pim 邻居
show ip mroute显示组播路由表
show ip igmp groups显示组成员
ip igmp snooping在交换机上配置IGMP Snopping 功能
show ip igmp snooping显示交换机上的IGMP Snooping 运行情况
show ip igmp snooping groups交换机上显示各组的成员在什么接口上
ip pim sparse-dense在接口上运行pim sparse-dense 协议
ip pim spt-threshold infinity静止从基于RP 的树切换到基于源的树
ip pim send-rp-discovery loopback 0scope 255把路由器设为映射代理,其Loopback0 为代理地址
ip pim send-rp-announce Loopback0 scope255把路由器设为候选RP,其Loopback0 为RP地址

QOS相关命令

命令描述
priority-list 1 protocol ip high tcp telnet创建优先级队列,标号为1。把telnet 流量放在高优先级队列中
priority-list 1 queue-limit 20 30 40 50定义优先级队列高、中、普通、低队列中的长度
priority-group 1把定义好的优先级队列应用接口上
show queueing priority查看优先级队列情况
debug priority调试优先级队列
queue-list 1 protocol ip 1 tcp telnet创建自定义队列,标号为1。把telnet 流量放在队列1 中
queue-list 1 queue 1 limit 40定义队列1 的深度为40,
custom-queue-list 1把定义好的自定义队列应用接口上
fair-queue 512 1024 10在接口上启用WFQ,512 是丢弃值,1024 是最大的会话数,10 是RSVP 可预留队列
class-map match-any CLASS-MAP1定义class-map,名为CLASS-MAP1
match protocol http匹配http 协议
bandwidth 10配置CLASS-MAP 流量的带宽为60K
service-policy output MY-POLICY把定义好的策略应用在接口的output 方向上
show class-map显示class-map 信息
show policy-map显示policy-map 信息
show policy-map interface s0/0/0显示接口s0/0/0 上的policy-map 配置
priority 15配置LLQ,带宽为15k
random-detect在接口上启用WRED
random-detect precedence 0 18 42 12配置WRED,对于IP 优先级为0 的队列,最低阀值为18,最大阀值为42,按照1/12 的最大比例丢弃数据包
show queueing random-detect显示WRED 的配置情况
show interfaces rate-limit显示各接口上CAR 的情况
drop丢弃数据包
variance配置IPv6 EIGRP 非等价负载均衡

 

本文授权转自微信公众号:网络技术干货圈(id: wljsghq)

禁止二次转载,请联系作者授权

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值