实验要求:
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(如图所示)
2.搞通内网和外网
3.配置隧道,MGRE环境
4.ospf宣告隧道网址
5..配置easy-ip
6..减少LSA更新量,配置特殊区域和路由汇总
7.加快收敛(修改hello时间)
8.保证安全(认证)
1.配置IP
R1:
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 172.16.33.1 24
[R1-GigabitEthernet0/0/1]int l0
[R1-LoopBack0]ip add 172.16.34.1 24
[R1]dis ip inter b
R2:
[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:
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 24
[R3-GigabitEthernet0/0/0]int l0
[R3-LoopBack0]ip add 172.16.36.3 24
[R3-LoopBack0]int s4/0/0
[R3-Serial4/0/0]ip add 34.0.0.3 24
R4:
[R4]int s4/0/0
[R4-Serial4/0/0]ip add 34.0.0.4 24
[R4-Serial4/0/0]int s 4/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]int l0
[R4-LoopBack0]ip add 172.16.2.4 24
R5:
[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:
[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
[R6-LoopBack0]
R7:
[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:
[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-LoopBack0]ip add 172.16.98.8 24
R9:
[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:
[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:
[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:
R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[R12-LoopBack0]ip add 172.16.160.1 24
[R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.161.1 24
2.搞通内外网:
内网:划分区域,配置OSPF,使各个区域内能够通信:
Area 1:
R1:
[R1]ospf 1 router-id 1.1.1.1
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]net 172.16.34.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
R2:
[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.35.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
R3:
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]net 172.16.36.0 0.0.0.255
测试:
Area 0:
R5:
[R5]ospf 1 rou
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]net 172.16.3.0 0.0.0.255
R6:
[R6]ospf 1 rou
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]net 172.16.4.0 0.0.0.255
R7:
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]net 172.16.5.0 0.0.0.255
Area 2:
R6:
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]net 172.16.65.0 0.0.0.3
R11:
[R11]ospf router-id 11.11.11.11
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]net 172.16.65.0 0.0.0.3
[R11-ospf-1-area-0.0.0.2]net 172.16.65.4 0.0.0.3
[R11-ospf-1-area-0.0.0.2]net 172.16.66.0 0.0.0.255
R12:
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]net 172.16.65.4 0.0.0.3
测试:
RIP区域:
R12:
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo su
[R12-rip-1]undo summary
[R12-rip-1]net 172.16.0.0
将RIP引入到OSPF,跨区域学习路由
[R12-ospf-1]import-route rip
测试:
Area 3
R7:
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]net 172.16.97.0 0.0.0.3
R8:
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]net 172.16.97.0 0.0.0.3
[R8-ospf-1-area-0.0.0.3]net 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]net 172.16.97.4 0.0.0.3
测试:
Area4
为了区域4能够和其他区域进行路由学习,可以采用虚链路和多进程双向重发布,这里我们采用后者,创建一个ospf进程2
R9:
[R9]ospf 2 router-id 9.9.9.9
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]net 172.16.129.0 0.0.0.3
[R9-ospf-2-area-0.0.0.4]net 172.16.130.0 0.0.0.255
R10:
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]net 172.16.129.0 0.0.0.3
[R10-ospf-2-area-0.0.0.4]net 172.16.131.0 0.0.0.255
为了让R10学到上面的路由,因此我们要路由引入:
[R9-ospf-1]import-route ospf 2
[R9-ospf-2]import-route ospf 1
外网:配置静态路由:
[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
测试:
3.创建隧道
中心站点:R3:
[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 s4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
分支站点:
R5:
[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 s4/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:
[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 s4/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:
[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 g0/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
查看:
4.ospf宣告隧道地址,并修改网络接口类型与分支站点上配置放弃DR/BDR选举使各个区域通过隧道能够相互学到路由
R3:
[R3]ospf 1
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
[R3-Tunnel0/0/0]ospf network-type broadcast
[R5]ospf 1
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
[R5-Tunnel0/0/0]ospf network-type broadcast
[R5-Tunnel0/0/0]ospf dr-priority 0
[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr
[R6-Tunnel0/0/0]ospf dr-priority 0
[R7]ospf 1
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
查看中间路由器上的邻居关系:
R3:
R6:
R7:
R8:
R9:
测试:
R10 ping 区域1(R1)环回
R10 ping 区域0 (R5环回)
R10 ping 区域2(R11环回)
R10 ping RIP区域(R12环回)
R10 ping 区域3(R8环回)
5.配置easy-ip,使各设备都能访问R4环回:
[R3]acl 2000
[R3-acl-basic-2000]rule per
[R3-acl-basic-2000]rule permit sou
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[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-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-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-GigabitEthernet0/0/0]nat outbound 2000
在此还不能够实现,因为没有在公网口上下发一默认缺省路由,后面要实现减少LSA的更新量,会配置特殊区域和路由汇总,会自动下发默认路由
6.减少LSA更新量,配置特殊区域和路由汇总
a.路由汇总(在R3,R5,R7上配置ABR汇总,在R12,R9上配置ASBR汇总)
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1] abr-
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]q
[R9-ospf-1]asbr-
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R12]ospf 1
[R12-ospf-1]asbr-
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
检测查看:
b.特殊区域
区域1(totally stub)
[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
[R2-ospf-1-area-0.0.0.1]stub no-summary
[R3-ospf-1-area-0.0.0.1]stub no
[R3-ospf-1-area-0.0.0.1]stub no-summary
区域2,区域3(totally nssa)
[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-su
[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-su
[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-su
[R9-ospf-1-area-0.0.0.3]nssa no-summary
如图所示:配完特殊区域后,各个区域的路由器都被自动下发了一条缺省路由,因此现在各设备能够去访问R4的环回了
而R10ping不通R4环回,解决方法:在R9的进程2上去配置
[R9-ospf-2]default-route-advertise
测试:
7.加快收敛(修改hello时间)
[R1-GigabitEthernet0/0/0]ospf timer hello 5
[R2-GigabitEthernet0/0/0]ospf timer hello 5
[R3-GigabitEthernet0/0/0]ospf timer hello 5
[R3-Tunnel0/0/0]ospf timer hello 5
[R5-Tunnel0/0/0]ospf timer hello 5
[R6-GigabitEthernet0/0/0]ospf timer hello 5
[R6-Tunnel0/0/0]ospf timer hello 5
[R7-GigabitEthernet0/0/1]ospf timer hello 5
[R7-Tunnel0/0/0]ospf timer hello 5
[R8-GigabitEthernet0/0/1]ospf timer hello 5
[R8-GigabitEthernet0/0/0]ospf timer hello 5
[R9-GigabitEthernet0/0/0]ospf timer hello 5
[R9-GigabitEthernet0/0/1]ospf timer hello 5
[R10-GigabitEthernet0/0/0]ospf timer hello 5
[R11-GigabitEthernet0/0/0]ospf timer hello 5
[R11-GigabitEthernet0/0/1]ospf timer hello 5
[R12-GigabitEthernet0/0/0]ospf timer hello 5
8.保证安全(认证)
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123456
[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123456
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456