一、实验拓扑
二、实验划分
按6个区域划分大类area 0:172.16.0.0/19;area 1:172.16.32.0/19;area 2:172.16.64.0/19;area 3:172.16.96.0/19;area 4:172.16.128.0/19;area 5:172.16.160.0/19;RIP:172.16.192.0/19。每个区域的详细划分见图示。
三、实验需求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
四、实验结果
1.配IP
R1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]undo ip ad 172.16.33.1 24
[R1]int LoopBack 0
[R1-LoopBack0]ip ad 172.16.34.1 24
R2:
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad 172.16.33.2 24
[R2]int LoopBack 0
[R2-LoopBack0]ip ad 172.16.35.2 24
R3:
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.33.3 24
[R3]int LoopBack 0
[R3-LoopBack0]ip ad 172.16.36.3 24
[R3]int Serial 4/0/0
[R3-Serial4/0/0]ip ad 34.0.0.3 24
R4:
[R4]int s4/0/0
[R4-Serial4/0/0]ip ad 34.0.0.4 24
[R4-Serial4/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad 47.0.0.4 24
[R4-GigabitEthernet0/0/0]int s3/0/0
[R4-Serial3/0/0]ip ad 46.0.0.4 24
[R4-Serial3/0/0]int s4/0/1
[R4-Serial4/0/1]ip a 45.0.0.4 24
[R4]int LoopBack 0
[R4-LoopBack0]ip ad 172.16.2.4 24
R5:
[R5]int s4/0/0
[R5-Serial4/0/0]ip ad 45.0.0.5 24
[R5]int loo 0
[R5-LoopBack0]ip ad 172.16.3.5 24
R6:
[R6]int s4/0/0
[R6-Serial4/0/0]ip ad 46.0.0.6 24
[R6-Serial4/0/0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip ad 172.16.65.1 30
[R6]int loo 0
[R6-LoopBack0]ip ad 172.16.4.6 24
R7:
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip ad 47.0.0.7 24
[R7-GigabitEthernet0/0/0]int g0/0/1
[R7]int LoopBack 0
[R7-LoopBack0]ip ad 172.16.5.7 24
[R7]int g0/0/1
[R7-GigabitEthernet0/0/1]ip ad 172.16.97.1 30
R8:
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip ad 172.16.97.5 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip ad 172.16.97.6 30
[R8]int loo 0
[R8-LoopBack0]ip ad 172.16.98.8 24
R9:
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip ad 172.16.97.7 30
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip ad 172.16.120.1 30
[R9]int loo 0
[R9-LoopBack0]ip ad 172.16.130.9 24
R10:
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip ad 172.16.129.2 30
[R10]int loo 0
[R10-LoopBack0]ip ad 172.16.131.10 24
R11:
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip ad 172.16.65.1 30
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip ad 172.16.65.5 30
[R11]int LoopBack 0
[R11-LoopBack0]ip ad 172.16.66.11 24
R12:
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip ad 172.16.65.6 30
[R12]int loo 0
[R12-LoopBack0]ip ad 172.16.160.12 24
[R12-LoopBack0]int loo 1
[R12-LoopBack1]ip ad 172.16.161.12 24
2.公网通、私网通
公网通:
配缺省
R3:
[R3]ip route-static 0.0.0.0 0 34.0.0.4
R5:
[R5]ip route-static 0.0.0.0 0 45.0.0.4
R6:
[R6]ip route-static 0.0.0.0 0 46.0.0.4
R7:
[R7]ip route-static 0.0.0.0 0 47.0.0.4
私网通
配置ospf-area1:
R1:
[R1]ospf 1 rou
[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.255
[R1-ospf-1-area-0.0.0.1]ne 172.16.34.1 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]ne 172.16.33.2 0.0.0.255
[R2-ospf-1-area-0.0.0.1]ne 172.16.35.2 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]ne 172.16.33.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]ne 172.16.36.3 0.0.0.255
宣告area 0的用户网段:
R5:
[R5]ospf 1 r
[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:
[R6]ospf 1 r
[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:
[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
配置ospf-area2:
R6:
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]ne 172.16.65.1 0.0.0.0
R11:
[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:
[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
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo summary
[R12-rip-1]ne 172.16.0.0
area2与rip 1的路由协议不同,做路由引入
R12:
[R12]ospf 1
[R12-ospf-1]im
[R12-ospf-1]import-route rip
配置ospf-area3:
R7:
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]ne 172.16.97.1 0.0.0.0
R8:
[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:
[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
配置ospf-area4(不规则区域):
多进程
R9:
[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:
[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
查看建立邻居情况:
实现了各个私网内部通
MGRE实现各个私网之间通,
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip ad 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
//宣告隧道口
[R3]ospf 1
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
//更改协议类型
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
R5:
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip ad 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
[R5]ospf 1
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
//解决DR/BR选举混乱,取消选举
[R5-Tunnel0/0/0]ospf dr-priority 0
R6:
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ip ad 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
[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr-priority 0
R7:
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ip ad 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
[R7]ospf 1
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
R9:
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9-ospf-1]q
[R9]ospf 2
[R9-ospf-2]import-route ospf 1
为了使area 4能够到达其他区域,同时为了减少LSA更新量,可以在R10上手工配置一条指向R9的缺省,也可以在R9上下发一条5类缺省:
default-route-advertise
OSPF路由汇总
R3:
[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:
[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:
[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
R9:
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
R12:
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
为area1、area2、area3做特殊区域
area1的完全末梢区域
R1:
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]stub
R2:
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]stub
R3:
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
area2的完全的非完全末梢区域
R6:
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
R11:
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa
R12:
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa
area3的完全的非完全末梢区域
R7:
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
R8:
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa
R9:
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa
配置NULL 0接口防环
R3:
[R3]ip route-static 172.16.32.0 19 NULL 0
R6:
[R6]ip route-static 172.16.64.0 19 NULL 0
R7:
[R7]ip route-static 172.16.96.0 19 NULL 0
R9:
[R9]ip route-static 172.16.128.0 19 NULL 0
R12:
[R12]ip route-static 172.16.160.0 19 NULL 0
配置NAT
R3:
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000
R6:
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]int Serial 4/0/0
[R6-Serial4/0/0]nat outbound 2000
R7:
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q
[R7]int GigabitEthernet 0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
加快收敛,为MGRE环境减少计时器时间
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf timer hello 10
R5:
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ospf timer hello 10
R6:
[R6]int t 0/0/0
[R6-Tunnel0/0/0]ospf timer hello 10
R7:
[R7]int t 0/0/0
[R7-Tunnel0/0/0]ospf timer hello 10
将所有直连的MA的接口网络类型改为p2p
R6:
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ospf network-type p2p
R7:
[R7]int g0/0/1
[R7-GigabitEthernet0/0/1]ospf network-type p2p
R8:
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ospf network-type p2p
[R8]int g0/0/1
[R8-GigabitEthernet0/0/1]ospf network-type p2p
R9:
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ospf network-type p2p
[R9]int g0/0/1
[R9-GigabitEthernet0/0/1]ospf network-type p2p
R10:
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ospf network-type p2p
R11:
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ospf network-type p2p
[R11]int g0/0/1
[R11-GigabitEthernet0/0/1]ospf network-type p2p
R12:
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ospf network-type p2p
OSPF认证
[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.0]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.2]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-1-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-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
检测: