这5个show命令在思科设备出场率最高!

网络东西不好懂 2024-07-29 03:43:05

在思科网络设备的日常运维中,有一些命令被频繁使用,它们可以帮助网络管理员快速获取重要信息并保存配置更改。在这篇文章中,我们将详细介绍五个出场率最高的show命令:show interfaces、copy running-config startup-config、show ip route、show ip interface brief和show running-config。

1. show interfaces

用途:显示路由器接口的详细信息。

show interfaces命令提供了有关路由器所有接口的详尽信息。这包括接口的类型、速度、IP地址、错误统计以及接口当前的状态(启用或禁用)。这是一个非常冗长的命令,输出的信息量很大,因此可能需要仔细筛选以找到所需的信息。

详细说明:

接口类型和状态:命令的输出包括每个接口的名称和当前状态(up或down),例如GigabitEthernet0/1 is up。硬件地址和MTU:显示接口的MAC地址和最大传输单元(MTU)大小。输入/输出流量统计:提供详细的输入和输出字节数、包数、丢包数和错误数。协议状态:显示协议的当前状态以及协议特定的详细信息,例如IP is up,line protocol is up。

示例:

Router# show interfacesGigabitEthernet0/0 is up, line protocol is up Hardware is i82543 (Livengood), address is 000b.be3d.b270 (bia 000b.be3d.b270) Internet address is 192.168.1.1/24 MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full Duplex, 1000Mbps, media type is RJ45 output flow-control is XON, input flow-control is XON ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:01, output 00:00:00, output hang never Last clearing of "show interface" counters never Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 5000 bits/sec, 5 packets/sec 5 minute output rate 10000 bits/sec, 10 packets/sec 120839 packets input, 9374923 bytes, 0 no buffer Received 34887 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 watchdog, 34887 multicast, 0 pause input 132274 packets output, 104091832 bytes, 0 underruns 0 output errors, 0 collisions, 0 interface resets 0 unknown protocol drops 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier, 0 pause output 0 output buffer failures, 0 output buffers swapped out2. copy running-config startup-config

用途:将当前配置保存到启动配置。

copy running-config startup-config命令用于将当前在RAM中的运行配置保存到闪存中的启动配置。这确保了路由器重新启动时能够保留配置更改。这个命令只能在特权EXEC模式下使用。

详细说明:

保存配置:每当您对路由器的配置进行更改时,都应该使用这个命令来保存更改,否则在设备重启后更改将会丢失。缩写命令:可以使用wr(write memory的缩写)来快速执行这个命令。

示例:

Router# copy running-config startup-configDestination filename [startup-config]? Building configuration...[OK]3. show ip route

用途:显示路由器的路由表。

show ip route命令显示路由器已知的所有网络及其到达方式。这包括通过静态或动态方法学习到的网络、到达这些网络的最佳路径、下一跳IP地址和本地接口。这个命令可以在用户EXEC模式和特权EXEC模式下使用。

详细说明:

已知网络:输出包括所有已知的连接和目标网络。学习方法:指明学习到每个网络的方法,例如静态配置(S)、通过EIGRP(D)或OSPF(O)等协议动态学习。下一跳信息:提供到达每个已知目标网络的下一跳IP地址和本地接口。

示例:

Router# show ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static routeGateway of last resort is 192.168.1.1 to network 0.0.0.0 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masksC 192.168.1.0/24 is directly connected, GigabitEthernet0/0L 192.168.1.1/32 is directly connected, GigabitEthernet0/0O 192.168.2.0/24 [110/2] via 192.168.1.2, 00:00:14, GigabitEthernet0/1 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 10.1.1.0/24 is directly connected, GigabitEthernet0/2L 10.1.1.1/32 is directly connected, GigabitEthernet0/24. show ip interface brief

用途:提供接口的简要信息。

show ip interface brief命令提供路由器所有接口的状态、协议和IP地址的简要摘要。这是检查接口是否启用以及其IP地址的最佳方式。这个命令可以在用户EXEC模式和特权EXEC模式下使用。

详细说明:

接口状态:显示每个接口的名称、IP地址、状态和协议。简要信息:与show interfaces命令相比,输出更加简洁,只显示最关键信息。

示例:

Router# show ip interface briefInterface IP-Address OK? Method Status ProtocolGigabitEthernet0/0 192.168.1.1 YES manual up up GigabitEthernet0/1 unassigned YES unset administratively down down GigabitEthernet0/2 10.1.1.1 YES manual up up Loopback0 10.10.10.1 YES manual up up 5. show running-config

用途:显示当前运行配置。

show running-config命令显示路由器的整个活动配置。您可以看到所有已输入的命令、默认命令以及路由器的设置。这是最有用的show命令之一,只能在特权EXEC模式下使用。

详细说明:

完整配置:输出包括IP地址、接口配置、密码(以明文显示)、路由协议和其他设置。缩写命令:可以使用sh run或wr t来快速执行这个命令。

示例:

Router# show running-configBuilding configuration...Current configuration : 2346 bytes!version 15.2service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname Router!boot-start-markerboot-end-marker!!no aaa new-modelno ip icmp rate-limit unreachableip cef!!!interface命令总结

命令

缩写

模式兼容性

主要用途

show interfaces

sh int

用户EXEC & 特权EXEC

显示接口的详细信息,包括类型、状态、IP地址、错误统计等。

copy running-config startup-config

wr

特权EXEC

将当前运行配置保存到启动配置,以确保设备重启后保留更改。

show ip route

sh ip ro

用户EXEC & 特权EXEC

显示路由表,包括已知网络、学习方法、下一跳IP地址和本地接口。

show ip interface brief

sh ip int brie

用户EXEC & 特权EXEC

提供接口的简要信息,包括状态、协议和IP地址。

show running-config

sh run / wr t

特权EXEC

显示当前运行配置,包括所有已输入的命令、默认命令及路由器设置。

0 阅读:0

网络东西不好懂

简介:感谢大家的关注