CCNP路由实验(2) -- OSPF

时间:2021-05-14 12:07:55

OSPF作为一种内部网关协议(IGP),用于在同一个AS中的路由器之间交换路由信息。
OSPF的特性如下:
1.可适应大规模网络
2.收敛速度快
3.无路由环路
4.支持VLSM和CIDR
5.支持等价路由
6.支持区域划分,构成结构化的网络
7.提供路由分级管理
8.支持简单口令和MD5认证
9.以组播方式传送协议报文
10.OSPF路由协议的管理距离是110
11.OSPF路由协议采用cost作为度量标准
12.OSPF维护邻居表、拓扑表和路由表

OSPF将网络划分为4中类型:
广播多路访问(BMA)
非广播多路访问(NBMA)
点到点(Point-to-Point)
点到多点(Point-to-MultiPoint)

需要掌握的几个术语:
1.链路:路由器用来连接网络的接口
2.链路状态:用来描述路由器接口及其邻居路由器的关系。所有链路状态信息构成链路状态数据库
3.区域:有相同的区域标识的一组路由器和网络的集合。同一区域内的路由器具有相同的链路状态数据库
4.自治系统:采用同一种路由协议交换路由的路由器及其网络构成一个自治系统
5.链路状态通告(LSA):LSA用来描述路由器的本地状态,LSA包括的信息有关于路由器接口的状态和所形成的邻接状态

CCNP路由实验(2) -- OSPF

1.多区域的OSPF
    OSPF的DR和BDR选择
2.OSPF汇总
    区域间汇总
    区域外汇总
3.OSPF的网络类型
    点到点网络的网络类型
    广播网络的网络类型
    不同网络类型间相互学习
    NBMA下的OSPF
4.OSPF认证
    OSPF的明文认证
    OSPF的MD5认证
5.OSPF注入默认路由
6.OSPF的特殊区域
    OSPF末节区域
    OSPF完全末节区域
    OSPF次末节区域
    OSPF完全次末节区域
7.OSPF虚电路
    把非骨干区域连接到骨干区域
    不连续的骨干区域
8.OSPF区域间选路

基本配置:
-----------------------------------------------
enable
conf t
no ip do lo
enable pass cisco
line con 0
logg sync
exec-t 0 0
line vty 0 4
pass cisco
logg sync
exit
host

1. 多区域OSPF:
-------------------------------------------------------------------------------

CCNP路由实验(2) -- OSPF

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 1
network 11.1.1.0 0.0.0.255 area 1
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 1
network 22.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 0
exit

R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int f1/0
ip add 34.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 33.1.1.1
network 23.1.1.0 0.0.0.255 area 0
network 33.1.1.0 0.0.0.255 area 0
network 34.1.1.0 0.0.0.255 area 2
exit

R4:
int f0/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
int l0
ip add 44.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 44.1.1.1
network 34.1.1.0 0.0.0.255 area 2
network 44.1.1.0 0.0.0.255 area 2
exit

OSPF路由进程ID的范围必须在1-65535之间,而且只有本地含义,不同路由器的路由进程ID可以不同。如果想要启动OSPF进程,至少需要确保路由器有一个接口是up的。
Area ID是在0-4294967295内的十进制数,可以是IP地址的格式A.B.C.D。当网络Area ID为0或者0.0.0.0时称为主干区域。
在高版本的IOS中通告OSPF网络的时候,网络号的后边可以跟网络掩码,也可以跟反掩码。
确定Router ID顺序如下:优先选定在OSPF进程中用命令"router-id"指定的路由器ID;如果没有指定,则选择IP地址最大的环回接口的IP地址;如果没有环回接口,则选择最大的活动物理接口的IP地址。建议手动指定。

R1:
end
show ip route ospf
conf t
环回接口OSPF路由条目的掩码长度都是32位,这是环回接口的特性,尽管通告了24位。解决的办法是在环回接口下修改网络类型为"Point-to-Point"。其默认网络类型是LOOPBACK,物理接口的默认网络类型是BROADCAST。
R2:
int l0
ip ospf network point-to-point
exit

R1:
end
show ip protocols
show ip ospf int f0/0
show ip ospf neighbor

CCNP路由实验(2) -- OSPFshow ip ospf database

CCNP路由实验(2) -- OSPFconf t

DR BDR选择
CCNP路由实验(2) -- OSPFR1:
int f0/0
ip ospf prio 10
exit

R2:
end
show ip ospf neighbor

clear ip ospf process
y

show ip ospf neighbor
conf t

R3:
int f0/0
ip ospf prio 0
exit

R2:
end
show ip ospf neighbor
conf t

2. OSPF汇总

区域间汇总
-----------------------------------------------------------------
R2:
router ospf 1
area 0 range 22.1.0.0 255.255.0.0
area 0 range 33.1.0.0 255.255.0.0
exit

R1:
end
show ip route ospf
conf t

R4:
int l1
ip add 44.1.2.1 255.255.255.0
exit
int l2
ip add 44.1.3.1 255.255.255.0
exit
router ospf 1
network 44.1.2.0 0.0.0.255 area 2
network 44.1.3.0 0.0.0.255 area 2
exit

R1:
end
show ip route ospf
conf t

R3:
router ospf 1
area 2 range 44.1.0.0 255.255.0.0
exit

区域外汇总
--------------------------------------------------------------------
R4:
int l10
ip add 144.1.1.1 255.255.255.0
exit
int l11
ip add 144.1.2.1 255.255.255.0
exit
int l12
ip add 144.1.3.1 255.255.255.0
exit

router ospf 1
redistribute connected subnets
exit

R1:
end
show ip route ospf
conf t

R4:
router ospf 1
summary-add 144.1.0.0 255.255.0.0
exit

R1:
end
show ip route ospf
conf t

3. OSPF网络类型:
------------------------------------------------------------------------

在点到点的网络OSPF的网络类型
点到点的二层网络类型主要出现的地方有两个:1是串行链路;2是帧中继的点对点链路。

CCNP路由实验(2) -- OSPFR1:
int s0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

R2:
int s0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
exit

R1:
end
show ip ospf int s0/0
conf t
-----------------------------------------------------------------
R1/R2:
int s0/0
ip ospf network broadcast
ip ospf network point-to-multipoint
ip ospf network point-to-multipoint non-broadcast
exit

R1:
show ip ospf int s0/0
-------------------------------------------------------------
R1/R2:
int s0/0
ip ospf network non-broadcast
exit

R1:
router ospf 1
neighbor 12.1.1.2
exit

R1:
show ip ospf int s0/0

广播网络的OSPF网络类型
--------------------------------------------------------------------------

CCNP路由实验(2) -- OSPF

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
exit

R1:
end
show ip ospf int f0/0
conf t
----------------------------------------------------------------------
R1/R2:
int f0/0
ip ospf network point-to-point
exit

R1:
show ip ospf int f0/0

不同网络类型之间相互学习
----------------------------------------------------------------

CCNP路由实验(2) -- OSPFR1:
int s0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

R2:
int s0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
exit

R1:
int s0/0
ip ospf network point-to-point
exit

R2:
int s0/0
ip ospf network broadcast
exit

R1:
show ip ospf neighbor
show ip route
show ip ospf database

CCNP路由实验(2) -- OSPF

CCNP路由实验(2) -- OSPF

NBMA环境下的OSPF
----------------------------------------------------------

CCNP路由实验(2) -- OSPFR4:
frame-relay switch

int s0/1
encap frame-relay
frame-relay lmi-type cisco
frame-relay intf-type dce
frame-relay route 102 int s0/2 201
frame-relay route 103 int s0/3 301
no shut
exit

int s0/2
encap frame-relay
frame-relay lmi-type cisco
frame-relay intf-type dce
frame-relay route 201 int s0/1 102
no shut
exit

int s0/3
encap frame-relay
frame-relay lmi-type cisco
frame-relay intf-type dce
frame-relay route 301 int s0/1 103
no shut
exit

end
show frame-relay route
conf t

R1:
int s0/0
ip add 123.1.1.1 255.255.255.0
encap frame-relay
no frame-relay inverse-arp
frame-relay map ip 123.1.1.2 102 broadcast
frame-relay map ip 123.1.1.3 103 broadcast
no shut
exit

R2:
int s0/0
ip add 123.1.1.2 255.255.255.0
encap frame-relay
no frame-relay inverse-arp
frame-relay map ip 123.1.1.1 201 broadcast
frame-relay map ip 123.1.1.3 201 broadcast
no shut
exit

R3:
int s0/0
ip add 123.1.1.3 255.255.255.0
encap frame-relay
no frame-relay inverse-arp
frame-relay map ip 123.1.1.1 301 broadcast
frame-relay map ip 123.1.1.2 301 broadcast
no shut
exit

R2:
ping 123.1.1.1
ping 123.1.1.3

R1:
router ospf 1
router-id 11.1.1.1
network 123.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

R2:
router ospf 1
router-id 22.1.1.1
network 123.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
exit

R3:
router ospf 1
router-id 33.1.1.1
network 123.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
exit

R1:
show ip ospf neighbor

会发现并没有任何邻居发现,这是因为在NBMA的网络,是没有办法自动发现邻居的,需要手动指邻居,在任何一方指都行。

R1:
router ospf 1
neighbor 123.1.1.2
neighbor 123.1.1.3
exit

show ip ospf neighbor

R2:
show ip route

会发现邻居已经起来了,但是R2没有学到任何路由,这是因为R3被选为DR,造成DR不对称。在NBMA网络中,一定要控制DR在HUB点上。

R2/R3:
int s0/0
ip ospf priority 0
exit

R2:
show io route ospf
show ip ospf int s0/0

R1/R2/R3:
int s0/0
ip ospf network point-to-multipoint
exit

R1:
show ip route ospf

4. OSPF明文认证和MD5认证:
---------------------------------------------------------------

CCNP路由实验(2) -- OSPFR1:
int s0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

R2:
int s0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
exit

R1/R2:
show ip route ospf

R1/R2:
int s0/0
ip ospf authentication
ip ospf authentication-key cisco
exit

R1/R2:
show ip ospf int s0/0

R1/R2:
int s0/0
no ip ospf authentication
no ip ospf authentication-key cisco
exit

router ospf 1
area 0 authentication
no area 0 authentication
exit

OSPF的MD5认证与明文认证的配置非常相似,开启的方法也有两种,基于链路和基于区域。在配置秘钥的时候,都只能去链路下配置。每条链路可以配置成不一样的。

R1/R2:
int s0/0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 cisco
exit

R1/R2:
int s0/0
no ip ospf authentication message-digest
no ip ospf message-digest-key 1 md5 cisco
exit

router ospf 1
area 0 authentication message-digest
exit

OSPF链路认证开启优先于区域认证开启,也就是说在链路上开启的明文,但是在区域里开启了MD5,则此链路是明文的认证。

5. OSPF注入默认路由
---------------------------------------------------------------
R2:
router ospf 1
default-information originate always
exit

如果不使用可选的"always"参数, 路由器上必须存在一条默认路由;如果使用该参数,无论路由器上是否存在默认路由,都会向OSPF区域内注入一条默认路由。

6. OSPF特殊区域:
-------------------------------------------------------------------------------

CCNP路由实验(2) -- OSPF

OSPF末节区域

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 1
network 11.1.1.0 0.0.0.255 area 1
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 1
network 22.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 0
exit

R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int f1/0
ip add 34.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 33.1.1.1
network 23.1.1.0 0.0.0.255 area 0
network 33.1.1.0 0.0.0.255 area 0
network 34.1.1.0 0.0.0.255 area 2
exit

R4:
int f0/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
int l0
ip add 44.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 44.1.1.1
network 34.1.1.0 0.0.0.255 area 2
network 44.1.1.0 0.0.0.255 area 2
exit

R4:
int l1
ip add 144.1.1.1 255.255.255.0
exit
router ospf 1
redistribute connected subnets
exit

R1:
show ip route ospf

R1/R2:
router ospf 1
area 1 stub
exit

R1:
show ip route ospf

可以发现R1上再也收不到144.1.1.0/24的这条路由了,OSPF的stub区域就是用来阻止外部路由的。此外我们发现生成了一条区域间的默认路由,这里area 1的路由器要访问OSPF外部的路由都是走这条缺省路由。

完全末节区域
--------------------------------------------------------------------------------
area 1已经是一个末节区域了,阻止了OSPF的外部路由。但是我们发现,区域间的路由还是很多,路由表没有减到最小,此时就需要一个完全的末节区域。完全末节区域需要在ABR上配置。
R2:
router ospf 1
area 1 stub no-summary
exit

R1:
show ip route ospf
此时路由表已经减少到最小了,area 1的路由器(这里只有R1)去往所有区域外的路由和区域间的路由都用词默认路由就可以了。

OSPF次末节区域
---------------------------------------------------------------------
area 1配置末节区域之后,不能引入外部路由。如果想保留stub区域较少路由条目的优点,又想引入外部路由的话,就需要用到NSSA。

R1/R2:
router ospf 1
no area 1 stub
exit

R1/R2:
router ospf 1
area 1 nssa
exit

区域1阻止了外部的路由,并且还能够重分布进路由条目。
如果只是配置一个NSSA区域,需要去R2上手动产生一条默认路由让NSSA区域的路由器能够去访问外部。
R2:
router ospf 1
area 1 nssa default-information-originate
exit

R1:
int l1
ip add 111.1.1.1 255.255.255.0
exit
router ospf 1
redistribute connected subnets
exit

R4:
show ip route ospf

