路由器基本配置
本章内容 路由器的基本操作 实验练习
常用的路由器配置方法 TFTP Console MODEM AUX telnet web 任何 Interface AUX 备份接口, 一般用于路由器的管理备份接口
路由器的操作模式 : 配置模式 1. 线路配置模式 Router(config-line)# 配置路由器的线路参数 2. 路由协议配置模式 Router(config-router)# 配置路由器的接口参数
路由器的操作模式 : 配置模式 1. 进入全局配置模式下 Red-Giant#configure terminal Red-Giant(config)# 2. 进入线路配置模式 Red-Giant(config)#line vty 0 4(VTY(virtual type terminal) 虚拟终端连接 ) Red-Giant(config-line)#exit Red-Giant(config)# 3. 进入接口配置模式 Red-Giant(config)#interface serial 1/2 Red-Giant(config-if)#exit Red-Giant(config)# 4. 进入路由协议配置模式 Red-Giant(config)#router rip
常用路由器 show 命令 显示当前运行的配置参数 Red-Giant#show running-config 显示 NVRAM 中配置参数的副本 Red-Giant#show startup-config 将配置信息保存到 NVRAM Red-Giant#write 删除 NVRAM 中配置信息 Red-Giant#erase startup-config 注 :erase flash 为删除操作系统
配置路由器登陆口令 配置 console 登陆密码 Red-Giant(config)#line console 0 Red-Giant(config-line)#login Red-Giant(config-line)#password star 配置 VTY 登陆密码 Red-Giant(config)#line vty 0 4 Red-Giant(config-line)#login Red-Giant(config-line)#password star
配置路由器特权口令 配置特权密码 Red-Giant(config)#enable password star Red-Giant(config)#enable secret star
路由器接口配置命令 配置接口 IP 地址 Red-Giant(config-if)#ip address 192.168.1.1 255.255.255.0 将接口启用 Red-Giant(config-if)#no shutdown 将接口关闭 Red-Giant(config-if)#shutdown
路由器接口显示命令 显示接口的状态 Red-Giant#show interfaces 显示接口的摘要信息 Red-Giant#show ip interface brief
路由器接口显示命令 Red-Giant#show interfaces serial ( 端口号 ) ½( 模块号 ) Serial1/2 is up, line protocol is up ( 表示物理层协议工作正常 ) ( 表示数据链路层协议工作正常 ) Serial1/2 is up, line protocol is down ( 表示物理层协议工作正常 ) ( 表示数据链路层协议工作不正常 ) Serial1/2 is down, line protocol is down ( 表示物理层协议工作不正常 ) Serial1/2 is administratively down, line protocol is down ( 表示从管理上将该接口处于关闭状态 )
路由器测试命令 远程登陆到其它设备 Red-Giant#telnet {IP address} 测试目的端的可达性 Red-Giant#ping {IP address}
路由器 TFTP 命令 将配置参数上传到 TFTP 服务器 Red-Giant#copy running-config tftp 从 TFTP 服务器上下载配置参数 Red-Giant#copy tftp running-config
路由器的基本配置网络拓扑
实验配置 A 路由器的配置 : 一. 基本配置 : 1. 配置路由器主机名 Red-Giant>enable( 注 : 从用户模式进入特权模式 ) Red-Giant#configure terminal( 注 : 从特权模式进入全局配置模式 ) Red-Giant(config)#hostname A( 注 : 将主机名配置为 A ) A(config)# 2. 配置路由器远程登陆密码 A(config)#line vty 0 4( 注 : 进入路由器 vty0 至 vty4 虚拟终端线路模式 ) A(config-line)#login A(config-line)#password star ( 注 : 将路由器远程登陆口令设置为 star ) 3. 配置路由器特权模式口令 A(config)#enable password star 或 : A(config)#enable secret star ( 注 : 将路由器特权模式口令配置为 star )
4. 为路由器各接口分配 IP 地址 A(config)#interface serial 0 注 : 进入路由器 serial 0 的接口配置模式 ( 常见的路由器接口 : fastethernet 0,fastethernet1,,fastethernet n;serial 0, serial 1,,serial n) A(config-if)#ip address 172.16.2.2 255.255.255.0 注 : 设置路由器 serial 0 的 IP 地址为 172.16.2.2, 对应的子网掩码为 255.255.255.0 A(config)#interface fastethernet 0 注 : 进入路由器 fastethernet 0 的接口配置模式 ( 常见的路由器接口 :fastethernet 0, fastethernet 1,,fastethernet n;serial 0,serial1,, serial n) A(config-if)#ip address 172.16.3.1 255.255.255.0 注 : 设置路由器 fastethernet 0 的 IP 地址为 172.16.3.1, 对应的子网掩码为 255.255.255.0
二. 配置接口时钟频率 (DCE): A(config)#interface serial 0 注 : 进入路由器 serial 0 的接口配置模式 ( 常见的路由器接口 : fastethernet 0,fastethernet1,,fastethernet n;serial 0, serial 1,,serial n) R2624(config-if)clock rate 64000 注 : 设置接口物理时钟频率为 64Kbps B 路由器的配置 : 一. 基本配置 : 1. 配置路由器主机名 Red-Giant>enable( 注 : 从用户模式进入特权模式 ) Red-Giant#configure terminal( 注 : 从特权模式进入全局配置模式 ) Red-Giant(config)#hostname B( 注 : 将主机名配置为 B ) B(config)#
2. 配置路由器远程登陆密码 B(config)#line vty 0 4( 注 : 进入路由器 vty0 至 vty4 虚拟终端线路模式 ) B(config-line)#login B(config-line)#password star ( 注 : 将路由器远程登陆口令设置为 star ) 3. 配置路由器特权模式口令 B(config)#enable password star 或 : B(config)#enable secret star ( 注 : 将路由器特权模式口令配置为 star ) 4. 为路由器各接口分配 IP 地址 B(config)#interface serial 0 注 : 进入路由器 serial 0 的接口配置模式 ( 常见的路由器接口 :fastethernet 0,fastethernet1,,fastethernet n; serial 0,serial 1,,serial n)
B(config-if)#ip address 172.16.2.1 255.255.255.0 注 : 设置路由器 serial 0 的 IP 地址为 172.16.2.1, 对应的子网掩码为 255.255.255.0 B(config)#interface fastethernet 0 注 : 进入路由器 fastethernet 0 的接口配置模式 ( 常见的路由器接口 :fastethernet 0,fastethernet 1,,fastethernet n; serial 0,serial 1,,serial n) B(config-if)#ip address 172.16.1.1 255.255.255.0 注 : 设置路由器 fastethernet 0 的 IP 地址为 172.16.1.1, 对应的子网掩码为 255.255.255.0
验证命令 : show run show controllers s 0 show int show ip int brief ping telnet 测试结果 : 查看路由器端口为 up,up. 两台路由器互相 ping Serial 口的地址, 应该为通. 两台主机分别 ping 与其直连的路由器的 Fastetherne 口, 应为通. 从与路由器 A 相连的主机可以 telnet 到 A, 与路由器 B 相连的主机可以 telnet 到 B.