题目要求:
首先第一步先配置分配ip
192.168.1.0/24
192.168.1.0 000000 192.168.1.0/25 区域0 192.168.1.0/26 192.168.1.64/26
192.168.1.1 000000 192.168.1.128/25 区域1 192.168.1.128/26 192.168.1.192/26
接下来给每个路由器配置环回及IP
r1
r2
r3
r4
第二步:给每个路由器接口配置ospf,为了减少路由条目,对两个区域的网段进行汇总
[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.1 0.0.0.0[r1-ospf-1-area-0.0.0.0]network 192.168.1.65 0.0.0.0[r1-ospf-1-area-0.0.0.0]q[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.2 0.0.0.0[r2-ospf-1-area-0.0.0.0]network 192.168.1.66 0.0.0.0[r2-ospf-1-area-0.0.0.0]q[r3]ospf 1 router-id 3.3.3.3[r3]ospf 1[r3-ospf-1]area 0[r3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0[r3-ospf-1-area-0.0.0.0]network 192.168.1.67 0.0.0.0[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.128[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.129 0.0.0.0[r3-ospf-1-area-0.0.0.1]abr-summary 192.168.1.128 255.255.255.128[r3-ospf-1-area-0.0.0.1]q[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.130 0.0.0.0[r4-ospf-1-area-0.0.0.1]q
因为r4环回不能宣告,则配置一条缺省
[r4-ospf-1]default-route-advertise always
题目要求r3为DR设备,没有BDR,则把其他设备的优先级改为0,不参与选举
例如
[r1]interface GigabitEthernet 0/0/0[r1-GigabitEthernet0/0/0]ospf dr-priority 0
本来修改优先级后应在短时间内重庆ospf进程,但是优先级为0,0标识不参选,不用重启所有设备的ospf进程,直接选举完成,最后查看配置dsiplay ospf peer
[r3]display ospf peer OSPF Process 1 with Router ID 3.3.3.3Neighbors Area 0.0.0.0 interface 192.168.1.3(GigabitEthernet0/0/0)'s neighborsRouter ID: 1.1.1.1Address: 192.168.1.1 State: Full Mode:Nbr is Slave Priority: 0DR: 192.168.1.3 BDR: None MTU: 0 Dead timer due in 33 sec Retrans timer interval: 5 Neighbor is up for 00:00:57Authentication Sequence: [ 0 ] Router ID: 2.2.2.2Address: 192.168.1.2 State: Full Mode:Nbr is Slave Priority: 0DR: 192.168.1.3 BDR: None MTU: 0 Dead timer due in 40 sec Retrans timer interval: 6 Neighbor is up for 00:00:39Authentication Sequence: [ 0 ]
然后为了保证邻居间更新安全,邻居间密码和模式、编号必须完全一致
[r1]interface GigabitEthernet 0/0/0[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456[r2]interface GigabitEthernet 0/0/0[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456[r3]interface GigabitEthernet 0/0/0[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456[r3-GigabitEthernet0/0/0]q[r3]interface GigabitEthernet 0/0/1[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456[r4]interface GigabitEthernet 0/0/0[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
最后为了避免环路需要配置空接口
[r1]ip route-static 192.168.1.0 26 NULL 0[r2]ip route-static 192.168.1.64 26 NULL 0[r3]ip route-static 192.168.1.96 26 NULL 0[r4]ip route-static 192.168.1.128 26 NULL 0
实验完成。