二、在Cisco路由器上实现OSPF

R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config-if)#ip address 10.0.0.1 255.255.255.252
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config-if)#ip address 40.0.0.2 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config-router)#network 1.1.1.0 0.0.0.255 area 0
R1(config-router)#network 10.0.0.0 0.0.0.3 area 0
R1(config-router)#network 40.0.0.0 0.0.0.3 area 0
R1(config-router)#exit
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config-if)#ip address 10.0.0.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config-if)#ip address 20.0.0.1 255.255.255.252
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config-router)#network 2.2.2.0 0.0.0.255 area 0
R2(config-router)#network 10.0.0.0 0.0.0.3 area 0
R2(config-router)#network 20.0.0.0 0.0.0.3 area 0
R2(config-router)#exit
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#ip ospf network point-to-point
R3(config-if)#exit
R3(config-if)#ip address 20.0.0.2 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config-if)#ip address 30.0.0.1 255.255.255.252
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config-router)#network 3.3.3.0 0.0.0.255 area 0
R3(config-router)#network 20.0.0.0 0.0.0.3 area 0
R3(config-router)#network 30.0.0.0 0.0.0.3 area 0
R3(config-router)#exit
R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#ip ospf network point-to-point
R4(config-if)#exit
R4(config-if)#ip address 30.0.0.2 255.255.255.252
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config-if)#ip address 40.0.0.1 255.255.255.252
R4(config-if)#clock rate 64000
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config-router)#network 4.4.4.0 0.0.0.255 area 0
R4(config-router)#network 30.0.0.0 0.0.0.3 area 0
R4(config-router)#network 40.0.0.0 0.0.0.3 area 0
R4(config-router)#exit
Routing Protocol is "ospf 1"
Sending updates every 90 seconds, next due in 10 seconds
Invalid after 30 seconds, hold down 0, flushed after 60
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: ospf 1
Routing for Networks:
1.1.1.0 0.0.0.255 area 0
10.0.0.0 0.0.0.255 area 0
40.0.0.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
1.1.1.1 110 00:00:03
10.0.0.1 110 00:00:03
10.0.0.1 110 00:00:03
Distance: (default is 110)
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
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, * - candidate default
U - per-user static route
C 1.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
40.0.0.0/24 is subnetted, 1 subnets
C 40.0.0.0 is directly connected, Serial0/1
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/64] via 10.0.0.2, 00:13:01, Serial0/0
20.0.0.0/24 is subnetted, 1 subnets
O 20.0.0.0 [110/64] via 20.0.0.1, 00:12:46, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/192] via 10.0.0.2, 00:11:55, Serial0/0
30.0.0.0/24 is subnetted, 1 subnets
O 30.0.0.0 [110/192] via 10.0.0.2, 00:11:45, Serial0/0
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0 [110/320] via 10.0.0.2, 00:10:05, Serial0/0
Neighbor 2.2.2.2, interface address 10.0.0.2
In the area 1 via interface Serial0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in
Neighbor 4.4.4.4, interface address 40.0.0.1
In the area 1 via interface Serial0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in
Routing Protocol is "ospf 1"
Sending updates every 90 seconds, next due in 10 seconds
Invalid after 30 seconds, hold down 0, flushed after 60
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: ospf 1
Routing for Networks:
2.2.2.0 0.0.0.255 area 0
10.0.0.0 0.0.0.255 area 0
20.0.0.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
2.2.2.2 110 00:00:03
2.2.2.2 110 00:00:03
10.0.0.2 110 00:00:03
10.0.0.2 110 00:00:03
20.0.0.1 110 00:00:03
Distance: (default is 110)
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
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, * - candidate default
U - per-user static route
C 2.2.2.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
20.0.0.0/24 is subnetted, 1 subnets
C 20.0.0.0 is directly connected, Serial0/1
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/64] via 10.0.0.1, 00:26:27, Serial0/0
40.0.0.0/24 is subnetted, 1 subnets
O 40.0.0.0 [110/64] via 40.0.0.2, 00:26:37, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/64] via 20.0.0.2, 00:24:21, Serial0/1
30.0.0.0/24 is subnetted, 1 subnets
O 30.0.0.0 [110/64] via 30.0.0.1, 00:24:11, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0 [110/192] via 20.0.0.2, 00:24:31, Serial0/1
Neighbor 1.1.1.1, interface address 10.0.0.1
In the area 1 via interface Serial0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in
Neighbor 3.3.3.3, interface address 20.0.0.2
In the area 1 via interface Serial0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in
Routing Protocol is "ospf 1"
Sending updates every 90 seconds, next due in 10 seconds
Invalid after 30 seconds, hold down 0, flushed after 60
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: ospf 1
Routing for Networks:
3.3.3.0 0.0.0.255 area 0
20.0.0.0 0.0.0.255 area 0
30.0.0.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
3.3.3.3 110 00:00:03
3.3.3.3 110 00:00:03
20.0.0.2 110 00:00:03
20.0.0.2 110 00:00:03
Distance: (default is 110)
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
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, * - candidate default
U - per-user static route
C 3.3.3.0 is directly connected, Loopback0
20.0.0.0/24 is subnetted, 1 subnets
C 20.0.0.0 is directly connected, Serial0/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.0.0.0 is directly connected, Serial0/1
10.0.0.0/24 is subnetted, 1 subnets
O 10.0.0.0 [110/128] via 20.0.0.1, 00:30:35, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/64] via 20.0.0.1, 00:30:35, Serial0/0
40.0.0.0/24 is subnetted, 1 subnets
O 40.0.0.0 [110/128] via 30.0.0.2, 00:29:45, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0 [110/64] via 30.0.0.2, 00:29:45, Serial0/1
Neighbor 2.2.2.2, interface address 20.0.0.1
In the area 1 via interface Serial0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in
Neighbor 4.4.4.4, interface address 30.0.0.2
In the area 1 via interface Serial0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in
Routing Protocol is "ospf 1"
Sending updates every 90 seconds, next due in 10 seconds
Invalid after 30 seconds, hold down 0, flushed after 60
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: ospf 1
Routing for Networks:
4.4.4.0 0.0.0.255 area 0
30.0.0.0 0.0.0.255 area 0
40.0.0.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
4.4.4.4 110 00:00:03
4.4.4.4 110 00:00:03
30.0.0.2 110 00:00:03
30.0.0.2 110 00:00:03
Distance: (default is 110)
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
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, * - candidate default
U - per-user static route
C 4.4.4.0 is directly connected, Loopback0
30.0.0.0/24 is subnetted, 1 subnets
C 30.0.0.0 is directly connected, Serial0/0
40.0.0.0/24 is subnetted, 1 subnets
C 40.0.0.0 is directly connected, Serial0/1
20.0.0.0/24 is subnetted, 1 subnets
O 20.0.0.0 [110/128] via 30.0.0.1, 00:32:17, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/64] via 30.0.0.1, 00:32:17, Serial0/0
10.0.0.0/24 is subnetted, 1 subnets
O 10.0.0.0 [110/128] via 40.0.0.2, 00:32:07, Serial0/1
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/64] via 40.0.0.2, 00:32:07, Serial0/1
R4#show ip ospf neighbor detail
Neighbor 1.1.1.1, interface address 40.0.0.2
In the area 1 via interface Serial0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in
Neighbor 3.3.3.3, interface address 30.0.0.1
In the area 1 via interface Serial0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options 2
Dead timer due in