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,全网可达
网段划分
area 0
172.16.000 00011.00000000 24
172.16.0.0 24--骨干链路(P2P骨干)/30
172.16.00000000.000001 00
172.16.0.0 30
172.16.0.4 30
172.16.0.8 30
172.16.1.0 24--骨干链路(MA骨干)/29
172.16.1.00000 000
172.16.1.0 29
172.16.2.0 24
172.16.001 00000.00000000 --19
172.16.32.0 19--区域1
172.16.32.0 24--P2P
172.16.32.0 30
172.16.33.0 24 --MA
172.16.33.0 29
172.16.34.0 24--用户
172.16.35.0 24
172.16.64.0 19--区域2
172.16.64.0 24 P2P
172.16.64.0 30
172.16.65.0 24--MA
172.16.65.0 29
172.16.66.0 24
172.16.67.0 24
172.16.96.0 19--区域3
172.16.96.0 24-P2P
172.16.96.0 30
172.16.97.0 24-MA
172.16.97.0 29
172.16.98.0 24
172.16.99.0 24
172.16.128.0 19--区域4
172.16.128.0 24 -P2P
172.16.128.0 30
172.16.129.0 24-MA
172.16.129.0 29
172.16.130.0 24
172.16.160.0 19--RIP
172.16.160.0 24
配置网段
区域1
R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 172.16.33.1 29
[R1]interface l0
[R1-LoopBack0]ip address 172.16.34.1 24
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1-area-0.0.0.1]network 0.0.0.0 0.0.0.0
[R1-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255
检测邻居关系
优化2
[R1]ospf
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub 做特殊区域
[R1]interface g00/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 10 加快收敛(缩短hello时间)
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ospf a
[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123 保证更新安全(接口认证)
R2
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 172.16.33.2 29
[R2]interface l0
[R2-LoopBack0]ip address 172.16.35.1 24
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255
[R2]ospf
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub 做特殊区域
R3
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.33.3 29
[R3]interface l0
[R3-LoopBack0]ip address 172.16.36.1 24
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 172.16.33.3 0.0.0.0
[R3-ospf-1-area-0.0.0.1]network 172.16.36.1 0.0.0.0
[R3]ospf
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123
优化
[R3]ospf
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0 汇总路由
[R3]ospf
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]stub no-summary 在爱别人中配完全末梢区域
区域0
R3
[R3]interface Serial 4/0/0
[R3-Serial4/0/0]IP address 34.0.0.1 24
[R3]ip route-static 0.0.0.0 0 34.0.0.2 配置缺省 保证私网与公网之间连通性
[R3]interface Tunnel 0/0/0 建立隧道
[R3-Tunnel0/0/0]ip address 172.16.1.1 29
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.0.0.1
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic 开启伪广播使数据能发送至分支
测试可通
[R3-Tunnel0/0/0]ospf network-type p2mp 将网络类型从p2p改为p2mp
更换网络类型后建邻成功
R4
[R4]interface Serial 4/0/0
[R4-Serial4/0/0]ip address 34.0.0.2 24
[ISP]interface s4/0/1
[ISP-Serial4/0/1]ip address 45.0.0.2 24
[ISP]interface s3/0/0
[ISP-Serial3/0/0]ip ad
[ISP-Serial3/0/0]ip address 46.0.0.2 24
[ISP]interface g0/0/0
[ISP-GigabitEthernet0/0/0]ip address 47.0.0.2 24
R5
[R5]interface Serial 4/0/0
[R5-Serial4/0/0]ip address 45.0.0.1 24
[R5]ip route-static 0.0.0.0 0 45.0.0.2
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]ip address 172.16.1.2 29
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source s4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 分支指向中心使自身数据传递
[R5]interface l0
[R5-LoopBack0]ip address 172.16.2.1 24 配置环回
[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.2.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.2 0.0.0.0
[R5]interface t0/0/0
[R5-Tunnel0/0/0]ospf network-type p2mp
R6
[R6]interface Serial 4/0/0
[R6-Serial4/0/0]ip address 46.0.0.1 24
[R6]ip route-static 0.0.0.0 0 46.0.0.2
[R6]interface t0/0/0
[R6-Tunnel0/0/0]ip address 172.16.1.3 29
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source Serial 4/0/0
[R6-Tunnel0/0/0] nhrp network-id 100
[R6-Tunnel0/0/0] nhrp entry 172.16.1.1 34.0.0.1 register
[R6]interface l0
[R6-LoopBack0]ip address 172.16.3.1 24
[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.3.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.1.3 0.0.0.0
[R6]interface t0/0/0
[R6-Tunnel0/0/0]ospf network-type p2mp
R7
[R7]interface g0/0/0
[R7-GigabitEthernet0/0/0]ip address 47.0.0.1 24
[R7]interface l0
[R7-LoopBack0]ip address 100.0.0.1 24
[R7]ip route-static 0.0.0.0 0 47.0.0.2
[R7]interface l0
[R7-LoopBack0]ip address 172.16.4.1 24
[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.4.1 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.1.4 0.0.0.0
[R7]interface t0/0/0
[R7-Tunnel0/0/0]ospf network-type p2mp
区域2
R6
[R6]interface g0/0/0
[R6-GigabitEthernet0/0/0]ip address 172.16.64.1 30
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]network 172.16.64.1 0.0.0.0
[R6]ospf
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0 汇总区域2路由
[R6]ospf
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]nssa 做特殊区域
R11
[R11]interface g0/0/0
[R11-GigabitEthernet0/0/0]ip address 172.16.64.2 30
[R11]interface g0/0/1
[R11-GigabitEthernet0/0/1]ip address 172.16.64.5 30
[R11-LoopBack0]ip address 172.16.66.1 24
[R11]ospf 1 router-id 11.1.1.1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255
[R11]ospf
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]nssa 做特殊区域
R12
[R12]interface g0/0/0
[R12-GigabitEthernet0/0/0]ip address 172.16.64.6 30
[R12]ospf 1 router-id 12.1.1.1
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255
[R12]ospf
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]nssa 做特殊区域
区域3
R7
[R7]interface g0/0/1
[R7-GigabitEthernet0/0/1]ip address 172.16.96.1 30
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.96.1 0.0.0.0
[R7]ospf
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0 汇总路由
[R7]ospf
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary 做特殊区域
R8
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 172.16.96.2 30
[Huawei]interface g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 172.16.96.5 30
[R8]interface l0
[R8-LoopBack0]ip address 172.16.98.1 24
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]network 172.16.69.0 0.0.31.255
[R8]ospf
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa 做特殊区域
R9
[R9]interface g0/0/0
[R9-GigabitEthernet0/0/0]ip address 172.16.96.6 30
[R9]interface g0/0/1
[R9-GigabitEthernet0/0/1]ip address 172.16.128.1 30
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]network 172.16.96.6 0.0.0.0
[R9]ospf
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa 做特殊区域
区域4
R9
[R9]interface l0
[R9-LoopBack0]ip address 172.16.130.1 24
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.31.255
[R9]ospf
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]undo network 172.16.128.0 0.0.31.255 删去ospf-1
[R9]ospf 2 router-id 9.9.9.9 建立一个ospf-2 的协议
[R9-ospf-2]area 0
[R9-ospf-2-area-0.0.0.0]network 172.16.128.0 0.0.31.255
[R9]ospf 1
[R9-ospf-1]import-route ospf 2 进入ospd-1引入ospf-2
[R9]ospf
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0 汇总路由
[R9-ospf-1]default-route-advertise 下发缺省
R10
[R10]interface g0/0/0
[R10-GigabitEthernet0/0/0]ip address 172.16.128.2 30
[R10]interface l0
[R10-LoopBack0]ip address 172.16.131.1 24
[R10]ospf 1 router-id 10.1.1.1
[R10-ospf-1]area 4
[R10-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.31.255
[R10]undo ospf 1
[R10]ospf 2 router-id 10.1.1.1
[R10-ospf-2]area 0
[R10-ospf-2-area-0.0.0.0]network 172.16.128.0 0.0.31.255
RIP
R12
[R12]interface l0
[R12-LoopBack0]ip address 172.16.160.1 24
[R12]interface l1
[R12-LoopBack1]ip address 172.16.161.1 24
[R12]rip
[R12-rip-1]network 172.16.0.0
[R12]ospf
[R12-ospf-1]import-route rip 在ospf中引入rip路由信息
[R12]ospf
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0 汇总路由