拓扑图
实验过程
1. R1的预配置
Router>en Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no ip domain-lookup Router(config)#line console 0 Router(config-line)#no exec-timeout Router(config-line)#loggin syn Router(config-line)#exit Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip add 10.1.1.1 255.255.255.0 R1(config-if)#int lo1 R1(config-if)#ip add 10.1.2.1 255.255.255.0 R1(config-if)#int s0/0 R1(config-if)#no shut R1(config-if)#ip add 192.168.1.1 255.255.255.252 R1(config-if)#exit |
2. R2的预配置
Router>en Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no ip domain-lookup Router(config)#line console 0 Router(config-line)#no exec-timeout Router(config-line)#loggin syn Router(config-line)#exit Router(config)#host R2 R2(config)#int s0/0 R2(config-if)#no shut R2(config-if)#ip add 192.168.1.2 255.255.255.252 R2(config-if)#int s0/1 R2(config-if)#no shut R2(config-if)#ip add 192.168.1.5 255.255.255.252 R2(config-if)#exit |
3. R3的预配置
Router>en Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no ip domain-lookup Router(config)#line console 0 Router(config-line)#no exec-timeout Router(config-line)#loggin syn Router(config-line)#exit Router(config)#host R3 R3(config)#int s0/1 R3(config-if)#no shut R3(config-if)#ip add 192.168.1.6 255.255.255.252 R3(config-if)#int s0/2 R3(config-if)#no shut R3(config-if)#ip add 172.16.1.1 255.255.255.0 R3(config-if)#exit |
4. R4的预配置
Router>en Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no ip domain-lookup Router(config)#line console 0 Router(config-line)#no exec-timeout Router(config-line)#loggin syn Router(config-line)#exit Router(config)#host R4 R4(config)#int s0/2 R4(config-if)#no shut R4(config-if)#ip add 172.16.1.2 255.255.255.0 R4(config-if)#int lo0 R4(config-if)#ip add 172.16.2.1 255.255.255.0 R4(config-if)#int lo1 R4(config-if)#ip add 172.16.3.1 255.255.255.0 R4(config-if)#exit |
5. R1的OSPF配置
R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 R1(config-router)#net 192.168.1.1 0.0.0.0 area 1 R1(config-router)#net 10.1.1.1 0.0.0.0 area 1 R1(config-router)#net 10.1.2.1 0.0.0.0 area 1 R1(config-router)#end |
6. R2的OSPF配置
R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#net 192.168.1.2 0.0.0.0 area 1 R2(config-router)#net 192.168.1.5 0.0.0.0 area 0 R2(config-router)#end |
7. R3的OSPF和RIP配置
R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#net 192.168.1.6 0.0.0.0 area 0 R3(config-router)#exit R3(config)#router rip R3(config-router)#version 2 R3(config-router)#no auto R3(config-router)#net 172.16.0.0 R3(config-router)#end |
8. R4的RIP配置
R4(config)#router rip R4(config-router)#version 2 R4(config-router)#no auto R4(config-router)#net 172.16.0.0 R4(config-router)#end |
9. 在R3上配置重分布
R3(config)#router ospf 1 R3(config-router)#redistribute rip metric 100 subnet R3(config-router)#exit R3(config)#router rip R3(config-router)#redistribute ospf 1 metric 10 R3(config-router)#end |
10. 查看R1的链路状态数据库
R1#show ip ospf da OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 1) //LSA 1 Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 50 0x80000005 0x000878 4 2.2.2.2 2.2.2.2 51 0x80000001 0x006E4D 2 Summary Net Link States (Area 1) //LSA 3 Link ID ADV Router Age Seq# Checksum 192.168.1.4 2.2.2.2 52 0x80000001 0x00D8B0 Summary ASB Link States (Area 1) //LSA 4 Link ID ADV Router Age Seq# Checksum 3.3.3.3 2.2.2.2 52 0x80000001 0x0037B0 Type-5 AS External Link States //LSA 5 Link ID ADV Router Age Seq# Checksum Tag 172.16.1.0 3.3.3.3 285 0x80000002 0x001E67 0 172.16.2.0 3.3.3.3 285 0x80000002 0x001371 0 172.16.3.0 3.3.3.3 291 0x80000002 0x00087B 0 |
11. 查看R1的路由表
R1#show ip route ospf 172.16.0.0/24 is subnetted, 3 subnets O E2 172.16.1.0 [110/100] via 192.168.1.2, 00:02:51, Serial0/0 O E2 172.16.2.0 [110/100] via 192.168.1.2, 00:02:51, Serial0/0 O E2 172.16.3.0 [110/100] via 192.168.1.2, 00:02:51, Serial0/0 192.168.1.0/30 is subnetted, 2 subnets O IA 192.168.1.4 [110/128] via 192.168.1.2, 00:02:51, Serial0/0 |
O IA为外部区域的路由,O E2为重发布进来的路由。
12. 测试连通性
R1# R1#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 = 28/52/88 ms R1#ping 172.16.3.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 24/64/108 ms |
13. 在R3上对外部网络进行汇总
R3(config)#router ospf 1 R3(config-router)#summary-address 172.16.2.0 255.255.252.0 //区域外部汇总用summary命令 R3(config-router)#end |
14. 查看R1的链路状态数据库
R1#show ip ospf da OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 761 0x80000005 0x000878 4 2.2.2.2 2.2.2.2 762 0x80000001 0x006E4D 2 Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 192.168.1.4 2.2.2.2 763 0x80000001 0x00D8B0 Summary ASB Link States (Area 1) Link ID ADV Router Age Seq# Checksum 3.3.3.3 2.2.2.2 763 0x80000001 0x0037B0 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 172.16.0.0 3.3.3.3 24 0x80000001 0x001C6E 0 |
15. 查看R1的路由表
R1#show ip route ospf 172.16.0.0/22 is subnetted, 1 subnets O E2 172.16.0.0 [110/100] via 192.168.1.2, 00:03:11, Serial0/0 192.168.1.0/30 is subnetted, 2 subnets O IA 192.168.1.4 [110/128] via 192.168.1.2, 00:15:26, Serial0/0 |
16. 再次测试连通性
R1#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 = 16/65/148 ms R1#ping 172.16.3.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 40/69/144 ms |