实验要求:
1. R4为ISP,其上只能配置IP地址;R4与其他所有直连设备间均使用公有IP
2.R3-R5/6/7为MGRE环境,R3为中心站点;
3.整个OSPF环境IP基于172.16.0.0/16划分;
4.所有设备均可访问R4的环回;
5.减少LSA的更新量,加快收敛,保障更新安全;
6.全网可达
实验拓扑图:
一、ip与环回配置:
r1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add
[r1-GigabitEthernet0/0/0]ip address 172.16.16.1 29
Jul 14 2024 21:22:11-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]inter
[r1-GigabitEthernet0/0/0]inter l 0
[r1-LoopBack0]ip add
[r1-LoopBack0]ip address 172.16.17.1 24
r2:
[r2]interface g
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip ad
[r2-GigabitEthernet0/0/0]ip address 172.16.16.1 29
[r2-GigabitEthernet0/0/0]inter
[r2-GigabitEthernet0/0/0]interface l 0
[r2-LoopBack0]ip address 172.16.168.1 24
r3:
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 172.16.16.3 29
[r3-GigabitEthernet0/0/0]interface l 0
[r3-LoopBack0]ip address 172.16.19.1 24
[r3-LoopBack0]int s4/0/0
[r3-Serial4/0/0]ip add
[r3-Serial4/0/0]ip address 34.0.0.3 24
r4:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add
[r4-GigabitEthernet0/0/0]ip address 47.0.0.4 24
Jul 14 2024 21:31:58-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]interface s
[r4-GigabitEthernet0/0/0]interface s4/0/0
[r4-Serial4/0/0]ip ad
[r4-Serial4/0/0]ip address 34.0.0.4 24
[r4-Serial4/0/0]
Jul 14 2024 21:32:32-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[r4-Serial4/0/0]int
[r4-Serial4/0/0]interface s4/0/1
[r4-Serial4/0/1]ip add
[r4-Serial4/0/1]ip address 45.0.0.4 24
[r4-Serial4/0/1]interface s3/0/0
[r4-Serial3/0/0]ip add
[r4-Serial3/0/0]ip address 46.0.0.4 24
[r4-Serial3/0/0]int l 0
[r4-LoopBack0]ip add
[r4-LoopBack0]ip address 4.4.4.4 32
r5:
[r5]sys
[r5]sysname r5
[r5]interface se
[r5]interface Serial 4/0/0
[r5-Serial4/0/0]ip add
[r5-Serial4/0/0]ip address 45.0.0.5 24
[r5-Serial4/0/0]
Jul 14 2024 21:35:31-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[r5-Serial4/0/0]
Jul 14 2024 21:35:31-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r5-Serial4/0/0]int l 0
[r5-LoopBack0]ip add
[r5-LoopBack0]ip address 172.16.1.1 24
r6:
[r6]interface se
[r6]interface Serial 4/0/0
[r6-Serial4/0/0]ip add
[r6-Serial4/0/0]ip address 46.0.0.6 24
[r6-Serial4/0/0]
Jul 14 2024 21:36:45-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[r6-Serial4/0/0]
Jul 14 2024 21:36:45-08:00 r6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r6-Serial4/0/0]int
[r6-Serial4/0/0]interface g0/0/0
[r6-GigabitEthernet0/0/0]ip add
[r6-GigabitEthernet0/0/0]ip address 172.16.33.1 30
Jul 14 2024 21:37:06-08:00 r6 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r6-GigabitEthernet0/0/0]int l 0
[r6-LoopBack0]ip add
[r6-LoopBack0]ip address 172.16.2.1 24
r7:
[r7]interface GigabitEthernet 0/0/0
[r7-GigabitEthernet0/0/0]ip add
[r7-GigabitEthernet0/0/0]ip address 47.0.0.7 24
Jul 14 2024 21:38:16-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r7-GigabitEthernet0/0/0]
Jul 14 2024 21:38:16-08:00 r7 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r7-GigabitEthernet0/0/0]int l 0
[r7-LoopBack0]ip add
[r7-LoopBack0]ip address 172.16.3.1 24
[r7-LoopBack0]int
[r7-LoopBack0]interface g
[r7-LoopBack0]interface g0/0/1
[r7-GigabitEthernet0/0/1]ip add
[r7-GigabitEthernet0/0/1]ip address 172.16.49.1 30
r8:
[r8]interface GigabitEthernet 0/0/0
[r8-GigabitEthernet0/0/0]ip add
[r8-GigabitEthernet0/0/0]ip address 172.16.49.2 30
Jul 14 2024 21:40:22-08:00 r8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r8-GigabitEthernet0/0/0]int g
[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ip add
[r8-GigabitEthernet0/0/1]ip address 172.16.49.5 30
[r8-GigabitEthernet0/0/1]
Jul 14 2024 21:40:49-08:00 r8 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r8-GigabitEthernet0/0/1]int l 0
[r8-LoopBack0]ip add
[r8-LoopBack0]ip address 172.16.48.1 24
r9:
[r9]interface GigabitEthernet 0/0/0
[r9-GigabitEthernet0/0/0]ip add
[r9-GigabitEthernet0/0/0]ip address 172.16.49.6 30
Jul 14 2024 21:42:00-08:00 r9 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r9-GigabitEthernet0/0/0]int l 0
[r9-LoopBack0]ip add
[r9-LoopBack0]ip address 172.16.64.1 24
[r9-LoopBack0]int g0/0/1
[r9-GigabitEthernet0/0/1]ip add
[r9-GigabitEthernet0/0/1]ip address 172.16.66.1 30
r10:
[r10]interface GigabitEthernet 0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.66.2 30
Jul 14 2024 23:51:00-08:00 r10 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r10-GigabitEthernet0/0/0]int l 0
[r10-LoopBack0]ip add
[r10-LoopBack0]ip address 172.16.65.1 24
r11:
[r11]interface GigabitEthernet 0/0/0
[r11-GigabitEthernet0/0/0]ip add
[r11-GigabitEthernet0/0/0]ip address 172.16.33.2 30
Jul 14 2024 21:47:02-08:00 r11 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r11-GigabitEthernet0/0/0]interface g0/0/1
[r11-GigabitEthernet0/0/1]ip add
[r11-GigabitEthernet0/0/1]ip address 172.16.33.5 30
Jul 14 2024 21:47:23-08:00 r11 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r11-GigabitEthernet0/0/1]int l 0
[r11-LoopBack0]ip add
[r11-LoopBack0]ip address 172.16.32.1 24
r12:
[r12]interface GigabitEthernet 0/0/0
[r12-GigabitEthernet0/0/0]ip add
[r12-GigabitEthernet0/0/0]ip address 172.16.33.6 30
Jul 14 2024 21:48:23-08:00 r12 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r12-GigabitEthernet0/0/0]int l 0
[r12-LoopBack0]ip add
[r12-LoopBack0]ip address 172.16.128.1 18
[r12-LoopBack0]int l 1
[r12-LoopBack1]ip add
[r12-LoopBack1]ip address 172.16.192.1 18
二、搭建MGRE环境
r3:
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add
[r3-Tunnel0/0/0]ip address 172.16.0.1 24
[r3-Tunnel0/0/0]tu
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 34.0.0.3
[r3-Tunnel0/0/0]nhrp entry multicast dy
[r3-Tunnel0/0/0]q
[r3]ip route-static 0.0.0.0 0 34.0.0.4
r5:
[r5]int t0/0/0
[r5-Tunnel0/0/0]ip add 172.16.0.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source Serial 4/0/0
[r5-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register
[r5]ip route-static 0.0.0.0 0 45.0.0.4
r6:
[r6]int t0/0/0
[r6-Tunnel0/0/0]ip add 172.16.0.3 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source Serial 4/0/0
[r6-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register
[r6]ip route-static 0.0.0.0 0 46.0.0.4
r7:
[r7]int t0/0/0
[r7-Tunnel0/0/0]ip add 172.16.0.4 24
[r7-Tunnel0/0/0]tunnel-protocol gre p2mp
[r7-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r7-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register
[r7]ip route-static 0.0.0.0 0 47.0.0.4
OSPF(area0):
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]int t 0/0/0
[r3-Tunnel0/0/0]ospf network-type p2mp 修改为p2mp类型
[r3-Tunnel0/0/0]ospf timer hello 1 减少Hello时间与死亡时间
[r6-LoopBack0]ospf network-type broadcast 将环回类型(主机)改为broadcast
r5:
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[r5-ospf-1-area-0.0.0.0]interface t 0/0/0
[r5-Tunnel0/0/0]ospf network-type p2mp 修改为p2mp类型
[r5-Tunnel0/0/0]ospf timer hello 1 减少Hello时间与死亡时间
r6:
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 172.16.0.3 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0
[r6-ospf-1-area-0.0.0.0]int t 0/0/0
[r6-Tunnel0/0/0]ospf network-type p2mp 修改为p2mp类型
[r6-Tunnel0/0/0]ospf timer hello 1 减少Hello时间与死亡时间
r7:
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.15.255.255
[r7-ospf-1-area-0.0.0.0]int t0/0/0
[r7-Tunnel0/0/0]ospf network-type p2mp
[r7-Tunnel0/0/0]ospf timer hello 1
三、测试:
四、ospf(area 1)
r1:
r2:
r3:
r4:
五、OSPF、rip(area2)
r6:
r11:
r12:
六、OSPF(area3)
r7:
r8:
r9:
七、OSPF(area4)
r9:
r10:
八、OSPF路由汇总
r3:
r6:
r7:
r9:
r12:
九、area 1->Totally Stub Area
r1:
r2:
r3:
r4:
十、area 2->Totally NSSA
r6:
r11:
r12:
十一、area 3->Totally NSSA
r7:
r8:
r9:
十二、防环优化
r3:
r6: