OSPF综合实验
一、实验拓扑
二、实验要求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;
三、实验思路
(1)划分IP地址,且配置IP地址
172.16.0.0/16按OSPF区域划分,可划分为6个网段
Area 0:
172.16.0000 0000.0/19 ---- 172.16.0.0/19
Area 0上除公网外还有4个环回地址,1个隧道,还有MA和P2P,则大网段继续划分为7个小网段,掩码不能太大或者太小,一般掩码选用24
172.16.0000 0000.0/24 ---- 172.16.0.0/24 ---- P2P
172.16.0000 0001.0/24 ---- 172.16.0.1/24 ---- MA
172.16.0000 0010.0/24 ---- 172.16.0.2/24 ---- R4(环回)
172.16.0000 0011.0/24 ---- 172.16.0.3/24 ---- R5(环回)
172.16.0000 0100.0/24 ---- 172.16.0.4/24 ---- R6(环回)
172.16.0000 0101.0/24 ---- 172.16.0.5/24 ---- R7(环回)
172.16.0000 0111.0/24 ---- 172.16.0.6/24 ---- 隧道
Area 1:
172.16.0010 0000.0/19 ---- 172.16.32.0/19
Area 1上有3个环回地址,还有MA和P2P,则大网段继续划分为5个小网段,掩码同理
172.16.0010 0000.0/24 ---- 172.16.32.0/24 ---- P2P
172.16.0010 0001.0/24 ---- 172.16.33.0/24 ---- MA
172.16.0010 0010.0/24 ---- 172.16.34.0/24 ---- R1(环回)
172.16.0010 0011.0/24 ---- 172.16.35.0/24 ---- R2(环回)
172.16.0010 0100.0/24 ---- 172.16.36.0/24 ---- R3
Area 2:
172.16.0100 0000.0/19 ---- 172.16.64.0/19
Area 2上有1个环回地址,还有MA和P2P,则大网段继续划分为3个小网段,掩码同理
172.16.0100 0000.0/24 ---- 172.16.64.0/24 ---- P2P
172.16.0100 0001.0/24 ---- 172.16.65.0/24 ---- MA
MA应再划分为2个小网段
172.16.0100 0001.0000 0000/30 ---- 172.16.65.0/30
172.16.0100 0001.0000 0100/30 ---- 172.16.65.4/30
172.16.0100 0010.0/24 ---- 172.16.66.0/24 ---- R11(环回)
Area 3:
172.16.0110 0000.0/19 ---- 172.16.96.0/19
Area 3上有1个环回地址,还有MA和P2P,则大网段继续划分为3个小网段,掩码同理
172.16.0110 0000.0/24 ---- 172.16.96.0/24 ---- P2P
172.16.0110 0001.0/24 ---- 172.16.97.0/24 ---- MA
MA应再划分为2个小网段
172.16.0110 0001.0000 0000/30 ---- 172.16.97.0/30
172.16.0110 0001.0000 0100/30 ---- 172.16.97.4/30
172.16.0110 0010.0/24 ---- 172.16.98.0/24 ---- R8(环回)
Area 4:
172.16.1000 0000.0/19 ---- 172.16.128.0/19
Area 3上有2个环回地址,还有MA和P2P,则大网段继续划分为4个小网段,掩码同理
172.16.1000 0000.0/24 ---- 172.16.128.0/24 ---- P2P
172.16.1000 0001.0/24 ---- 172.16.129.0/24 ---- MA
MA应再划分为1个小网段
172.16.1000 0001.0000 0000/30 ---- 172.16.129.0/30
172.16.1000 0010.0/24 ---- 172.16.130.0/24 ---- R9(环回)
172.16.1000 0011.0/24 ---- 172.16.131.0/24 ---- R10(环回)
RIP:
172.16.1010 0000.0/19 ---- 172.16.160.0/19
RIP上有2个环回地址,则大网段继续划分为2个小网段,掩码同理
172.16.1010 0000.0/24 ---- 172.16.160.0/24
172.16.1010 0000.0/24 ---- 172.16.160.0/24 ---- 环回L0
172.16.1010 0001.0/24 ---- 172.16.161.0/24 ---- 环回L1
多:
172.16.1100 0000.0/19 ---- 172.16.192.0/19
172.16.1110 0000.0/19 ---- 172.16.224.0/19
(2)area0是以R3为总部的公网,其他为私网;配置OSPF,实现各个区域私网通;RIP是域外,需要双向引入,使域内、域外互相访问;area4,区域划分不规则,使用多进程双向重发布解决,双向引入;配置静态缺省,实现公网通
(3)配置MGRE,创建隧道,实现私网互通
(4)配置nat(eassy IP),实现公网、私网互通
(5)聚合配置,减少LSA的更新量,R3、R6、R7为ABR聚合;R9、R12为ASBR聚合
(6)加快收敛,修改hello时间
(7)保障更新安全,配置认证(区域认证、接口认证)
四、实验步骤
1、配置IP地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 172.16.34.1 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.33.2 24
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip add 172.16.35.2 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 24
[R3-GigabitEthernet0/0/0]int s4/0/0
[R3-Serial4/0/0]ip add 34.0.0.3 24
[R3-Serial4/0/0]int l0
[R3-LoopBack0]ip add 172.16.36.3 24
[R4]int s4/0/0
[R4-Serial4/0/0]ip add 34.0.0.4 24
[R4-Serial4/0/0]int s4/0/1
[R4-Serial4/0/1]ip add 45.0.0.4 24
[R4-Serial4/0/1]int s3/0/0
[R4-Serial3/0/0]ip add 46.0.0.4 24
[R4-Serial3/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip add 172.16.2.4 24
[R5]int s4/0/0
[R5-Serial4/0/0]ip add 45.0.0.5 24
[R5-Serial4/0/0]int l0
[R5-LoopBack0]ip add 172.16.3.5 24
[R6]int s4/0/0
[R6-Serial4/0/0]ip add 46.0.0.6 24
[R6-Serial4/0/0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 30
[R6-GigabitEthernet0/0/0]int l0
[R6-LoopBack0]ip add 172.16.4.6 24
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[R7-GigabitEthernet0/0/0]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.97.1 30
[R7-GigabitEthernet0/0/1]int l0
[R7-LoopBack0]ip add 172.16.5.7 24
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.97.2 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.97.5 30
[R8-GigabitEthernet0/0/1]int l0
[R8-LoopBack0]ip add 172.16.98.8 24
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.97.6 30
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.129.1 30
[R9-GigabitEthernet0/0/1]int l0
[R9-LoopBack0]ip add 172.16.130.9 24
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 30
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip add 172.16.131.10 24
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.65.2 30
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.65.5 30
[R11-GigabitEthernet0/0/1]int l0
[R11-LoopBack0]ip add 172.16.66.11 24
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[R12-GigabitEthernet0/0/0]int l0
[R12-LoopBack0]ip add 172.16.160.12 24
[R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.161.12 24
2、配置OSPF,实现私网通
Area0:
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.3.0 0.0.0.255
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]ne 172.16.4.0 0.0.0.255
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.5.0 0.0.0.255
Area1:
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]ne 172.16.33.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]ne 172.16.34.0 0.0.0.255
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]net 172.16.33.2 0.0.0.0
[R2-ospf-1-area-0.0.0.1]net 172.16.35.0 0.0.0.255
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]ne 172.16.33.3 0.0.0.0
[R3-ospf-1-area-0.0.0.1]ne 172.16.36.0 0.0.0.255
Area2:
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]ne 172.16.65.1 0.0.0.0
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]ne 172.16.65.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]ne 172.16.65.5 0.0.0.0
[R11-ospf-1-area-0.0.0.2]ne 172.16.66.0 0.0.0.255
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]ne 172.16.65.6 0.0.0.0
RIP:
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo su
[R12-rip-1]undo summary
[R12-rip-1]ne 172.16.0.0
引入:
[R12]ospf 1
[R12-ospf-1]import-route rip
Area 3:
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]ne 172.16.97.1 0.0.0.0
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]ne 172.16.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]ne 172.16.97.5 0.0.0.0
[R8-ospf-1-area-0.0.0.3]ne 172.16.98.0 0.0.0.255
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]ne 172.16.97.6 0.0.0.0
Area 4:
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]ne 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]ne 172.16.130.0 0.0.0.255
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]ne 172.16.129.2 0.0.0.0
[R10-ospf-2-area-0.0.0.4]ne 172.16.131.0 0.0.0.255
双向引入:
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9]ospf 2
[R9-ospf-2]import-route ospf 1
3、配置静态缺省,实现公网通
[R3]ip route-static 0.0.0.0 0 34.0.0.4
[R5]ip route-static 0.0.0.0 0 45.0.0.4
[R6]ip route-static 0.0.0.0 0 46.0.0.4
[R7]ip route-static 0.0.0.0 0 47.0.0.4
测试:
4、配置MGRE,实现私网互通
[R3]int t0/0/0
[R3-Tunnel0/0/0]ip add 172.16.6.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source Serial 4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R5]int t0/0/0
[R5-Tunnel0/0/0]ip add 172.16.6.5 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
[R6]int t0/0/0
[R6-Tunnel0/0/0]ip add 172.16.6.6 24
[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.6.3 34.0.0.3 register
[R7]int t0/0/0
[R7-Tunnel0/0/0]ip add 172.16.6.7 24
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
查看总部学习情况:
5、在ospf中宣告隧道地址
[R3]ospf 1
[R3-ospf-1]dis th
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R5]ospf 1
[R5-ospf-1]dis th
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R6]ospf 1
[R6-ospf-1]dis th
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R7]ospf 1
[R7-ospf-1]dis th
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
6、将P2P类型改为broadcast
[R1]int t0/0/0
[R1-Tunnel0/0/0]ospf network-type broadcast
[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
7、取消分部的DB选举权
[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf dr-priority 0
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf dr-priority 0
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf dr-priority 0
测试是否全网通:
8、配置nat(eassy IP)实现全网通
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3]int s4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R5]int s4/0/0
[R5-Serial4/0/0]nat outbound 2000
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6]int s4/0/0
[R6-Serial4/0/0]nat outbound 2000
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
此时并未全网通,需要下发默认缺省,或者配置特殊区域,自动下发缺省
9、聚合
ARB聚合:
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
ASBR聚合:
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
10、配置特殊区域
area 0 是骨干区域,area 4 是不规则区域,不能设置为特殊区域
area 1 设置为totally stub区域;area 2 area3设置为totally nass区域
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]stub no-summary
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]stub no-summary
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa no-summary
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa no-summary
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa no-summary
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa no-summary
测试所有设备均可访问R4的环回:
但R10不能ping通:
其他区域都只有缺省路由,没有明细路由,所以R10学不到
方法:在R9给R10下发一条缺省
[R9]ospf 2
[R9-ospf-2]default-route-advertise
11、加快收敛,修改hello时间
area0:
[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf timer hello 5
[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf timer hello 5
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf timer hello 5
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf timer hello 5
area 1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 5
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ospf timer hello 5
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ospf timer hello 5
area 2:
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ospf timer hello 5
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ospf timer hello 5
[R11]int g0/0/1
[R11-GigabitEthernet0/0/1]ospf timer hello 5
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ospf timer hello 5
area 3:
[R7]int g0/0/1
[R7-GigabitEthernet0/0/1]ospf timer hello 5
[R8]int g0/0/1
[R8-GigabitEthernet0/0/1]ospf timer hello 5
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ospf timer hello 5
area 4:
[R9]int g0/0/1
[R9-GigabitEthernet0/0/1]ospf timer hello 5
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ospf timer hello 5
12、区域认证
area0:
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
[R5]ospf 1
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
[R7]ospf 1
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
area 1:
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
area 2:
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 12345
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 12345
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 12345
area 3:
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 12345
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 12345
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 12345
area 4:
[R9]ospf 2
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 12345
[R10]ospf 2
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 12345
原文地址:https://blog.csdn.net/m0_74256660/article/details/137774056
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!