4) 步骤4:基本IOS 命令
先连接到R1 路由器上:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
//以上改变路由器的名称为“R1”,设置立即生效。
R1(config)#enable password cisco
//以上改变了enable 的密码为“cisco”,这个密码是从用户模式进入到特权模式的密码。
R1(config)#interface g0/0
//以上进入到接口模式,这里是千兆以太网口(第0 个插槽的第0 个接口,编号从0 开始)。
R1(config-if)#ip address 10.1.1.1 255.255.255.0
//以上给以太接口配置一个IP 地址10.1.1.1,掩码为255.255.255.0
R1(config-if)#no shutdown
//以上开启以太网口,因为默认时路由器的各个接口是关闭的。
R1(config-if)#exit
//退回到上一级模式
R1(config)#interface s0/0/0
//以上进入到接口模式,这里是串行接口
R1(config-if)#ip address 10.12.12.1 255.255.255.0
//以上给串行接口配置一个IP 地址
R1(config-if)#no shutdown
//以上开启接口
R1(config-if)#end(或【Ctrl+Z】)
//以上结束配置直接回到特权模式下。
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
//以上把内存中的配置保存到NVRAM 中,路由器开机时会读取它。
连接到R2 路由器上,进行以下操作:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#enable password cisco
R2(config)#interface g0/0
R2(config-if)#ip address 10.2.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface s0/0/0
R2(config-if)#ip address 10.12.12.2 255.255.255.0
R2(config-if)#clock rate 128000
//R2 这一端是DCE,需要配置时钟
R2(config-if)#no shutdown
R2(config-if)#end
R2#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
R2#ping 10.12.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.14.126, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
//R2 ping R1 的串行接口,可以ping
5) 步骤5:各种“show”命令
R2#show version
Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 12.4(11)T1, RELEASE
SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Thu 25-Jan-07 12:50 by prod_rel_team
//以上是IOS 的版本信息
ROM: System Bootstrap, Version 12.4(1r) [hqluong 1r], RELEASE SOFTWARE (fc1)
//以上是ROM 的版本信息
R2 uptime is 4 hours, 10 minutes //注:路由器的开机时间
System returned to ROM by power-on //路由器是如何启动的,例如:开电或者热启动
System image file is "flash:c2800nm-adventerprisek9-mz.124-11.T1.bin"
//注:以上是当前正在使用的IOS 文件名
(此处省略)
If you require further assistance please contact us by sending email to
export@cisco.com.
Cisco 2821 (revision 53.50) with 249856K/12288K bytes of memory.
//注:以上是路由型号、RAM 大小(249856K+12288K
Processor board ID FHK1039F1FG //主板系列号
2 Gigabit Ethernet interfaces
4 Low-speed serial(sync/async) interfaces
1 Virtual Private Network (***) Module
//注:以上是各种接口的数量
DRAM configuration is 64 bits wide with parity enabled.
239K bytes of non-volatile configuration memory.
62720K bytes of ATA CompactFlash (Read/Write)
//注:以上是NVRAMFLASH 的大小情况
Configuration register is 0x2142
//以上是配置寄存器的值
R2#show running-config
Building configuration...
Current configuration : 1238 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
……………………(此处省略)
//以上显示路由正在使用的配置文件(存放在RAM 中),通常配置文件为几百到几千字节
R2#show startup-config
Building configuration...
Current configuration : 1238 bytes
!
version 12.4
//以上显示路由NVRAM 中的配置文件
R2#show interface s0/0/0
Serial0/0/0 is up, line protocol is up //注:该接口的状态
Hardware is GT96K Serial
Internet address is 10.12.12.2/24 //注:该接口的IP 地址
MTU 1500 bytes, BW 128 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
//注:以上是该接口的MTU、带宽、延时、可靠性、负载大小
Encapsulation HDLC, loopback not set //注:串口的封装类型为HDLC
Keepalive set (10 sec)
……………………(此处省略)
R2#show flash
CompactFlash directory:
File Length Name/status
1 41205996 c2800nm-adventerprisek9-mz.124-11.T1.bin
[41206060 bytes used, 23019216 available, 64225276 total]
62720K bytes of ATA CompactFlash (Read/Write)
//显示了flash 中存放的IOS 情况,flash 的总大小,可用空间
R2#show controllers s0/0/0
Interface Serial0/0/0
Hardware is GT96K
DCE V.35, clock rate 128000
idb at 0x4728A8C0, driver data structure at 0x4728CBEC
wic_info 0x4728D218
Physical Port 1, SCC Num 1
//显示s0/0/0 接口为v.35 接口,且为DCE,已经配置了时钟
R2#show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 172.16.0.2 - 0019.5566.6320 ARPA GigabitEthernet0/0
Internet 172.16.0.100 3 000c.7650.df17 ARPA GigabitEthernet0/0
//以上显示路由中缓存的ARP