首先进行IP地址划分,如下图
?
给每个路由器先配置环回地址
[r1]interface LoopBack 0
[r1-LoopBack0]ip add 192.168.1.1 27
[r1-LoopBack0]q
[r2]interface LoopBack 0
[r2-LoopBack0]ip add 192.168.1.65 27
[r2-LoopBack0]q
[r3]interface LoopBack 0
[r3-LoopBack0]ip add 192.168.1.97 27
[r3-LoopBack0]q
[r4]interface LoopBack 0
[r4-LoopBack0]ip add 4.4.4.4 24
[r4-LoopBack0]q
然后配置端口IP
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.33 27
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.34 27
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.35 27
[r3-GigabitEthernet0/0/0]q
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.129 27
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.130 27
之后在每个路由器接口处进行ospf配置,并且在ABR上进行路由汇总,减少路由条目
[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.31
[r1-ospf-1-area-0.0.0.0]network 192.168.1.33 0.0.0.31
[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.65 0.0.0.31
[r2-ospf-1-area-0.0.0.0]network 192.168.1.34 0.0.0.31
[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.97 0.0.0.31
[r3-ospf-1-area-0.0.0.0]network 192.168.1.35 0.0.0.31
[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.31
[r3-ospf-1-area-0.0.0.1]abr-summary 192.168.1.128 255.255.255.224
[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.31
[r4-ospf-1-area-0.0.0.1]q
由于不能在R4上宣告环回,并且要求全网可达,所以在边界路由器上ospf1中设置缺省路由
[r4-ospf-1]default-route-advertise always
R1-R3中要求R3是DR设备并且无BDR,只需要在R1,R2的接口上将优先级改为0即可
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
配置后如下所示R3为DR设备并且无BDR?
[r3]display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.1.35(GigabitEthernet0/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.33
State: Full Mode:Nbr is Slave Priority: 0
DR: 192.168.1.35 BDR: None MTU: 0
Dead timer due in 33 sec
Retrans timer interval: 5
Neighbor is up for 00:00:57
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.34
State: Full Mode:Nbr is Slave Priority: 0
DR: 192.168.1.35 BDR: None MTU: 0
Dead timer due in 40 sec
Retrans timer interval: 6
Neighbor is up for 00:00:39
Authentication Sequence: [ 0 ]
为了保障更新安全需要在每个接口处配置ospf认证,邻居间的密码,模式,编号必须都一样,配置如下
[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 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0
[r3]ip route-static 192.168.1.96 27 NULL 0
[r4]ip route-static 192.168.1.128 27 NULL 0
此时这个实验完美结束
|