2006, Shenzhen Polytechnic. All rights reserved. 1 路路路路路路路 Basic Configuration of Router 路路路路路路路路路路路路路路路路
Jan 25, 2016
© 2006, Shenzhen Polytechnic. All rights reserved. 1
路由器基本配置Basic Configuration of Router
深圳职业技术学院计算机系网络专业
© 2006 Shenzhen Polytechnic. All rights reserved.2
教学目标( Objectives )
1. 路由器功能( Function of Router )2. 路由器组成( Router Components )3. 超级终端会话属性( HyperTerminal Session Properties )4. Router 配置模式( Router Configuration Mode ) 5. 路由器基本配置( Basic Configuration of Router )
© 2006 Shenzhen Polytechnic. All rights reserved.3
Router 功能( Function of Router )
Router 是第三层的网络设备( Router is layer 3 device ):1. 路由选择和交换( Routing and Switching )2. 网络分段( Network Segment )3. 流量控制( Flow Control )4. 隔离广播( Isolate Broadcast )5. 广域网连接( WAN Connection )
© 2006 Shenzhen Polytechnic. All rights reserved.4
路由选择和交换( Routing and Switching )
© 2006 Shenzhen Polytechnic. All rights reserved.5
网络分段( Network Segment )
© 2006 Shenzhen Polytechnic. All rights reserved.6
广域网连接( WAN Connection )
© 2006 Shenzhen Polytechnic. All rights reserved.7
路由器内部组成( Router Internal Components )
© 2006 Shenzhen Polytechnic. All rights reserved.8
RAM/DRAM
1. 主要存储路由表、 ARP 缓存、快速交换表和包队列等Stores routing tables, ARP cache, fast-switching cache, and packet hold queues;
2. 存储正在运行的配置文件RAM also provides temporary and/or running memory for a router's configuration file while the router is powered;
3. 掉电或重启动内容丢失RAM content is lost during a power down or restart
© 2006 Shenzhen Polytechnic. All rights reserved.9
非易失性 RAM ( NVRAM )
1. 非易失性 RAM 存储配置文件的备份Non-volatile RAM stores the router's backup/startup configuration file;
2. 掉电或重启动 NVRAM 内容不丢失NVRAM content is retained during power down or restart
© 2006 Shenzhen Polytechnic. All rights reserved.10
Flash
1.Flash 是可擦除,可重新编程的 ROM, 它存储操作系统映像文件和微代码Erasable, reprogrammable ROM that holds the operating system image and microcode; 2. Flash 可以软件升级,不需要更换芯片Flash memory enables software updates without removing and replacing processor chips; 3. 掉电或重启动 Flash 内容不丢失Flash content is retained during power down or restart; 4. Flash 可以存储多个版本的 IOS 软件Flash memory can store multiple versions of IOS software
© 2006 Shenzhen Polytechnic. All rights reserved.11
ROM
1.ROM 包含开机自检程序、启动程序和操作系统软件ROMcontains power-on diagnostics, a bootstrap program, and operating system software;
2. 升级 ROM 中的软件需要更换路由器主板上的芯片Software upgrades in ROM require removing and replacing chips on the router's motherboard
© 2006 Shenzhen Polytechnic. All rights reserved.12
2600 系列路由器内部构成( Internal Components of 2600 Router )
© 2006 Shenzhen Polytechnic. All rights reserved.13
2600 系列路由器外观( External Connectors on 2600 Router )
© 2006 Shenzhen Polytechnic. All rights reserved.14
计算机连接到控制台接口( Computer Connect to Console Port )
© 2006 Shenzhen Polytechnic. All rights reserved.15
在计算机上配置超级终端软件( Configure HyperTerminal software on the PC )
© 2006 Shenzhen Polytechnic. All rights reserved.16
超级终端会话属性( HyperTerminal Session Properties )
© 2006 Shenzhen Polytechnic. All rights reserved.17
配置路由器的方式( External Configuration Source )
路由器初始配置必须通过控制台接口进行。When the router is first put into service, we must configure it by console port.
© 2006 Shenzhen Polytechnic. All rights reserved.18
Router 配置模式( Router Configuration Mode )
1. 用户模式 ( user mode ) >
2. 特权模式 ( privileged mode ) #
3. 全局模式 ( global config mode ) router(config)#
4. 子模式( sub-mode ) 接口模式( interface mode ): router(config-if)#
线路模式( line mode ): router(config-line)#
路由模式( router mode ): router(config-router)#
5.Setup 模式6.RXBOOT 模式7.ROMMON 模式
© 2006 Shenzhen Polytechnic. All rights reserved.19
用户模式 ( User Mode )
这是一种“只能查看”的模式,用户只能查看一些有关路由器的信息,不能更改。This is a look-only mode in which the user can view some information about the router, but can not make changes.
© 2006 Shenzhen Polytechnic. All rights reserved.20
特权模式( Privileged Mode )
这种模式支持调试和测试命令,支持对交换机的详细检查、对配置文件的操作,并且可以由此进入配置模式。 This mode supports the debugging and testing commands, detailed examination of the switch, manipulation of configuration files, and access to configuration modes.
© 2006 Shenzhen Polytechnic. All rights reserved.21
全局配置模式( Global Configuration Mode )
这种模式提供了强大的单行命令,可以完成简单的配置任务。This mode implements powerful one-line commands that perform simple configuration tasks.
© 2006 Shenzhen Polytechnic. All rights reserved.22
Setup 模式( Setup Mode )
这种模式在控制台提供了交互式的对话,帮助新的用户创建初次的基本的配置。
This mode presents an interactive prompted dialog at the console that helps the new user create a first-time basic configuration.
© 2006 Shenzhen Polytechnic. All rights reserved.23
RXBOOT 模式( RXBOOT Mode )
1. 这是你可以使用的维护模式,可以用来恢复丢失的密码。This is the maintenance mode that you can use, among other things, to recover from lost passwords.
2. 2600 系列路由器没有此模式2600 routers have not this mode 。
© 2006 Shenzhen Polytechnic. All rights reserved.24
ROMMON 模式( ROMMON Mode )
这种模式可以用来恢复密码和升级 IOS.
This mode use to recover from lost passwords and update IOS software 。
© 2006 Shenzhen Polytechnic. All rights reserved.25
Router 工作模式转换( Change Router Configuration Mode )
Router>
Router>enable
Router#
Router# configure terminal
Router(config)#
Router(config)# interface fa0/0
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#end
Router# disable
Router>
© 2006 Shenzhen Polytechnic. All rights reserved.26
工作模式切换命令注释( Notes of Changing Router Mode Command )
进入特权命令状态 enable 退出特权命令状态 disable 进入设置对话状态 setup 进入全局设置状态 config terminal 退出全局设置状态 end 进入端口设置状态 interface type slot/number 进入线路设置状态 line type slot/number 进入路由设置状态 router protocol 退出局部设置状态 exit
© 2006 Shenzhen Polytechnic. All rights reserved.27
命名路由器( Name the Router )
Router(config)#hostname Lab-A
© 2006 Shenzhen Polytechnic. All rights reserved.28
配置 enable 密码( Configuring Enable Passwords )
Lab-A(config)#enable password cisco
show runningenable password cisco (明文,未加密 )
Results in:
© 2006 Shenzhen Polytechnic. All rights reserved.29
配置 enable 密码( Configuring Enable Passwords )
Lab-A(config)#enable secret cisco
Show runenable secret 5 $1$emBK$WxqLahy7YO(密码被加密 )
Results in:
© 2006 Shenzhen Polytechnic. All rights reserved.30
配置控制台密码( Configuring Console Passwords )
router1(config)#line console 0
router1(config-line)#password cisco
router1(config-line)#login
© 2006 Shenzhen Polytechnic. All rights reserved.31
配置 VTY 密码( Configuring VTY Passwords )
router1(config)#line vty 0 4
0 4: 允许 5 个终端同时远程登录0 4:(permit 5 terminals login at the same time )router1(config-line)#password cisco
router1(config-line)#login
router1(config-line)#priv level 15
设置登录优先级( set priority )
© 2006 Shenzhen Polytechnic. All rights reserved.32
配置串行口( Configuring a Serial Interface )
1. Rouer1 # config t
2. Router1(config)# interface s0/0
进入串行口模式( Enter Serial Interface Mode )3. Router1(config-if)# clock rate 64000
DCE 端配置时钟( Set clock rate if a DCE cable is connected )4. Router1(config-if)# ip address 192.168.100.1 255.255.255.0
配置接口 IP 地址和网络掩码( Specify the Interface Address and Subnet Mask )5. Router1(config-if)# no shut
开启接口( Turn on the Interface )
© 2006 Shenzhen Polytechnic. All rights reserved.33
配置以太口( Configuring an Ethernet Interface )
1. Router1# config t
2. Router1(config)# interface fa0/0
进入以太口模式( Enter Ethernet Interface Mode )3. Router1(config-if)# ip address 10.1.1.1 255.255.255.0
配置接口 IP 地址和网络掩码( Specify the Interface Address and Subnet Mask )4. Router1(config-if)# no shut
开启接口( Turn on the Interface )
© 2006 Shenzhen Polytechnic. All rights reserved.34
配置接口描述( Configuring Interface Description )
1. 接口描述可以帮助网络用户记住特定的关于接口的信息A description of an interface can help a network user remember specific information about the interface.
2. 描述仅仅是对接口的一个标记。The description is meant solely as a comment about the interface.
Eg1 interface fa0/0
description LAN Engineering, Bldg.2
Eg2 interface serial 0/0description ABC network 1, Circuit 1
© 2006 Shenzhen Polytechnic. All rights reserved.35
Router 端口状态( Status of Interface )
© 2006 Shenzhen Polytechnic. All rights reserved.36
配置登录提示信息( Configuring Login Banners )
Router1(config)#banner motd #Welcome to Shenzhen Polytechnic#
“#”: 特定的分隔符号“#”:a space and a delimiting character
© 2006 Shenzhen Polytechnic. All rights reserved.37
高级组合命令( Enhanced Editing Commands )
Ctrl+A :光标回到命令行的最开头( move to the beginning of the command line )Ctrl+E :光标回到命令行的最后( move to theend of the command line )Ctrl+B :光标向左移一字符位置( move back one character )Ctrl+F :光标向右移一字符位置( move froward one character )※可以使用 terminal no editing 命令来使组合键失效,要使组合键重新生效,可用 terminal editing 命令※ To disable enhanced editing mode, type terminal no editing at the privileged EXEC mode prompt.
© 2006 Shenzhen Polytechnic. All rights reserved.38
高级组合命令( Enhanced Editing Commands )
Ctrl+P ( or 上箭头):使用上一条用过的命令( recall previous command )Ctrl+N ( or下箭头):使用下一条用过的命令( recall most recent command )
© 2006 Shenzhen Polytechnic. All rights reserved.39
使用“ ?” ( use “?”)
clock
clock ?
clock set ?
clock set 10:30:30 ?
clock set 10:30:30 20 oct ?
clock set 10:30:30 20 oct 2002?
show clock
© 2006 Shenzhen Polytechnic. All rights reserved.40
1.保存配置文件( Save configuration file )copy running-config startup-configWrite
2.删除配置文件( Delete configuration file )erase nvram 或 erase startup-config
3. 查看配置文件( show configuration file )show startup-configshow running-config
保存、删除、查看配置文件( Save , Delete , Show Configuration File )
© 2006 Shenzhen Polytechnic. All rights reserved.41
各种 show 命令
© 2006 Shenzhen Polytechnic. All rights reserved.42
show 命令
© 2006 Shenzhen Polytechnic. All rights reserved.43
Show 命令( Show Command )
1.show version 这个命令可以查看 IOS 版本号,已启动时间 , flash 中的 IOS 的文件名, router里面共有什 么的端口,寄存器的值等等。2.show protocol 显示与 ip 有关的路由协议信息,各个端口的 情况。3.show flash 查看 flash 中的内容, IOS 的长度,文件名, 剩余空间,总共空间。4.show running-config 查看路由器当前的配置信息。5.show startup-config 查看 nvram 中的路由器配置信息。6.show interface 查看路由器上的各个端口的状态信息。7.show controller 查看接口控制器的状态,可看到连接的是 DTE还是 DCE8.show history 查看 history buffer 里面的命令列表terminal history size <size> 设置 history buffer 里面保存命令的个数。最 大允许值为 256
© 2006 Shenzhen Polytechnic. All rights reserved.44
实验报告拓扑
F0/0 F0/0s0/0 s0/0R1 R2
12.0.0.0/8.1 .2
11.0.0.0/8 22.0.0.0/8
.100
.254.254
.100
F0/0 F0/0s0/0 s0/0R3 R4
34.0.0.0/8.1 .2
33.0.0.0/8 44.0.0.0/8
.100
.254.254
.100
© 2006 Shenzhen Polytechnic. All rights reserved.45
实验报告内容
1. 启用密码加密服务2. 配置 console 0 和 telnet 密码3. 配置 enable password
4. 配置 banner ,信息自定5. 配置串口和以太网接口的 IP ,并启用接口6. 测试 R1 和 R2之间直连链路的通信,测试计算机和以太网接口
的通信7. 在以太网接口配置 description ,自定内容。8. 确认配置正确后,保存配置文件
提交实验报告(每人一份)
© 2006 Shenzhen Polytechnic. All rights reserved.46
思考题( Questions )
1 . Enable password 和 enable secret 命令有什么不同?2.路由器中有几种常用配置模式?每种配置模式的特点是什么?3.在启动超级终端时,如果不把波特率设为 9600bps ,会出现什么情况?4.如何查看路由器配置寄存器的值?5.如何强行退出正在执行的命令?6.如何执行上一条用过的命令?7.使用路由器应该注意哪些事项?8 . show running-config 和 show startup-config 的区别是什么?9.我们可以通过哪些方式配置路由器?10.路由器有哪些部分组成?11.如何配置路由器的登录信息?