环境:两台 2500 系列路由器由串口相连。 要求:如下图所示,在 R1 和 R2 上运行 RIPv1, 让两端能够学习到对端的路由以达到通信的目的。
步骤一、基本配置 Router> Router>enable Router#config terminal Router(config)#hostname R1 R1(config)# no ip domain-lookup à 关闭域名查找 R1(config)#line console 0 R1(config-line)# logging synchronous à 命令输入达到同步 R1(config-line)# exec-timeout 0 0 à 设置永不超时 R1(config-line)#exit 步骤二、接口 IP 配置 R1 的配置: R1(config)#interface s0 R1(config-if)#ip address 30.1.1.1 255.255.255.0 R1(config-if)# clock rate 64000 à 注意时钟速率端 R1(config-if)#no shutdown R1(config-if)#interface loopback 0 R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config-if)# R2 的配置: Router(config)#hostname R2 R2(config)#interface s1 R2(config-if)#ip address 30.1.1.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#interface loopback 0 R2(config-if)#ip address 20.1.1.1 255.255.255.0 R2(config-if)#exit R2(config)# 步骤三、启用 RIP 路由选择协议 R1 的配置: R1(config)# router rip à 启用 RIP R1(config-router)# network 30.0.0.0 à 发布直连网段 R1(config-router)# network 10.0.0.0 R1(config-router)#exit R1(config)# R2 的配置: R2(config)# router rip à 启用 RIP R2(config-router)# network 20.0.0.0 à 发布直连网段 R2(config-router)# network 30.0.0.0 R2(config-router)#exit R2(config)#end 步骤四、显示路由表,查看路由条目 R1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set R 20.0.0.0/8 [120/1] via 30.1.1.2, 00:00:03, Serial0 à 学习来的路由条目 10.0.0.0/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Loopback0 30.0.0.0/24 is subnetted, 1 subnets C 30.1.1.0 is directly connected, Serial0 步骤五、用扩展 ping 命令测试连通性 R2#ping Protocol [ip]: Target IP address: 10.1.1.1 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 20.1.1.1 !!!!! 步骤六、显示你当前路由协议 R2# show ip protocols à 显示你当前路由协议配置情况和运行状态 Routing Protocol is "rip" Sending updates every 30 seconds, next due in 24 seconds Invalid after 180 seconds, hold down 180 , flushed after 240 Outgoing update filter list for all interfaces is Incoming update filter list for all interfaces is Redistributing: rip Default version control: send version 1, receive any version Interface Send Recv Triggered RIP Key-chain Loopback0 1 1 2 Serial1 1 1 2 Automatic network summarization is in effect Routing for Networks: 10.0.0.0 20.0.0.0 Routing Information Sources: Gateway Distance Last Update 30.1.1.1 120 00:14:05 Distance: (default is 120) 步骤七、显示当前配置 r1 的当前配置: r1#show running-config ! hostname R1 ! no ip domain-lookup ! interface Loopback0 ip address 10.1.1.1 255.255.255.0 ! interface Serial0 ip address 30.1.1.1 255.255.255.0 clockrate 64000 ! router rip network 30.0.0.0 network 10.0.0.0 ! line con 0 exec-timeout 0 0 logging synchronous transport input none end r2 的当前配置: R2#sh run ! hostname R2 ! no ip domain-lookup ! interface Loopback0 ip address 20.1.1.1 255.255.255.0 ! interface Serial1 ip address 30.1.1.2 255.255.255.0 ! router rip network 30.0.0.0 network 20.0.0.0 ! line con 0 exec-timeout 0 0 logging synchronous ! end |