OSPF完全次末节区域
----------------------------------------------------------------
此时area 1(R1,R2)已经是一个NSSA区域了,我们想把路由条目减到最少,就要用到完全次末节区域。与stub一样,只需要在ABR上配置就可以了。
R2:
router ospf 1
area 1 nssa no-summary
exit

R1/R4:
show ip route ospf

7. OSPF虚电路:
-------------------------------------------------------------------------------
把非骨干区域连接到骨干区域

CCNP路由实验(2) -- OSPF

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 1
exit

R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int f1/0
ip add 34.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 33.1.1.1
network 23.1.1.0 0.0.0.255 area 1
network 33.1.1.0 0.0.0.255 area 1
network 34.1.1.0 0.0.0.255 area 2
exit

R4:
int f0/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
int l0
ip add 44.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 44.1.1.1
network 34.1.1.0 0.0.0.255 area 2
network 44.1.1.0 0.0.0.255 area 2
exit

R4:
show ip ospf neighbor
show ip route ospf
会发现学不到任何区域间路由,原因是区域间的路由学习,只能通过连接到骨干区域的ABR传过来,两个普通区域相连接并不会传递路由信息,这就需要用到虚电路。
由于area 2 被 area 1分割开,所以虚电路需要在area 1里面去做。

R2:
router ospf 1
area 1 virtual-link 33.1.1.1
exit

R3:
router ospf 1
area 1 virtual-link 22.1.1.1
exit

R3:
show ip ospf neighbor

R4:
show ip route ospf

不连续的骨干区域
-------------------------------------------------------------------------------

CCNP路由实验(2) -- OSPF

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 1
exit

R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int f1/0
ip add 34.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 33.1.1.1
network 23.1.1.0 0.0.0.255 area 1
network 33.1.1.0 0.0.0.255 area 0
network 34.1.1.0 0.0.0.255 area 0
exit

R4:
int f0/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
int l0
ip add 44.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 44.1.1.1
network 34.1.1.0 0.0.0.255 area 0
network 44.1.1.0 0.0.0.255 area 0
exit

R1/R4:
show ip route ospf

R2:
router ospf 1
area 1 vritual-link 33.1.1.1
exit

R3:
router ospf 1
area 1 virtual-link 22.1.1.1
exit

R2/R3:
show ip ospf neighbor

R1/R4:
show ip route ospf

7. OSPF区域间选路
-------------------------------------------------------------------------------

CCNP路由实验(2) -- OSPF

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
exit

router ospf 1
router-id 11.1.1.1
network 11.1.1.0 0.0.0.255 area 2
network 12.1.1.0 0.0.0.255 area 2
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int f2/0
ip add 24.1.1.2 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 2
network 24.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 0
exit

R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int f1/0
ip add 35.1.1.3 255.255.255.0
no shut
exit
int f2/0
ip add 34.1.1.3 255.255.255.0
no shut
exit

router ospf 1
router-id 33.1.1.1
network 23.1.1.0 0.0.0.255 area 0
network 35.1.1.0 0.0.0.255 area 1
network 34.1.1.0 0.0.0.255 area 1
exit

R4:
int f0/0
ip add 24.1.1.4 255.255.255.0
no shut
exit
int f1/0
ip add 45.1.1.4 255.255.255.0
no shut
exit
int f2/0
ip add 34.1.1.4 255.255.255.0
no shut
exit

router ospf 1
router-id 44.1.1.1
network 24.1.1.0 0.0.0.255 area 0
network 45.1.1.0 0.0.0.255 area 1
network 34.1.1.0 0.0.0.255 area 1
exit

R5:
int f0/0
ip add 35.1.1.5 255.255.255.0
no shut
exit
int f1/0
ip add 45.1.1.5 255.255.255.0
no shut
exit

router ospf 1
router-id 55.1.1.1
network 35.1.1.0 0.0.0.255 area 1
network 45.1.1.0 0.0.0.255 area 1
exit

R1:
int f0/0
ip ospf cost 1
exit

R2:
int f0/0
ip ospf cost 1
exit
int f1/0
ip ospf cost 10
exit
int f2/0
ip ospf cost 2
exit

R3:
int f0/0
ip ospf cost 10
exit
int f1/0
ip ospf cost 2
exit
int f2/0
ip ospf cost 2
exit

R4:
int f0/0
ip ospf cost 2
exit
int f1/0
ip ospf cost 5
exit
int f2/0
ip ospf cost 2
exit

R5:
int f0/0
ip ospf cost 2
exit
int f1/0
ip ospf cost 5
exit

R5:
show ip route ospf
trace 12.1.1.1

CCNP路由实验(2) -- OSPF