CCNA笔记--4
第四章, Cisco IOS简介
路由器IOS IOS是被用来传送网络服务并启动网络应用的。 Cisco路由器的IOS软件负责完成重要的工作: 1. 加载网络协议和功能 2. 在设备间连接高速流量 3. 在控制访问中添加安全性防止未授权的网络使用 4. 为简化网络的增长和冗余备份,提供可缩放性 5. 为连接到网络中的资源,提供网络的可靠性 连接到Cisco路由器 可以通过连接到Cisco路由器来进行路由器的设置、配置的验证及统计数据的审核。 通常是使用通过控制台端口进行连接。控制台接口一般是一个RJ-45的连接器,位于路由器背面,默认的时候,没有口令要求。 启动路由器 初次启动一个Cisco路由器时,它将运行一个开机自检过程。如果通过,他将在闪存中查找IOS系统,如果有IOS文件存在则执行装载操作。闪存世一个电子可擦写变成的制度存储器。然后,IOS将继续加载并查找一个合法的配置文件,它默认时是存储在NVRAM中。 当路由器被首次引导或重新装载时,会出现的信息: System Bootstrap, Version 11.0(10c), SOFTWARE Copyright (c) 1986-1996 by cisco Systems 2500 processor with 14336 Kbytes of main memory 这是一台2501路由器启动时的信息 第一行写了,IOS版本是11.0 第二行是CISCO的版权信息 第三行行是内存的大小 路由器启动以后,会出现一个提示 Would you like to enter the initial configuration dialog? [yes/no]: n 如果选择yes,将进入setup模式,选择No我们将进入扩展设置模式。 Setup模式只配置购管理系统使用的连接性能,而扩展设置会允许你配置更多的内容。 命令行界面 正式因为命令行界面(CLI)是如此的灵活方便,所以他是配置路由器的最佳方式。 要使用CLI,只需要在初始化配置对话框窗口中输入NO。 登陆到路由器 Router> 这就是用户模式,通常用来查看统计信息的 在特许模式中你可以查看并修改Cisco路由器的配置,但要进入此模式需要使用enable命令 具体步骤如下: Router> Router>enable Router# --------------------- 现在得到一个Router#提示符,表明已经在特许模式中了,在这里可以修改路由器的配置。 在这里可以通过使用disable命令,从特许模式中返回用户模式。 Router#disable Router> 在用户模式里,可以用logout命令来退出控制台操作: Router>logout Router con0 is now available Press RETURN to get started. 也可以在特许模式下键入logout或exit来退出: Router>enable Router#logout Router con0 is now available Press RETURN to get started. 路由器模式概述 要从CLI上进行配置,可能会需要用configure terminal命令进入全局模式才能修改当权运行配置中的内容。你也可以在特许模式下键入config,然后按Enter键以默认方式进入全局模式。 Router#config Configuring from terminal, memory, or network [terminal]? (Enter) Enter configuration commands, one per line. End with CNTL/Z. Router(config)# CLI提示符 在配置路由器时,理解所遇到的不同提示符的含义,是非常重要的。 接口
在修改接口配置,需要在全局模式下使用interface命令: Router(config)#interface ? Async Async interface BVI Bridge-Group Virtual Interface CTunnel CTunnel interface Dialer Dialer interface Ethernet IEEE 802.3 Group-Async Async Group interface Lex Lex interface Loopback Loopback interface Multilink Multilink-group interface Null Null interface Serial Serial Tunnel Tunnel interface Vif PGM Multicast Host interface Virtual-Template Virtual Template interface Virtual-TokenRing Virtual TokenRing range interface range command Router(config)#int Serial 0 Router(config-if)# Router(config-if)# 当提示符改变成这个的时候,说明你已经处在接口配置模式中了。 子接口
子接口允许尼在路由器中创建逻辑接口。在子接口中,提示符会改变为Router(config-subif)# Router(config)#int s0.? <0-4294967295> Serial interface number 行命令 要配置用户模式口令,是用Line命令 Router(config)#line ? <0-6> First Line number aux Auxiliary line console Primary terminal line vty Virtual terminal 路由协议配置 要配置rip或igrp这样的路由协议,需要使用(config-router)#提示符: Router(config)#router ? bgp Border Gateway Protocol (BGP) egp Exterior Gateway Protocol (EGP) eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) igrp Interior Gateway Routing Protocol (IGRP) isis ISO IS-IS iso-igrp IGRP for OSI networks mobile Mobile routes odr On Demand stub Routes ospf Open Shortest Path First (OSPF) rip Routing Information Protocol (RIP) Router(config)#router rip Router(config-router)# 编辑和帮助功能 可以使用Cisco高级的编辑功能来帮助配置路由器。 在任意提示符下键入一个问号。(?),都将会得到在当前提示符下所有命令的清单。 下面是查找以某个字母开头的快捷方式命令: Router(config)#i? interface ip ipx isis 在一个命令串中找下一个命令,可以先键入前面的命令然后输入一个问号: Router(config)#interface ? Async Async interface BVI Bridge-Group Virtual Interface CTunnel CTunnel interface Dialer Dialer interface Ethernet IEEE 802.3 Group-Async Async Group interface Lex Lex interface Loopback Loopback interface Multilink Multilink-group interface Null Null interface Serial Serial Tunnel Tunnel interface Vif PGM Multicast Host interface Virtual-Template Virtual Template interface Virtual-TokenRing Virtual TokenRing range interface range command Router(config)#interface serial ?
<0-1> Serial interface number Router(config)#interface serial 0 ?
<cr> Router(config-if)# 增强的编辑命令
命令 含义 CTRL+A 移动光标到本行的开始处 CTRL+E 移动光标到本行的结尾处 ESC+B 往回移动一个字 CTRL+F 向前移动一个字符 ESC+F 向前移动一个字 CTRL+D 删除某个单一字符 BACKSPACE 删除某个单一字符 CTRL+R 重新显示一行 CTRL+U 删除一行 CTRL+W 删除一个字 CTRL+Z 结束配置模式并返回执行(EXEC)模式 TAB 完成输入一个命令 获取基本的路由信息
Router#sh version Cisco Internetwork Operating System Software IOS (tm) 2500 Software (C2500-JS-L), Version 12.2(27), RELEASE SOFTWARE (fc3) Copyright (c) 1986-2004 by cisco Systems, Inc. Compiled Tue 02-Nov-04 22:01 by kellmill Image text-base: 0x0307D390, data-base: 0x00001000 ROM: System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE
BOOTLDR: 3000 Bootstrap Software (IGS-RXBOOT), Version 10.2(8a), RELEASE SOFTWARE (fc1) Router uptime is 17 minutes
System returned to ROM by power-on System image file is "flash:c2500-js-l.122-27.bin" cisco 2500 (68030) processor (revision D) with 16384K/2048K bytes of memory.
Processor board ID 02096577, with hardware revision 00000000 Bridging software. X.25 software, Version 3.0.0. SuperLAT software (copyright 1990 by Meridian Technology Corp). TN3270 Emulation software. 1 Ethernet/IEEE 802.3 interface(s) 2 Serial network interface(s) 32K bytes of non-volatile configuration memory. 16384K bytes of processor board System flash (Read ONLY) Configuration register is 0x2142
设置口令 启用口令 可以在全局配置模式下设置启用口令: Router(config)#enable ? last-resort Define enable action if no TACACS servers respond password Assign the privileged level password secret Assign the privileged level secret use-tacacs Use TACACS to check enable passwords 辅助口令 要配置辅助接口口令,需要进入到全局配置模式并输入Line aux ?。 Router(config)#line aux ? <0-0> First Line number Router(config)#line aux 0
Router(config-line)#password 12345 Router(config-line)#login Router(config-line)# 控制台口令
要设置控制台口令,使用line console 0命令。 Router(config)#line console 0 Router(config-line)#password 12345 Router(config-line)#login Telnet口令
要为Telnet访问路由器设置用户模式口令,是用line vty命令。 Router(config)#line vty 0 ? <1-197> Last Line number <cr> Router(config)#line vty 0 4
Router(config-line)#password 12345 Router(config-line)#login Router(config-line)# 加密你的口令 在默认时只有启用加密口令是加密的,为了安全,需要手工配置用户模式口令和启用口令。 要实现口令加密,需要在全局模式下使用service password-encryption命令。 Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#service password-encryption Router(config)# 标志区
使用标志区是为那些拨号到你的互联网络中的用户提供了一个安全的提示。 在Cisco路由器上设置一个标志区,这样当任一用户登录到路由器上或远程访问路由器时,标志区显示你希望他们看到的信息。 设置标志区,是用banner motd命令 Router(config)#banner motd # Enter TEXT message. End with the character '#'. Welcome to Hu Lian Shen Zhou # Router(config)#exit 现在显示出来的就是刚才设置的标志区: Welcome to Hu Lian Shen Zhou User Access Verification Password: 路由器接口
接口配置是路由器很重要的配置,没有接口,路由器整个是没用的。 不同的路由器使用不同的方式来选择接口的使用。 Router(config)#int ? Async Async interface BVI Bridge-Group Virtual Interface CTunnel CTunnel interface Dialer Dialer interface Ethernet IEEE 802.3 Group-Async Async Group interface Lex Lex interface Loopback Loopback interface Multilink Multilink-group interface Null Null interface Serial Serial Tunnel Tunnel interface Vif PGM Multicast Host interface Virtual-Template Virtual Template interface Virtual-TokenRing Virtual TokenRing range interface range command 以上是我们实验室2501路由器的接口。
激活接口 使用shutdown来关闭接口,用no shutdown命令打开一个接口 下列显示了如何打开一个接口: Router(config)#int s0
Router(config-if)#no shut 在接口上配置IP地址 即使在路由器上不需要直接使用IP,但是人们还是要经常使用它。 要在接口上配置IP地址,是用ip address命令: Router(config)#int s0 Router(config-if)#ip address 192.168.0.1 255.255.255.0 Router(config-if)#no shut 最后一定要记住使用no shutdown命令来打开接口。 串行接口命令 接口将被接到一个CSU/DSU类型的设备上,它要为线路提供时钟。如果是用背对背的配置模式,DCE的连接端必须提供式中。默认时,Cisco的路由器都是数据终端设备(DTE)。 配置DEC串行接口使用clock rate命令: Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#int s0 Router(config-if)#clock rate 64000 主机名 使用hostname命令来设置路由器的标识。它只在局部有作用,并不影响路由器的名称查找或路由器在互联网上的工作。 举例: Router(config)#hostname SZ_Lab SZ_Lab(config)#hostname Cisco Cisco(config)# 描述 在接口上设置描述非常有意义,以免忘记了哪个接口是连接到哪里的这些。 和主机名一样,它是只在本地有意思的设置。 Cisco(config)#int s0 Cisco(config-if)#description WAN to school 以下是show run信息 ! interface Serial0 description WAN to school ip address 192.168.0.1 255.255.255.0 ! 查看并保存配置 使用copy running-config startup-config命令,将配置从DRAM中手工保存到NVRAM中。 Cisco#copy run start Destination filename [startup-config]? [ENTER] Building configuration... [OK] 要删除启动配置文件,使用erase startup-config命令 Cisco#erase startup-config Erasing the nvram filesystem will remove all configuration files! Continue? [confirm][ENTER] [OK] Erase of nvram: complete Cisco#reload(从启路由器命令) 验证配置 本文出自 51CTO.COM技术博客show interface命令 sh ip interface命令 sh ip interface brief命令 sh controllers命令。 |


lizphoenix
博客统计信息
热门文章
最新评论
友情链接