R1:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R1
R1(config)#int f0/0
R1(config-if)#ip add 10.0.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#route ospf 10
R1(config-router)#net 10.0.1.0 0.0.0.255 area 0
R2:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R2
R2(config)#int f0/0
R2(config-if)#ip add 10.0.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int f0/1
R2(config-if)#ip add 10.0.2.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#route ospf 10
R2(config-router)#net 10.0.1.0 0.0.0.255 area 0
R2(config-router)#net 10.0.2.0 0.0.0.255 area 1
R3:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R3
R3(config)#int f0/0
R3(config-if)#ip add 10.0.2.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#int f0/1
R3(config-if)#ip add 10.0.3.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#route ospf 10
R3(config-router)#net 10.0.3.0 0.0.0.255 area 2
R3(config-router)#net 10.0.2.0 0.0.0.255 area 1
R4:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R4
R4(config)#int f0/0
R4(config-if)#ip add 10.0.3.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#route ospf 10
R4(config-router)#net 10.0.3.0 0.0.0.255 area 2
show ip route R1,R2,R3,R4
R1:
R1(config-router)#do show ip route
Codes: L - local, C - connected, S - static, 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
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.0.1.0/24 is directly connected, FastEthernet0/0
L 10.0.1.1/32 is directly connected, FastEthernet0/0
O IA 10.0.2.0/24 [110/2] via 10.0.1.2, 00:03:01, FastEthernet0/0
R2:
R2(config-if)#do show ip route
Codes: L - local, C - connected, S - static, 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
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.0.1.0/24 is directly connected, FastEthernet0/0
L 10.0.1.2/32 is directly connected, FastEthernet0/0
C 10.0.2.0/24 is directly connected, FastEthernet0/1
L 10.0.2.1/32 is directly connected, FastEthernet0/1
R3:
R3(config-router)#do show ip route
Codes: L - local, C - connected, S - static, 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
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O IA 10.0.1.0/24 [110/2] via 10.0.2.1, 00:02:19, FastEthernet0/0
C 10.0.2.0/24 is directly connected, FastEthernet0/0
L 10.0.2.2/32 is directly connected, FastEthernet0/0
C 10.0.3.0/24 is directly connected, FastEthernet0/1
L 10.0.3.1/32 is directly connected, FastEthernet0/1
R4(config)#do show ip route
Codes: L - local, C - connected, S - static, 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
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.0.3.0/24 is directly connected, FastEthernet0/0
L 10.0.3.2/32 is directly connected, FastEthernet0/0
R4:
R4(config)#int f0/1
R4(config-if)#ip add 10.0.4.1 255.255.255.0
R4(config-if)#exit
R4(config)#route ospf 10
R4(config-router)#net 10.0.4.0 0.0.0.255 area 3
R5:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#h R5
R5(config)#int f0/0
R5(config-if)#no shut
R5(config-if)#ip add 10.0.4.0 255.255.255.0
R5(config-if)#exit
R5(config)#int l 0
R5(config-if)#ip add 5.5.5.5 255.255.255.255
R5(config)#route ospf 10
R5(config-router)#net 10.0.4.0 0.0.0.255 area 3
R5(config-router)#router-id 5.5.5.5
Show ip route R1
R1:
R1#show ip route
Codes: L - local, C - connected, S - static, 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
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1/32 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C 10.0.1.0/24 is directly connected, FastEthernet0/0
L 10.0.1.1/32 is directly connected, FastEthernet0/0
O IA 10.0.2.0/24 [110/2] via 10.0.1.2, 00:13:53, FastEthernet0/0
O IA 10.0.3.0/24 [110/3] via 10.0.1.2, 00:13:43, FastEthernet0/0
O IA 10.0.4.0/24 [110/4] via 10.0.1.2, 00:00:11, FastEthernet0/0
OSPF虚链路的配置
R3:
R3(config)#router ospf 10
R3(config-router)#area 2 vir 4.4.4.4
R4:
R4(config)#route ospf 10
R4(config-router)#area 2 vir 3.3.3.3