R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.10.0 0.0.0.255 area 0
R1(config-router)#network 12.0.0.0 0.0.0.255 area 0
·
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 12.0.0.0 0.0.0.255 area 0
R2(config-router)#network 13.0.0.0 0.0.0.255 area 0
·
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 13.0.0.2 0.0.0.255 area 0
R3(config-router)#network 192.168.20.0 0.0.0.255 area 0
·
R1#show ip route
C 192.168.10.0/24 is directly connected, FastEthernet0/0
O 192.168.20.0/24 [110/30] via 12.0.0.2, 00:08:07, FastEthernet0/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, FastEthernet0/1
13.0.0.0/24 is subnetted, 1 subnets
O 13.0.0.0 [110/20] via 12.0.0.2, 00:08:07, FastEthernet0/1
·
路由条目192.168.20.0前面标识为O,说明是通过OSPF学习来的
OSPF的管理距离为110 ,后面的30表示开销值
原文地址:http://blog.51cto.com/13348945/2093520