一、需求及拓扑图
需求:
1、整个网络使用192.168.1.0/24网段进行地址分配
2、Area 0区域中,R1为DR,R2为BDR
3、R3与R4之间使用密文认证,密码为Admin@huawei.com
4、R1、R2、R5上各自配置一个环回接口。R1和R2的环回接口可以宣告到OSPF网络
5、设备的RID为每台设备的名称编号(AR1==1.1.1.1)
6、全网可达
二、需求分析
1.划分网段
2.配置IP
3.启动OSPF
4.认证
5.DR和BDR
6.缺省路由
三、配置过程
1.划分网段
192.168.1.0/24
192.168.1.0/27 ---> 192.168.1.0/30 192.168.1.4/30
192.168.1.32/27
192.168.1.64/27
192.168.1.96/27
192.168.1.128/27
2.配置IP
R1
物理接口:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.33 27
环回接口:
r1]interface loopback 0
[r1-LoopBack0]ip address 192.168.1.65 27
R2
物理接口:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.34 27
环回接口:
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.1.97 27
R3
物理接口:
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.35 27
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.1 30
R4
物理接口:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[r4]interface GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.1.5 30
R5
物理接口:
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.1.6 30
环回接口:
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.1.129 27
3.启动OSPF
R1
[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.0 0.0.0.255
R2
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 196.168.1.96 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 196.168.1.34 0.0.0.0
R3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.35 0.0.0.0
[r3-ospf-1-area-0.0.0.0]quit
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.1.1 0.0.0.0
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
[r4-ospf-1-area-0.0.0.1]network 192.168.1.5 0.0.0.0
R5
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.1.6 0.0.0.0
[r5-ospf-1-area-0.0.0.1]network 192.168.1.128 0.0.0.0
4.认证
R3
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher admin@huawei.com
R4
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher admin@huawei.com
5.DR和BDR
由于配置顺序问题,R1和R2已经分别被选举我为DR、BDR,故不再需要另外去配置。
6.缺省路由
R5
[r5]OSPF 1
[r5-ospf-1]default-route-advertise always