实验使用的工具:小凡模拟器
一、在路由器R1上,配置接口,启动ospf路由进程和rip,宣告网段,并配置路由重分发
★☆R1☆★☆→
Router>
Router>enable
Router#config terminal
Router(config)#hostname R1-jin
R1-jin(config)#interface loopback 0
R1-jin(config-if)#ip address 1.1.1.1 255.255.255.255
R1-jin(config-if)#interface f0/0
R1-jin(config-if)#ip address 10.0.0.1 255.0.0.0
R1-jin(config-if)#no shutdown
R1-jin(config-if)#interface f1/0
R1-jin(config-if)#ip address 192.168.0.1 255.255.255.0
R1-jin(config-if)#no shutdown
R1-jin(config-if)#exit
R1-jin(config)#router rip
R1-jin(config-router)#network 10.0.0.0
R1-jin(config-router)#exit
R1-jin(config)#router ospf 1
R1-jin(config-router)#network 192.168.0.1 0.0.0.0 area 1
R1-jin(config-router)#redistribute rip metric 100 subnets ――路由重分发(RIP→OSPF)
R1-jin(config-router)#exit
R1-jin(config)#end
R1-jin#
二、在路由器R2、R3、R4上配置接口,启动ospf路由进程,宣告网段
★☆R2☆★
Router>
Router>enable
Router#config terminal
Router(config)#hostname R2-jin
R2-jin(config)#interface loopback 0
R2-jin(config-if)#ip address 2.2.2.2 255.255.255.255
R2-jin(config-if)#exit
R2-jin(config)#interface f1/0
R2-jin(config-if)#ip address 192.168.0.2 255.255.255.0
R2-jin(config-if)#no shutdown
R2-jin(config-if)#interface f0/0
R2-jin(config-if)#ip address 172.16.0.2 255.255.0.0
R2-jin(config-if)#no shutdown
R2-jin(config-if)#exit
R2-jin(config)#router ospf 1
R2-jin(config-router)#network 192.168.0.2 0.0.0.0 area 1
R2-jin(config-router)#network 172.16.0.2 0.0.0.0 area 2
R2-jin(config-router)#exit
★☆R3☆★
Router>
Router>enable
Router#config terminal
Router(config)#hostname R3-jin
R3-jin(config)#interface loopback 0
R3-jin(config-if)#ip address 3.3.3.3 255.255.255.255
R3-jin(config-if)#exit
R3-jin(config)#interface f0/0
R3-jin(config-if)#ip address 172.16.0.1 255.255.0.0
R3-jin(config-if)#no shutdown
R3-jin(config-if)#interface s1/0
R3-jin(config-if)#ip address 192.168.1.1 255.255.255.0
R3-jin(config-if)#no shutdown
R3-jin(config-if)#exit
R3-jin(config)#router ospf 1
R3-jin(config-router)#network 172.16.0.1 0.0.0.0 area 2
R3-jin(config-router)#network 192.168.1.1 0.0.0.0 area 0
R3-jin(config-router)#exit
★☆R4☆★
Router>
Router>enable
Router#config terminal
Router(config)#hostname R4-jin
R4-jin(config)#interface loopback 0
R4-jin(config-if)#ip address 4.4.4.4 255.255.255.255
R4-jin(config-if)#exit
R4-jin(config)#interface s1/0
R4-jin(config-if)#clock rate 128000
R4-jin(config-if)#ip address 192.168.1.2 255.255.255.0
R4-jin(config-if)#no shutdown
R4-jin(config-if)#interface f0/0
R4-jin(config-if)#ip address 20.0.0.1 255.0.0.0
R4-jin(config-if)#no shutdown
R4-jin(config-if)#exit
R4-jin(config)#router ospf 1
R4-jin(config-router)#network 192.168.1.2 0.0.0.0 area 0
R4-jin(config-router)#network 20.0.0.1 0.0.0.0 area 0
R4-jin(config-router)#exit
R4-jin(config)#end
三、在路由器R2、R3上配置虚链路,并查看各个路由器的路由表状态
★☆R2☆★
R2-jin(config)#
R2-jin(config)#router ospf 1
R2-jin(config-router)#area 2 virtual-link 3.3.3.3 ――虚链路(R2→R3)
R2-jin(config-router)#end
R2-jin#show ip route
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
O 20.0.0.0/8 [110/66] via 172.16.0.1, 00:00:10, FastEthernet0/0
C 172.16.0.0/16 is directly connected, FastEthernet0/0
O E2 10.0.0.0/8 [110/100] via 192.168.0.1, 00:00:10, FastEthernet1/0
C 192.168.0.0/24 is directly connected, FastEthernet1/0
O 192.168.1.0/24 [110/65] via 172.16.0.1, 00:00:10, FastEthernet0/0
R2-jin#
★☆R3☆★
R3-jin(config)#
R3-jin(config)#router ospf 1
R3-jin(config-router)#area 2 virtual-link 2.2.2.2 ――虚链路(R3→R2)
R3-jin(config-router)#end
R3-jin#show ip route
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
O 20.0.0.0/8 [110/65] via 192.168.1.2, 00:00:16, Serial1/0
C 172.16.0.0/16 is directly connected, FastEthernet0/0
O E2 10.0.0.0/8 [110/100] via 172.16.0.2, 00:00:16, FastEthernet0/0
O IA 192.168.0.0/24 [110/2] via 172.16.0.2, 00:00:16, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/0
R3-jin#
★☆R1☆★
R1-jin#show ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
O IA 20.0.0.0/8 [110/67] via 192.168.0.2, 00:00:04, FastEthernet1/0
O IA 172.16.0.0/16 [110/2] via 192.168.0.2, 00:00:53, FastEthernet1/0
C 10.0.0.0/8 is directly connected, FastEthernet0/0
C 192.168.0.0/24 is directly connected, FastEthernet1/0
O IA 192.168.1.0/24 [110/66] via 192.168.0.2, 00:00:04, FastEthernet1/0
R1-jin#
★☆R4☆★
R4-jin#show ip route
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
C 20.0.0.0/8 is directly connected, FastEthernet0/0
O IA 172.16.0.0/16 [110/65] via 192.168.1.1, 00:00:34, Serial1/0
O E2 10.0.0.0/8 [110/100] via 192.168.1.1, 00:00:34, Serial1/0
O IA 192.168.0.0/24 [110/66] via 192.168.1.1, 00:00:34, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
R4-jin#
四、在area1(R1、R2)上做非纯末梢区域,并查看路由表的变化
★☆R1☆★
R1-jin#
R1-jin#config terminal
R1-jin(config)#router ospf 1
R1-jin(config-router)#area 1 nssa
R1-jin(config-router)#end
R1-jin#show ip route
Press RETURN to get started., 1 subnets
C 1.1.1.1 is directly connected, Loopback0
C 10.0.0.0/8 is directly connected, FastEthernet0/0
C 192.168.0.0/24 is directly connected, FastEthernet1/0
R1-jin#
★☆R2☆★
R2-jin#
R2-jin#config terminal
R2-jin(config)#router ospf 1
R2-jin(config-router)#area 1 nssa
R2-jin(config-router)#end
R2-jin#show ip route
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
O 20.0.0.0/8 [110/66] via 172.16.0.1, 00:00:01, FastEthernet0/0
C 172.16.0.0/16 is directly connected, FastEthernet0/0
C 192.168.0.0/24 is directly connected, FastEthernet1/0
O 192.168.1.0/24 [110/65] via 172.16.0.1, 00:00:01, FastEthernet0/0
★☆R3☆★
R3-jin#show ip route
★☆R4☆★
R4-jin#show ip route
五、配置PC,验证
VPCS 1 >
VPCS 1 >show
VPCS 1 >ip 10.0.0.2 10.0.0.1 8
VPCS 1 >2
VPCS 2 >ip 20.0.0.2 20.0.0.1 8
VPCS 2 >show
NAME IP/CIDR GATEWAY LPORT RPORT
PC1 10.0.0.2/8 10.0.0.1 10001 11100
PC2 20.0.0.2/8 20.0.0.1 10002 11400
PC3 0.0.0.0/0 0.0.0.0 10003 30002
PC4 0.0.0.0/0 0.0.0.0 10004 30003
PC5 0.0.0.0/0 0.0.0.0 10005 30004
PC6 0.0.0.0/0 0.0.0.0 10006 30005
PC7 0.0.0.0/0 0.0.0.0 10007 30006
PC8 0.0.0.0/0 0.0.0.0 10008 30007
PC9 0.0.0.0/0 0.0.0.0 10009 30008
VPCS 2 >ping 10.0.0.2
10.0.0.2 icmp_seq=1 timeout
10.0.0.2 icmp_seq=2 time=156.000 ms
10.0.0.2 icmp_seq=3 time=218.000 ms
10.0.0.2 icmp_seq=4 time=141.000 ms
10.0.0.2 icmp_seq=5 time=172.000 ms
VPCS 2 >
OK !!!! 实验完成!!!