做为一个工程师,很多的时候会发现,学习的技术应用是分工作岗位的,有些内容用的多,有些内容几乎很少用。cisco的初学者,应该掌握哪些命令,至少可以在一个企业中来做相关设备的运维(排除系统、网络、服务器、存储、***、安全、虚拟化等等)
简单的来说吧,我总结如下,主要针对的是零基础的,行从事这个行业的人。
闲话少说,上命令吧:
路由器基本操作
1.基本配置模式
Router> //用户模式
Router>enable //在用户模式敲入enable 进入特权模式(也叫enable 模式)
Router#disable //在特权模式敲入disable 退出到用户模式
Router>enable //在用户模式敲入enable 进入特权模式
Router#configure terminal //在特权模式敲入configure terminal 进入到配置模式
Router(config)#interface ethernet 0/0 //在配置模式敲入“interface+接口类型+接口编号”进入接口模式
Router(config-if)#exit //敲入exit 退出接口模式
Router(config)#router rip //敲入“router + 路由协议”进入router 模式
Router(config-router)#exit //退出router 模式
Router(config)#line console 0 //进入line 模式
Router(config-line)#end //从line 模式退出(任何时候敲入end 会退出到特权模式)
Router#conf t
Router(config)#interface ethernet 0/0.1 //进入子接口模式
Router(config-subif)#end //任何时候敲入end 会退出到特权模式
常用show命令的介绍:
Router#show version 查看路由器版本
Router#show flash: 查看路由器flash
Router#show history 查看历史命令记录
Router#show interfaces s0/0 查看接口物理相关信息
Router#show ip int s0/0 查看接口协议相关信息
Router#show ip int brief 查看接口简要信息
Router#show running-config 查看路由器启动配置文件
Router#show running-config 查看路由器运行配置文件
Router#show users 查看当前登录的所有用户
Router#show arp 查看路由器ARP表
试验如下图:
查看路由器日志信息:
Router#show buffers
Buffer elements:
1119 in free list (1119 max allowed)
16 hits, 0 misses, 619 created
Public buffer pools:
Small buffers, 104 bytes (total 89, permanent 50, peak 89 @ 00:01:08):
58 in free list (20 min, 150 max allowed)
97 hits, 13 misses, 0 trims, 39 created
0 failures (0 no memory)
Middle buffers, 600 bytes (total 43, permanent 25, peak 43 @ 00:01:09):
40 in free list (10 min, 150 max allowed)
92 hits, 6 misses, 0 trims, 18 created
0 failures (0 no memory)
Big buffers, 1536 bytes (total 50, permanent 50):
50 in free list (5 min, 150 max allowed)
66 hits, 0 misses, 0 trims, 0 created
0 failures (0 no memory)
VeryBig buffers, 4520 bytes (total 10, permanent 10):
10 in free list (0 min, 100 max allowed)
0 hits, 0 misses, 0 trims, 0 created
0 failures (0 no memory)
Large buffers, 5024 bytes (total 0, permanent 0):
0 in free list (0 min, 10 max allowed)
0 hits, 0 misses, 0 trims, 0 created
0 failures (0 no memory)
Huge buffers, 18024 bytes (total 0, permanent 0):
0 in free list (0 min, 4 max allowed)
0 hits, 0 misses, 0 trims, 0 created
0 failures (0 no memory)
Interface buffer pools:
IPC buffers, 4096 bytes (total 2, permanent 2):
2 in free list (1 min, 8 max allowed)
0 hits, 0 fallbacks, 0 trims, 0 created
0 failures (0 no memory)
Header pools:
Header buffers, 0 bytes (total 511, permanent 256, peak 511 @ 00:01:19):
255 in free list (256 min, 1024 max allowed)
171 hits, 85 misses, 0 trims, 255 created
0 failures (0 no memory)
256 max cache size, 256 in cache
0 hits in cache, 0 misses in cache
Particle Clones:
1024 clones, 0 hits, 0 misses
Public particle pools:
F/S buffers, 128 bytes (total 512, permanent 512):
0 in free list (0 min, 512 max allowed)
512 hits, 0 misses
512 max cache size, 512 in cache
0 hits in cache, 0 misses in cache
Normal buffers, 512 bytes (total 2048, permanent 2048):
2048 in free list (1024 min, 4096 max allowed)
0 hits, 0 misses, 0 trims, 0 created
0 failures (0 no memory)
Private particle pools:
FastEthernet0/0 buffers, 512 bytes (total 400, permanent 400):
0 in free list (0 min, 400 max allowed)
400 hits, 0 fallbacks
400 max cache size, 271 in cache
129 hits in cache, 0 misses in cache
14 buffer threshold, 0 threshold transitions
Serial1/0 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
Serial1/1 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
Serial1/2 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
Serial1/3 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
Serial1/4 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
Serial1/5 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
Serial1/6 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
Serial1/7 buffers, 512 bytes (total 64, permanent 64):
0 in free list (0 min, 64 max allowed)
64 hits, 0 fallbacks
64 max cache size, 27 in cache
37 hits in cache, 0 misses in cache
10 buffer threshold, 0 threshold transitions
FastEthernet2/0 buffers, 512 bytes (total 400, permanent 400):
0 in free list (0 min, 400 max allowed)
400 hits, 0 fallbacks
400 max cache size, 271 in cache
129 hits in cache, 0 misses in cache
14 buffer threshold, 0 threshold transitions
查看路由器CPU使用信息:
Router#show process cpu
CPU utilization for five seconds: 3%/0%; one minute: 1%; five minutes: 0%
PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
1 0 4 0 0.00% 0.00% 0.00% 0 Chunk Manager
2 0 14 0 0.00% 0.00% 0.00% 0 Load Meter
3 0 1 0 0.00% 0.00% 0.00% 0 chkpt message ha
4 0 1 0 0.00% 0.00% 0.00% 0 EDDRI_MAIN
5 84 10 8400 0.00% 0.05% 0.01% 0 Check heaps
6 0 1 0 0.00% 0.00% 0.00% 0 Pool Manager
7 0 2 0 0.00% 0.00% 0.00% 0 Timers
8 0 2 0 0.00% 0.00% 0.00% 0 ATM AutoVC Perio
9 0 2 0 0.00% 0.00% 0.00% 0 ATM VC Auto Crea
10 0 2 0 0.00% 0.00% 0.00% 0 IPC Dynamic Cach
11 0 1 0 0.00% 0.00% 0.00% 0 IPC Zone Manager
12 0 67 0 0.00% 0.00% 0.00% 0 IPC Periodic Tim
13 0 67 0 0.00% 0.00% 0.00% 0 IPC Deferred Por
14 0 1 0 0.00% 0.00% 0.00% 0 IPC Seat Manager
15 0 1 0 0.00% 0.00% 0.00% 0 IPC BackPressure
16 164 66 2484 3.44% 0.27% 0.05% 0 EnvMon
17 0 1 0 0.00% 0.00% 0.00% 0 OIR Handler
18 0 1 0 0.00% 0.00% 0.00% 0 Crash writer
19 0 5 0 0.00% 0.00% 0.00% 0 ARP Input
20 0 2 0 0.00% 0.00% 0.00% 0 ATM Idle Timer
21 0 2 0 0.00% 0.00% 0.00% 0 AAA high-capacit
--More--
查看物理内存使用信息:
Router#show memary
I/O memory
ddress Bytes Prev Next Ref PrevF NextF Alloc PC what
000000 0000000032 00000000 0F000050 000 6506981C 0 00000000 (fragment
a*0050 0000000272 0F000000 0F000190 001 -------- -------- 60325474 *Packet D
a*0190 0000000272 0F000050 0F0002D0 001 -------- -------- 60325474 *Packet D
0002D0 0000000272 0F000190 0F000410 001 -------- -------- 60325474 *Packet D
a*
000410 0000000272 0F0002D0 0F000550 001 -------- -------- 60325474 *Packet D
a*
a*0550 0000000272 0F000410 0F000690 001 -------- -------- 60325474 *Packet D
000690 0000000272 0F000550 0F0007D0 001 -------- -------- 60325474 *Packet D
a*
0007D0 0000000272 0F000690 0F000910 001 -------- -------- 60325474 *Packet D
a*
000910 0000000272 0F0007D0 0F000A50 001 -------- -------- 60325474 *Packet D
a*
查看running-config配置文件
Router#show running-config //running-config是运行在RAM里面的配置信息//
Building configuration...
Current configuration:
!
version 11.3
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Router
!
interface Ethernet0 //接口默认情况下是关闭的//
no ip address
shutdown
!
interface Serial0
no ip address
shutdown
!
!
interface Serial1
no ip address
shutdown
!
no ip classless
7
line con 0
line aux 0
line vty 0 4
end
查看FLASH:
Router#show flash
File Length Name/status
1 7890728 c2500-ds-l_113-9.bin
[7890792 bytes used, 497816 available, 8388608 total]
8192K bytes of processor board System flash (Read ONLY)
注意:FLASH有两种类型,一种是只读的(read only),这种类型的FLASH内IOS是不能升级的,出厂的时候IOS就已经固化在里面;另一种是可擦写的(read write),这种类型的FALSH是可以升级IOS的。
查看版本信息:
Router#show version
ROM: System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE
BOOTFLASH: 3000 Bootstrap Software (IGS-RXBOOT), Version 10.2(8a), RELEASE SOFTW
ARE (fc1)
RouterA uptime is 11 minutes
System restarted by power-on
System image file is "flash:c2500-d-l_113-5.bin", booted via flash
Bridging software.
X.25 software, Version 3.0.0.
1 Ethernet/IEEE 802.3 interface(s)
2 Serial network interface(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read ONLY)
Configuration register is 0x2102
注意:在show version中,可以显示路由器所有的硬件和软件的信息,比较重要的有IOS的版
本信息,硬件接口信息,FLASH信息和寄存器值信息。
2. 登陆路由器的必须配置
Router(config)#no ip domain lookup 关闭DNS解析
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0 设置永不超时
Router(config-line)#logging synchronous 关闭日志同步,阻止控制台的提示信息
路由器上时间的设置:
Router#clock set 10:05:42 22 february 2008
Router#show clock
10:05:42.367 UTC Fri Feb 22 2008
常见密码的设置:
Router(config)#line vty 0 4
Router(config-line)#password 123 //设置远程登陆密码
Router(config-line)#login
Router(config)#line console 0
Router(config-line)#password [password] //设置con口登录密码
Router(config-line)#login
Router(config-line)#exit
VTY 口的配置
Router(config)#line vty 0 4 //不同设备或不同IOS可能数量不同
Router(config-line)#password [password]
Router(config-line)#login
Router(config-line)#exit
配置以太网口
Router#conf t
Router(config)#int E0
Router(config-if)#ip address 192.168.1.1 255.255.255.0 //配置IP地址
Router(config-if)#no shutdown //激活该接口
配置串行接口(需要配置时钟频率)
Router#conf t
Router(config)#int S0
Router(config-if)#clock rate 64000 // DCE设备配置时钟,DTE设备不用配置
Router(config-if)#ip address 192.168.1.1 255.255.255.0 //配置IP地址
Router(config-if)#no shutdown
配置接口描述信息:
Router(config-if)#description link to stsd
配置主机名与IP地址映射:
Router(config)#ip host stsd 192.168.113.1 //ping主机名=pingIP地址
Ping stsd = ping 192.168.113.1
清除路由器启动配置:
Rotuer#erase startup-config
保存路由器当前配置:
Router#copy running-config startup-config
配置一台路由器当作PC
做实验时通常用路由器当作PC 使用,用来测试网络的连通性等
步骤:(本例子中的当作PC 的路由器接口为Ethernet 0)
1. 关闭路由器的路由功能
2. 设置接口 IP 地址
3. 配置默认网关
4. 检查
Router#conf t
Router(config)#host PC1
PC1(config)#no ip routing ---------------------------注:关闭路由器的路由功能
PC1(config)#interface ethernet 0
PC1(config-if)#ip address 11.1.1.4 255.255.255.0 ------注:设置接口IP 地址并启用
PC1(config-if)#no shutdown
PC1(config-if)#exit
PC1(config)#ip default-gateway 11.1.1.1 ----------------注:配置默认网关
PC1(config)#end
常用的TCP/IP测试命令-----PING 命令
用ping命令可以检测的各个网络功能:
Ping127.0.0.1-----ping回环接口是测试基本的TCP/IP网络配置
Ping主机IP地址----测试本地主机的TCP/IP地址配置
Ping默认网关------检测本地网络和其他网络的路由器是否可达
Ping一个域名------检测DNS是否正常工作
Ping远端目的IP地址-----检测与远端主机的连通性
实验目的:学习ping及扩展ping的用法
学习用ping命令检测网络故障
1 普通的ping命令的用法及结果
Router#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/115/212 ms
2 扩张ping
Router#ping
Protocol [ip]: 所使用的协议
Target IP address: 3.3.3.3 目标IP地址
Repeat count [5]: PING次数
Datagram size [100]: 数据包大小
Timeout in seconds [2]: 超时时间
Extended commands [n]: y
Source address or interface: 23.0.0.1 源地址
Type of service [0]: 服务类型
Set DF bit in IP header? [no]: 是否分片
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: 疏松、严格的路由选择,时间戳
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 23.0.0.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/85/216 ms
Telnet :
挂起会话:ctrl +shift +6 之后,按x,
之后可以在自己的设备上:show session:显示自己发起的会话。
如果想返回自己的会话:可以快速的双击回车,也可以使用resume 1
查看R5自己发起的会话。
r5#show session
Conn Host Address Byte Idle Conn Name
* 1 192.168.1.1 192.168.1.1 0 0 192.168.1.1
r5#
[Resuming connection 1 to 192.168.1.1 ... ]
r7#
r5#rem
r5#resume 1
[Resuming connection 1 to 192.168.1.1 ... ]
查看R7上被登陆的用户:
r7#show users
Line User Host(s) Idle Location
* 0 con 0 idle 00:00:00
2 vty 0 idle 00:00:01 192.168.1.2
3 vty 1 idle 00:00:08 192.168.2.2
Interface User Mode Idle Peer Address
关闭telnet 会话;
这些是零基础的入门开始要掌握的基本知识。
转载于:https://blog.51cto.com/dnsdhcp/607450