首先,确定实验要求
第一步:搭建拓扑建构,并合理划分IP地址
第二步:给路由器配置端口及环回接口IP地址
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 27
[R1-GigabitEthernet0/0/0]q
[R1]interface LoopBack 0
[R1-LoopBack0]ip add 192.168.1.65 26
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.1.2 27
[R2-GigabitEthernet0/0/0]q
[R2]interface LoopBack 0
[R2-LoopBack0]ip add 192.168.1.129 26
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.1.3 27
[R3-GigabitEthernet0/0/0]q
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.1.33 27
[R3-GigabitEthernet0/0/1]q
[R3]interface LoopBack 0
[R3-LoopBack0]ip add 192.168.1.193 26
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.1.34 27
[R4-GigabitEthernet0/0/0]q
[R4]interface LoopBack 0
[R4-LoopBack0]ip add 4.4.4.1 24
第二步:进行OSPF的配置 ,作用:
宣告:1、激活--被激活接口可以收发ospf信息 2、接口信息被告知给邻接
3、区域划分
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.64 0.0.0.63
[R1-ospf-1-area-0.0.0.0]network 192.168.1.1 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.128 0.0.0.63
[R2-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0
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.192 0.0.0.63
[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]q
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 192.168.1.33 0.0.0.0
[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.34 0.0.0.0
第三步:修改路由器参选接口的优先级(R1和R2改为0,及R3是DR)
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ospf dr-priority 0
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ospf dr-priority 0
第四步:给路由器R4配置缺省路由(由于条件限制,R4的环回不能宣告)
[R4]ospf 1
[R4-ospf-1]default-route-advertise always
此时,全网可互联了
第五步:在路由器R3上进行路由汇总(减少路由条目数量)
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.0
[R3-ospf-1-area-0.0.0.0]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 192.168.1.32 255.255.255.224
第六步:进行OSPF认证,(保障更新安全)
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 666666
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 666666
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 666666
[R3-GigabitEthernet0/0/0]q
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 666666
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 666666
第七步:配置空接口(防止发生环路)
[R1]ip route-static 192.168.1.64 26 NULL 0
[R2]ip route-static 192.168.1.128 26 NULL 0
[R3]ip route-static 192.168.1.192 26 NULL 0
此时,实验就完成了