题目:
题目分析:
由题可知:有两个广播域,三个回环,一条骨干链路,区域0需要一个网段,需要划分5个网段
骨干链路(由于上面只需要两个主机,所以使网络号为30):
192.168.1.0/30
区域0(只需要三个地址):
192.168.1.0101 0001 192.168.1.81/28
192.168.1.0101 0010 192.168.1.82/28
192.168.1.0101 0011 192.168.1.83/28
环回:
192.168.1.0001 0001 192.168.1.17/28
192.168.1.0010 0001 192.168.1.33/28
192.168.1.0011 0001 192.168.1.49/28
如图:
第一步:基础配置
此处省略
第二步:启用ospf
笔记参考:
[R1]ospf 1 router-id 1.1.1.1 创建ospf 进程为1 RID为 1.1.1.1
[R1-ospf-1]area 0 定义进入0区域
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
反掩码
<R1>display ospf peer 查看详细邻居关系
<R1>display ospf peer brief 查看邻居表
<R1>display ospf lsdb 查看数据库目录
<R1>display ospf lsdb router 2.2.2.2 打开数据库表中的具体路由信息
[R1-ospf-1]bandwidth-reference 1000 修改参考带宽为1000M
注意:一旦修改带宽,全网设备均需修改
对R1,R2:
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.81 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.17 0.0.0.0
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.49 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.83 0.0.0.0
对R3:
[r3]ospf 1 ro 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.82 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.33 0.0.0.0 //宣告区域0内的接口
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.1.1 0.0.0.0 //宣告区域1内的接口
对R4:
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 192.168.1.2 0.0.0.0
第三步:设置DR
要求R1-R3中,R3为DR设备,且R1-R3中没有BDR设备。
选举DR/BDR的规则为:
1.先比较该网段所有参选设备接口的优先级,越大越优;
默认优先级为1;取值范围0-255,0标识不参选
2.若所有参选者优先级相同,比较参选设备的RID,数值大优
所以在区域0中R3是DR(Master),R2是BDR(Master)
选举DR/BDR默认优先级为1,所以将R1、R2的优先级设置为0,将R3的优先级设置为2;
ospf的选举是非抢占性的;故在修改完优先级后,需要所有路由器重启OSPF进程。
下列为R3的配置:
[r3]display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.1.82(GigabitEthernet0/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.81
State: Full Mode:Nbr is Slave Priority: 0
DR: 192.168.1.82 BDR: None MTU: 0
Dead timer due in 33 sec
Retrans timer interval: 5
Neighbor is up for 00:02:18
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.83
State: Full Mode:Nbr is Slave Priority: 0
DR: 192.168.1.82 BDR: None MTU: 0
Dead timer due in 33 sec
Retrans timer interval: 5
Neighbor is up for 00:02:28
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.1.1(GigabitEthernet0/0/1)'s neighbors
Router ID: 4.4.4.4 Address: 192.168.1.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.2 BDR: 192.168.1.1 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:03:04
Authentication Sequence: [ 0 ]
第四步:汇总
ospf协议不支持接口汇总;只能在ABR上将a区域拓扑计算所得路由,共享给B区域时进行汇总
分析拓扑图,得知R3是区域0到区域1的ABR(区域边界路由器),则在R3中进行配置
第五步:配置缺省路由
第六步:
要求:全网可达的同时,路由器之间更新安全。
在直连邻居或邻接的接口上配置,保障更新的安全。
而区域0中R1-R3都是直连邻居或邻接的接口,所以认证码要一致,而区域1中只要求R3和R4之间认证码相同
区域0:
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123
区域1:
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 124
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 124
测试:
[r1]ping 4.4.4.1
PING 4.4.4.1: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.1: bytes=56 Sequence=1 ttl=254 time=50 ms
Reply from 4.4.4.1: bytes=56 Sequence=2 ttl=254 time=70 ms
Reply from 4.4.4.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 4.4.4.1: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 4.4.4.1: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 4.4.4.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/50/70 ms
[r1]ping 192.168.1.49
PING 192.168.1.49: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.49: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.1.49: bytes=56 Sequence=2 ttl=255 time=60 ms
Reply from 192.168.1.49: bytes=56 Sequence=3 ttl=255 time=60 ms
Reply from 192.168.1.49: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 192.168.1.49: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 192.168.1.49 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/48/60 ms
[r1]ping 192.168.1.82
PING 192.168.1.82: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.82: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 192.168.1.82: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.1.82: bytes=56 Sequence=3 ttl=255 time=70 ms
Reply from 192.168.1.82: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 192.168.1.82: bytes=56 Sequence=5 ttl=255 time=60 ms
--- 192.168.1.82 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/52/70 ms