R1配置
r1(config)#int lo0
r1(config-if)#ip add 1.1.1.1 255.255.255.0
r1(config-if)#int s1/2
r1(config-if)#ip ad 10.1.1.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#int s1/3
r1(config-if)#ip add 10.1.2.1 255.255.255.0
r1(config-if)#no sh
r1(config)#router ospf 100
r1(config-router)#net 1.1.1.0 0.0.0.255 area 0
r1(config-router)#net 10.1.1.0 0.0.0.255 area 0
r1(config-router)#net 10.1.2.0 0.0.0.255 area 0
r1(config-router)#^Z
R2配置
r2(config)#int lo0
r2(config-if)#ip add 2.2.2.2 255.255.255.0
r2(config-if)#int lo1
r2(config-if)#ip add 172.16.1.2 255.255.255.0
r2(config-if)#int s2/1
r2(config-if)#ip add 10.1.1.2 255.255.255.0
r2(config-if)#no sh
r2(config)#router ospf 101
r2(config-router)#network 2.2.2.0 0.0.0.255 area 0
r2(config-router)#network 172.16.1.0 0.0.0.255 area 0
r2(config-router)#network 10.1.1.0 0.0.0.255 area 0
r2(config)#^Z
R3配置
r3(config)#int lo0
r3(config-if)#ip add 3.3.3.3 255.255.255.0
r3(config-if)#int lo1
r3(config-if)#ip add 192.168.1.3 255.255.255.0
r3(config-if)#int s3/1
r3(config-if)#ip add 10.1.2.3 255.255.255.0
r3(config)#router ospf 102
r3(config-router)#network 3.3.3.0 0.0.0.255 area 0
r3(config-router)#network 192.168.1.0 0.0.0.255 area 0
r3(config-router)#network 10.1.2.0 0.0.0.255 area 0
r3(config)#^Z
在R1上show一下
r1#sh ip ro
r1#sh ip route
Codes: C �C connected, S �C static, I �C IGRP, R �C RIP, M �C mobile, B �C BGP
D �C EIGRP, EX �C EIGRP external, O �C OSPF, IA �C OSPF inter area
N1 �C OSPF NSSA external type 1, N2 �C OSPF NSSA external type 2
E1 �C OSPF external type 1, E2 �C OSPF external type 2, E �C EGP
i �C IS-IS, L1 �C IS-IS level-1, L2 �C IS-IS level-2, * �C candidate default
U �C per-user static route, o �C ODR
T �C traffic engineered route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 10.1.1.2, 00:00:44, Serial1/2
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 10.1.2.3, 00:00:44, Serial1/3
172.16.0.0/32 is subnetted, 1 subnets
O 172.16.1.2 [110/65] via 10.1.1.2, 00:00:44, Serial1/2
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Serial1/3
C 10.1.1.0 is directly connected, Serial1/2
192.168.1.0/32 is subnetted, 1 subnets
O 192.168.1.3 [110/65] via 10.1.2.3, 00:00:44, Serial1/3
r1#sh ip protocols
Routing Protocol is “ospf 100″
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: ospf 100
Routing for Networks:
1.1.1.0/24
10.1.1.0/24
10.1.2.0/24
Routing Information Sources:
Gateway Distance Last Update
192.168.1.3 110 00:05:04
172.16.1.2 110 00:05:04
Distance: (default is 110)
r1#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
172.16.1.2 1 FULL/ - 00:00:33 10.1.1.2 Serial1/2
192.168.1.3 1 FULL/ - 00:00:33 10.1.2.3 Serial1/3
r1#sh ip ospf interface
Serial1/2 is up, line protocol is up
Internet Address 10.1.1.1/24, Area 0
Process ID 100, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:03
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 172.16.1.2
Suppress hello for 0 neighbor(s)
Serial1/3 is up, line protocol is up
Internet Address 10.1.2.1/24, Area 0
Process ID 100, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:05
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.1.3
Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
Internet Address 1.1.1.1/24, Area 0
Process ID 100, Router ID 1.1.1.1, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host
r1#