OSPF综合实验
实验拓扑图
要求:
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,全网可达
实验步骤
1.网段划分
整个OSPF环境 要基于172.16.0.0/16划分成6个区域,至少要借3位划分出8个网段。
172.16.0.0 19 -- 区域0
172.16.32.0 19 -- 区域1
172.16.64.0 19 -- 区域2
172.16.96.0 19 -- 区域3
172.16.128.0 19 -- 区域4
172.16.160.0 19 -- rip区
172.16.0.0 19--区域0
172.16.0.0 24--P2P
172.16.0.0 30
172.16.0.4 30
172.16.0.8 30
172.16.1.0 24 --MA
172.16.1.0 29
172.16.1.8 29
172.16.1.16 29
172.16.1.24 29
172.16.32.0 19--区域1
172.16.32.0 24--P2P
172.16.32.0 30
172.16.32.4 30
172.16.32.8 30
172.16.33.0 24 --MA
172.16.33.0 29
172.16.33.8 29
172.16.33.16 29
172.16.33.24 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.64.4 30
172.16.64.8 30
172.16.64.12 30
172.16.65.0 24--MA
172.16.65.0 29
172.16.65.8 29
172.16.65.16 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.96.4 30
172.16.97.0 24-MA
172.16.97.0 29
172.16.97.8 29
172.16.97.16 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.128.4 30
172.16.129.0 24-MA
172.16.129.0 29
172.16.129.8 29
172.16.130.0 24
172.16.131.0 24
172.16.160.0 19--RIP
172.16.160.0 24
172.16.161.0 24
172.16.192.0 19
172.16.224.0 19
2.配置公网链路
area0
r3
[R3]int s 4/0/0 [R3-Serial4/0/0]ip add 34.0.0.1 24 [R3-Serial4/0/0]q [R3]ip route-static 0.0.0.0 0 34.0.0.2
r4
[R4]int s 4/0/0 [R4-Serial4/0/0]ip add 34.0.0.2 24 [R4-Serial4/0/0]int s 4/0/1 [R4-Serial4/0/1]ip add 45.0.0.2 24 [R4-Serial4/0/1]int s 3/0/0 [R4-Serial3/0/0]ip add 46.0.0.2 24 [R4-Serial3/0/0]int g 0/0/0 [R4-GigabitEthernet0/0/0]ip add 47.0.0.2 24 [R4-GigabitEthernet0/0/0]int lo 0 [R4-LoopBack0]ip add 4.4.4.4 24
r5
[R5]int s 4/0/0 [R5-Serial4/0/0]ip add 45.0.0.1 24 [R5-Serial4/0/0]int l0 [R5-LoopBack0]ip add 172.16.2.1 24 [R5-LoopBack0]q [R5]ip route-static 0.0.0.0 0 45.0.0.2
r6
[R6]int s 4/0/0 [R6-Serial4/0/0]ip add 46.0.0.1 24 [R6-Serial4/0/0]int l0 [R6-LoopBack0]ip add 172.16.3.1 24 [R6-LoopBack0]q [R6]ip route-static 0.0.0.0 0 46.0.0.2
r7
[R7]int g 0/0/0 [R7-GigabitEthernet0/0/0]ip add 47.0.0.1 24 [R7-GigabitEthernet0/0/0]int l0 [R7-LoopBack0]ip add 172.16.4.1 24 [R7-LoopBack0]q [R7]ip route-static 0.0.0.0 0 47.0.0.2
area1
r1
[R1]int g 0/0/0 [R1-GigabitEthernet0/0/0]ip add 172.16.33.1 29 [R1-GigabitEthernet0/0/0]int l0 [R1-LoopBack0]ip add 172.16.34.1 24
r2
[R2]int g0/0/0 [R2-GigabitEthernet0/0/0]ip add 172.16.33.2 29 [R2-GigabitEthernet0/0/0]int l0 [R2-LoopBack0]ip add 172.16.35.1 24
r3
[R3]int g 0/0/0 [R3-GigabitEthernet0/0/0]ip add 172.16.33.3 29 [R3-GigabitEthernet0/0/0]int l0 [R3-LoopBack0]ip add 172.16.36.1 24
area2
r6
[R6]int g 0/0/0 [R6-GigabitEthernet0/0/0]ip add 172.16.64.1 30
r11
[R11]int g 0/0/0 [R11-GigabitEthernet0/0/0]ip add 172.16.64.2 30 [R11-GigabitEthernet0/0/0]int g 0/0/1 [R11-GigabitEthernet0/0/1]ip add 172.16.64.5 30 [R11]int l0 [R11-LoopBack0]ip add 172.16.66.1 24
r12
[R12]int g 0/0/0 [R12-GigabitEthernet0/0/0]ip add 172.16.64.6 30
area3
r7
[R7]int g0/0/1 [R7-GigabitEthernet0/0/1]ip add 172.16.96.1 30
r8
[R8]int g0/0/0 [R8-GigabitEthernet0/0/0]ip add 172.16.96.2 30 [R8-GigabitEthernet0/0/0]int g0/0/1 [R8-GigabitEthernet0/0/1]ip add 172.16.96.5 30 [R8]int l0 [R8-LoopBack0]ip add 172.16.98.1 24
r9
[R9]int g 0/0/0 [R9-GigabitEthernet0/0/0]ip add 172.16.96.6 30 [R9]int l0 [R9-LoopBack0]ip add 172.16.99.1 24
area4
r9
[R9]int g0/0/1 [R9-GigabitEthernet0/0/1]ip add 172.16.128.1 30 [R9-GigabitEthernet0/0/1]int l0 [R9-LoopBack0]ip add 172.16.130.1 24
r10
[R10]int g0/0/0 [R10-GigabitEthernet0/0/0]ip add 172.16.128.2 30 [R10-GigabitEthernet0/0/0]int l0 [R10-LoopBack0]ip add 172.16.131.1 24
rip区
r12
[R12]int l0 [R12-LoopBack0]ip add 172.16.160.1 24 [R12-LoopBack0]int l1 [R12-LoopBack1]ip add 172.16.161.1 24
3.配置以r3为中心的MGRE环境
r3
[R3]int t 0/0/0 [R3-Tunnel0/0/0]ip add 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 interface Tunnel0/0/0 ip address 172.16.1.1 255.255.255.248 tunnel-protocol gre p2mp source 34.0.0.1 nhrp entry multicast dynamic nhrp network-id 100
r5
[R5]int t 0/0/0 [R5-Tunnel0/0/0]ip add 172.16.1.2 29 [R5-Tunnel0/0/0]tunnel-protocol gre p2mp [R5-Tunnel0/0/0]source s 4/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
r6
[R6]int t 0/0/0 [R6-Tunnel0/0/0]ip add 172.16.1.3 29 [R6-Tunnel0/0/0]tunnel-protocol gre p2mp [R6-Tunnel0/0/0]source s 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
r7
[R7]int t0/0/0 [R7-Tunnel0/0/0]ip add 172.16.1.4 29 [R7-Tunnel0/0/0]tunnel-protocol gre p2mp [R7-Tunnel0/0/0]source g 0/0/0 [R7-Tunnel0/0/0]nhrp network-id 100 [R7-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
检验
r3 ping r5
[R3]ping-a 172.16.1.1 172.16.1.2 PING 172.16.1.2: 56 data bytes, press CTRL_C to break Reply from 172.16.1.2: bytes=56 Sequence=l ttl=255 time=30 ms Reply from 172.16.1.2: bytes=56 Sequence=2 ttl=255 time=30 ms Reply from 172.16.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms Reply from 172.16.1.2: bytes=56 Sequence=4 ttl=255 time=30 ms Reply from 172.16.1.2: bytes=56 Sequence-5 tt1=255 time=10 ms ---172.16.1.2 ping statistics--- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max= 10/26/30 ms
r3 ping r6
[R3]ping-a 172.16.1.1 172.16.1.3 PING 172.16.1.3: 56 data bytes, press CTRL_C to break Reply from 172.16.1.3: bytes=56 Sequence=l ttl=255 time=20 ms Reply from 172.16.1.3: bytes=56 Sequence=2 ttl=255 time=20 ms Reply from 172.16.1.3: bytes=56 Sequence=3 ttl=255 time=10 ms Reply from 172.16.1.3: bytes=56 Sequence=4 ttl=255 time=10 ms Reply from 172.16.1.3: bytes=56 Sequence=5 ttl-255 time=30 ms ---172.16.1.3 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max=10/20/30 ms
r3 ping r7
[R3]ping-a 172.16.1.1 172.16.1.4 PING 172.16.1.4: 56 data bytes, press CTRL_C to break Reply from 172.16.1.4: bytes=56 Sequence=l ttl=255 time=40 ms Reply from 172.16.1.4: bytes=56 Sequence=2 tt1=255 time=20 ms Reply from 172.16.1.4: bytes=56 Sequence=3 ttl=255 time=30 ms Reply from 172.16.1.4: bytes=56 Sequence=4 ttl=255 time=40 ms Reply from 172.16.1.4: bytes=56 Sequence=5 ttl=255 time=30 ms ---172.16.1.4 ping statistics--- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max=20/32/40 ms
4.配置OSPF
r1
[R1]ospf 1 router-id 1.1.1.1 [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255
r2
[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
r3
[R3]ospf 1 router-id 3.3.3.3 [R3-ospf-1]area 1 [R3-ospf-1-area-0.0.0.0]network 172.16.33.3 0.0.0.0 [R3-ospf-1-area-0.0.0.0]network 172.16.36.1 0.0.0.0 [R3-ospf-1-area-0.0.0.1]area 0 [R3-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
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.2.1 0.0.0.0 [R5-ospf-1-area-0.0.0.0]network 172.16.1.2 0.0.0.0
r6
[R6]ospf 1 router-id 6.6.6.6 [R6-ospf-1]area 0 [R5-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0 [R5-ospf-1-area-0.0.0.0]network 172.16.1.3 0.0.0.0 [R6-ospf-1]area 2 [R5-ospf-1-area-0.0.0.2]network 172.16.64.1 0.0.0.0
r7
[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-ospf-1-area-0.0.0.0]area 3 [R7-ospf-1-area-0.0.0.3]network 172.16.96.1 0.0.0.0
r8
[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.96.0 0.0.31.255
r9
[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-1-area-0.0.0.3]area 4 [R9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.31.255
r10
[R10]ospf 1 router-id 10.10.10.10 [R10-ospf-1]area 4 [R10-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.31.255
r11
[R11]ospf 1 router-id 11.11.11.11 [R11-ospf-1]area 2 [R11-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255
r12
[R12]ospf 1 router-id 12.12.12.12 [R12-ospf-1]area 2 [R12-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255
5.更改tunnel接口类型
r3
[R3]int Tunnel 0/0/0 [R3-Tunnel0/0/0]ospf network-type p2mp
r5
[R5]int Tunnel 0/0/0 [R5-Tunnel0/0/0]ospf network-type p2mp
r6
[R6]int Tunnel 0/0/0 [R6-Tunnel0/0/0]ospf network-type p2mp
r7
[R7]int Tunnel 0/0/0 [R7-Tunnel0/0/0]ospf network-type p2mp
6.进行重发布,使配置OSPF的设备获取域外路由信息
r12
[R12]ospf 1 [R12-ospf-1]import-route rip [R12-ospf-1]rip 1 [R12-rip-1]network 172.16.0.0
r9
[R9]ospf 1 [R9-ospf-1]undo area 4 [R9]ospf 2 router-id 9.9.9.9 [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
r10
[R10]undo ospf 1 Warning: The OSPF process will be deleted. Continue? [Y/N]:y [R10]ospf 2 router-id 10.10.10.10 [R10-ospf-2]area 0 [R10-ospf-2-area-0.0.0.0]network 172.16.128.0 0.0.31.255
7.路由汇总
r3
[R3]ospf 1 [R3-ospf-1]area 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]area 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]area 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 [R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
8.设置特殊区域
r1
[R1]ospf [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]stub
r2
[R2]ospf [R2-ospf-1]area 1 [R2-ospf-1-area-0.0.0.1]stub
r3
[R3]ospf [R3-ospf-1]area 1 [R3-ospf-1-area-0.0.0.1]stub no-summary
r6
[R6]ospf [R6-ospf-1]area 2 [R6-ospf-1-area-0.0.0.2]nssa [R6-ospf-1-area-0.0.0.2]nssa no-summary
r9
[R9]ospf 2 [R9-ospf-2]default-route-advertise
r11
[R11]ospf [R11-ospf-1]area 2 [R11-ospf-1-area-0.0.0.2]nssa
r12
[R12]ospf [R12-ospf-1]area 2 [R12-ospf-1-area-0.0.0.2]nssa
9.区域加密
r1
[R1]ospf 1 [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
r2
[R2]ospf 1 [R2-ospf-1]area 1 [R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
r3
[R3]ospf 1 [R3-ospf-1]area 1 [R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
10.修改hello时间加快收敛
r3
[R3]int Tunnel 0/0/0 [R3-Tunnel0/0/0]ospf timer hello 10
r5
[R5]int Tunnel 0/0/0 [R5-Tunnel0/0/0]ospf timer hello 10
r6
[R6]int Tunnel 0/0/0 [R6-Tunnel0/0/0]ospf timer hello 10
r7
[R7]int Tunnel 0/0/0 [R7-Tunnel0/0/0]ospf timer hello 10