-
思科
OSPF
实验
1<
/p>
:基本的
OSPF
配置
< br>
实验步骤:
1.
首先在
3
台路由器上配
置物理接口,并且使用
ping
命令确保物理链路的畅通。
p>
2.
在路由器上配置
loopback
接口:
R1(config)#int loopback 0
R1(config-if)#ip add 1.1.1.1
255.255.255.0
R2(config)#int
loopback 0
R2(config-if)#ip
add 2.2.2.2 255.255.255.0
R3(config)#int loopback 0
R3(config-if)#ip add 3.3.3.3
255.255.255.0
路由器的
RID
是路由器接口的最高的
IP
地址,当有环回口存在是,路由器将
使用环回口的最高
p>
IP
地址作为起
RID
,从而保证
RID
的稳定。
3
.
在
p>
3
台路由器上分别启动
ospf
进程,并且宣告直连接口的网络。
R1(config)#router ospf
10
R1(config-
router)#network 192.168.1.0
0.0.0.255
area
0
R1(config-router)#network
1.1.1.0 0.0.0.255 area 0
R1(config-router)#network
192.168.3.0.0.0.255 area 0
o
spf
的进程号只有本地意义,
既在不同路由器上的进程号可以
不相同。
但是为了
日后维护的方便,一般启用相同的进程号。<
/p>
ospf
使用反向掩码。
Area 0
表示骨干区域
,在设计
ospf
网络时,所有的非骨干
区域都需要和骨干区域
直连
!
R2
,
R3
的配置和
R1
< br>类似,
这里省略。
不同的是我们在
R2
和
R3
上不宣告各自的
环回口。
*Aug 13
17:58:51.411: %OSPF-5-ADJCHG: Process 10, Nbr
2.2.2.2 on Serial1/0 from LOADING to FULL,
Loading Done
配置结束
后,我们可以看到邻居关系已经到达
FULL
状态。
4.
R1#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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/24 is subnetted, 1
subnets
在
R1
上查看路由表,可以看到以下信息:
C
1.1.1.0 is directly
connected, Loopback0
C
192.168.1.0/24 is directly
connected, Serial1/0
O
192.168.2.0/24 [110/65]
via 192.168.1.2, 00:03:42, Serial1/0
C
192.168.3.0/24 is directly connected,
FastEthernet0/
我们看到
R1
学到了
192.168.2.0/24
这个网段的路由。
后面的数字
[110/65]
,分别
表示
OSPF
的管理距离(
AD
)和路由的
Metr
ic
值
OSPF
的
Metric
值是由
cost<
/p>
值逐跳累加的。
Cost=100Mb/
带宽值。
5.
在
< br>R1
上
show ip ospf neighbor
、
show ip ospf
interface
R1#show ip ospf
neighbor
Neighbor ID
Pri
State
Dead
Time
Address
Interface
3.3.3.3
1
FULL/BDR
00:00:34
192.168.3.3
FastEthernet0/0
2.2.2.2
0
FULL/
-
00:00:32
192.168.1.2
Serial1/0
我们看到
R1
和
R3
选取了<
/p>
DR
和
BDR
,
而
R1
和
R2
没有选取。
在
ospf
的五种网络类型中。
Point-to-Point,Point-to-M
ultipoint(
广播与非广播
)
这三种网络类
型不选取
DR
与
BDR; Broadcast,NBMA
选取
DR
与
BDR
。
R1#show ip ospf interface
FastEthernet0/0 is up, line protocol is
up
Internet
Address 192.168.3.1/24, Area 0
Process ID 10, Router ID
1.1.1.1,
Network Type
BROADCAST
, Cost: 1
Transmit Delay is 1 sec,
State DR, Priority 1
Designated Router (ID) 1.1.1.1,
Interface address 192.168.3.1
Backup Designated router
(ID) 3.3.3.3, Interface address
192.168.3.3
Timer intervals configured, Hello 10,
Dead 40, Wait 40, Retransmit 5
oob-resync timeout
40
Hello due in
00:00:03
Index
3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is
1, maximum is 1
Last flood scan time is 0 msec, maximum
is 0 msec
Neighbor Count is 1, Adjacent neighbor
count is 1