实验13:使用子网地址
1.
实验目的
通过本实验可以掌握:
(1)RIPv1 使用子网地址的条件
(2)RIPv1 接收子网路由的原则
2.
拓扑结构
实验拓扑如图4-4 所示。
图4-4 RIPv1 使用子网地址
3.
实验步骤
(1)步骤1:配置路由器R0
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho r0
r0(config)#no ip domain-loo
r0(config)#lin c 0
r0(config-line)#logg s
r0(config-line)#exec-t 00
r0(config-line)#exit
r0(config)#int loo 1
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho r0
r0(config)#no ip domain-loo
r0(config)#lin c 0
r0(config-line)#logg s
r0(config-line)#exec-t 00
r0(config-line)#exit
r0(config)#int loo 1
%LINK-5-CHANGED: Interface Loopback1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r0(config-if)#
r0(config-if)#ip add 172.16.1.1. 255.255.255.0
^
% Invalid input detected at '^' marker.
r0(config-if)#ip add 172.16.1.1 255.255.255.0
r0(config-if)#int s1/1/0
r0(config-if)#ip add 172.16.2.1 255.255.255.0
r0(config-if)#clo r 64000
r0(config-if)#no sh
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r0(config-if)#
r0(config-if)#ip add 172.16.1.1. 255.255.255.0
^
% Invalid input detected at '^' marker.
r0(config-if)#ip add 172.16.1.1 255.255.255.0
r0(config-if)#int s1/1/0
r0(config-if)#ip add 172.16.2.1 255.255.255.0
r0(config-if)#clo r 64000
r0(config-if)#no sh
%LINK-5-CHANGED: Interface Serial1/1/0, changed state to down
r0(config-if)#
%LINK-5-CHANGED: Interface Serial1/1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1/0, changed state to up
r0(config-if)#do ping 172.16.2.2
r0(config-if)#
%LINK-5-CHANGED: Interface Serial1/1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1/0, changed state to up
r0(config-if)#do ping 172.16.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/7 ms
Sending 5, 100-byte ICMP Echos to 172.16.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/7 ms
r0(config-if)#exit
r0(config)#router rip
r0(config-router)#v 1
r0(config-router)#net 172.16.0.0
r0(config-router)#
r0(config-router)#do sh ip prot
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 2 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 1, receive 1
Interface Send Recv Triggered RIP Key-chain
Serial1/1/0 1 1
Loopback1 1 1
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
172.16.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
172.16.2.2 120 00:00:02
Distance: (default is 120)
r0(config-router)#do sh 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
r0(config)#router rip
r0(config-router)#v 1
r0(config-router)#net 172.16.0.0
r0(config-router)#
r0(config-router)#do sh ip prot
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 2 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 1, receive 1
Interface Send Recv Triggered RIP Key-chain
Serial1/1/0 1 1
Loopback1 1 1
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
172.16.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
172.16.2.2 120 00:00:02
Distance: (default is 120)
r0(config-router)#do sh 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
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Loopback1
C 172.16.2.0 is directly connected, Serial1/1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:06, Serial1/1/0
C 172.16.1.0 is directly connected, Loopback1
C 172.16.2.0 is directly connected, Serial1/1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:06, Serial1/1/0
从路由器R0路由表输出可以看出,它们互相学习到了24 位的路由条目,从而
可以说明,某些情况下RIPv1 更新确实可以携带子网信息。
(2)步骤2:配置路由器R1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho r1
r1(config)#no ip domain-loo
r1(config)#lin c 0
r1(config-line)#logg s
r1(config-line)#exec-t
% Incomplete command.
r1(config-line)#exec-t 00
r1(config-line)#exit
r1(config)#int loo 1
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho r1
r1(config)#no ip domain-loo
r1(config)#lin c 0
r1(config-line)#logg s
r1(config-line)#exec-t
% Incomplete command.
r1(config-line)#exec-t 00
r1(config-line)#exit
r1(config)#int loo 1
%LINK-5-CHANGED: Interface Loopback1, changed state to up
r1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r1(config-if)#ip add 172.16.3.1 255.255.255.0
r1(config-if)#no hs
^
% Invalid input detected at '^' marker.
r1(config-if)#int s1/1/0
r1(config-if)#ip add 172.16.2.2 255.255.255.0
r1(config-if)#no sh
r1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r1(config-if)#ip add 172.16.3.1 255.255.255.0
r1(config-if)#no hs
^
% Invalid input detected at '^' marker.
r1(config-if)#int s1/1/0
r1(config-if)#ip add 172.16.2.2 255.255.255.0
r1(config-if)#no sh
%LINK-5-CHANGED: Interface Serial1/1/0, changed state to up
r1(config-if)#
r1(config-if)#do ping 172.16.2.1
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1/0, changed state to up
r1(config-if)#do ping 172.16.2.1
r1(config-if)#
r1(config-if)#do ping 172.16.2.1
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1/0, changed state to up
r1(config-if)#do ping 172.16.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/3/5 ms
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/3/5 ms
r1(config-if)#exit
r1(config)#router rip
r1(config-router)#net 172.16.0.0
r1(config-router)#do sh 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
r1(config)#router rip
r1(config-router)#net 172.16.0.0
r1(config-router)#do sh 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
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.1.0 [120/1] via 172.16.2.1, 00:00:05, Serial1/1/0
C 172.16.2.0 is directly connected, Serial1/1/0
C 172.16.3.0 is directly connected, Loopback1
r1(config-router)#do sh ip pro
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 5 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 1, receive any version
Interface Send Recv Triggered RIP Key-chain
Serial1/1/0 1 2 1
Loopback1 1 2 1
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
172.16.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
172.16.2.1 120 00:00:18
Distance: (default is 120)
R 172.16.1.0 [120/1] via 172.16.2.1, 00:00:05, Serial1/1/0
C 172.16.2.0 is directly connected, Serial1/1/0
C 172.16.3.0 is directly connected, Loopback1
r1(config-router)#do sh ip pro
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 5 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 1, receive any version
Interface Send Recv Triggered RIP Key-chain
Serial1/1/0 1 2 1
Loopback1 1 2 1
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
172.16.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
172.16.2.1 120 00:00:18
Distance: (default is 120)
RIPv1 路由更新可以携带子网信息必须同时满足两个条件:
(1)整个网络所有地址在同一个主类网络;
(2)子网掩码长度必须相同
本文转自gauyanm 51CTO博客,原文链接:http://blog.51cto.com/gauyanm/234975,如需转载请自行联系原作者