OSPF综合实验
已知:给出的网段为172.16.0.0/16,我们需要划分为6个网段,所以向后借3位
则网段分别为:
172.16.0.0 /19 ---- area0
172.16.0.0/24 --- p2p的骨干
172.16.0.0 /30
172.16.0.4 /30
172.16.0.8 /30
172.16.0.12 /30
......
172.16.1.0 /24 --- MA 的骨干
172.16.1.0 /29
172.16.1.8 /29
172.16.1.16 /29
......
172.16.2.0 /24
......
172.16.31.0 /24
172.16.32.0 /19 ---- area1
172.16.32.0 /24 --- p2p的骨干
172.32.0 /30
172.32.4 /30
172.32.8 /30
172.32.12 /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.65.0 /24
172.16.64.0 /19 ---- area2
172.16.64.0 /24
172.16.65.0 /24
172.16.66.0 /24
......
172.16.95.0/24
172.16.96.0 /19 ---- area3
172.16.128.0 /19 ---- area4
172.16.160.0 /19 ---- rip
172.16.160.0 20
172.16.176.0 20
- 注意:其他四种分配都类似
接口网段划分:
网段划分: R3-R4 :34.0.0.0 /24
R4-R5 :45.0.0.0 /24
R4-R6 :46.0.0.0 /24
R4-R7 :47.0.0.0 /24
are0配置
1.配置公网部分全网可达
R4(LSP)配置环回地址 4.4.4.4 24
R3/5/6/7 配置路由缺省 ip route-static 0.0.0.0 0 X.X.X.X
测试:
2.配置私网网段实现MGRE
分配私网网段:属于area0 中的一个MA骨干所以分配172.16.1.0 /29这个网段
R3
隧道接口配置ip
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ip add
[R3-Tunnel0/0/0]ip address 172.16.1.1 29
[R3-Tunnel0/0/0]
定义分装类型
[R3-Tunnel0/0/0]tunnel-protocol ?
gre Generic Routing Encapsulation
ipsec IPSEC Encapsulation
ipv4-ipv6 IP over IPv6 encapsulation
ipv6-ipv4 IPv6 over IP encapsulation
mpls MPLS Encapsulation
none Null Encapsulation
[R3-Tunnel0/0/0]tunnel-protocol gre
[R3-Tunnel0/0/0]tunnel-protocol gre ?
p2mp Point to multi-point GRE mode
<cr> Please press ENTER to execute command
[R3-Tunnel0/0/0]tunnel-protocol gre p2
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
定义封装内容
[R3-Tunnel0/0/0]sou
[R3-Tunnel0/0/0]source 34.0.0.1
Oct 6 2022 18:16:12-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R3-Tunnel0/0/0]
目标
[R3-Tunnel0/0/0]nhrp
[R3-Tunnel0/0/0]nhrp ne
[R3-Tunnel0/0/0]nhrp network-id 100
开启伪广播
[R3-Tunnel0/0/0]nhrp entry mu
[R3-Tunnel0/0/0]nhrp entry multicast d
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R3-Tunnel0/0/0]
R5
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ip add
[R5-Tunnel0/0/0]ip address 172.16.1.2 29
[R5-Tunnel0/0/0]tu
[R5-Tunnel0/0/0]tunnel-protocol gre
[R5-Tunnel0/0/0]tunnel-protocol gre p2
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]sou
[R5-Tunnel0/0/0]source se
[R5-Tunnel0/0/0]source Serial 4/0/0
Oct 6 2022 18:40:33-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R5-Tunnel0/0/0]
[R5-Tunnel0/0/0]nhr
[R5-Tunnel0/0/0]nhrp ne
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nh
[R5-Tunnel0/0/0]nhrp ?
authentication Configure the authentication string for an interface using the
NHRP
entry NHRP mapping
network-id NHRP network id
redirect Configure Next Hop Resolution Protocol (NHRP) redirect
registration Register
shortcut Configure NHRP shortcut information
[R5-Tunnel0/0/0]nhrp en
[R5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1
[R5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 r
[R5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
[R5-Tunnel0/0/0]
创建环回,用于用户网段
[R5-LoopBack0]ip add
[R5-LoopBack0]ip address 172.16.2.1 24
[R5-LoopBack0]
注意:
R6:隧道ip:172.16.1.3 29 定义分装内容:source为端口4/0/0
R7:隧道ip:172.16.1.4 29 定义分装内容:source为端口0/0/0 其他配置类似
测试:
[R3]display nhr
[R3]display nhrp ?
peer Peer
statistics NHRP statistics information
[R3]display nhrp pe
[R3]display nhrp peer al
[R3]display nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
172.16.1.3 32 46.0.0.1 172.16.1.3 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:00:23
Expire time : 01:59:37
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
172.16.1.4 32 47.0.0.1 172.16.1.4 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:00:19
Expire time : 01:59:41
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
172.16.1.2 32 45.0.0.1 172.16.1.2 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:00:11
Expire time : 01:59:49
Number of nhrp peers: 3
[R3]
基本配置:
are1
R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add
[R1-GigabitEthernet0/0/0]ip address 172.16.33.1 29
Oct 6 2022 19:16:14-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]int l 0
[R1-LoopBack0]ip add
[R1-LoopBack0]ip address 172.16.34.1 24
[R1-LoopBack0]
R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add
[R2-GigabitEthernet0/0/0]ip address 172.16.33.2 29
Oct 6 2022 19:17:57-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int l 0
[R2-LoopBack0]ip add
[R2-LoopBack0]ip address 172.16.35.1 24
[R2-LoopBack0]
R3
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add
[R3-GigabitEthernet0/0/0]ip address 172.16.33.3 29
Oct 6 2022 19:18:39-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]int l 0
[R3-LoopBack0]ip add
[R3-LoopBack0]ip address 172.16.36.1 24
[R3-LoopBack0]
测试
are2
R6
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip add
[R6-GigabitEthernet0/0/0]ip address 172.16.65.1 29
Oct 6 2022 19:26:17-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R6-GigabitEthernet0/0/0]
R11
[R11]int g 0/0/0
[R11-GigabitEthernet0/0/0]ip add
[R11-GigabitEthernet0/0/0]ip address 172.16.65.2 29
Oct 6 2022 19:26:43-08:00 R11 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R11-GigabitEthernet0/0/0]int l 0
[R11-LoopBack0]ip add
[R11-LoopBack0]ip address 172.16.66.1 24
[R11-LoopBack0]int g 0/0/1
[R11-GigabitEthernet0/0/1]ip add
[R11-GigabitEthernet0/0/1]ip address 172.16
^
Error: Wrong parameter found at '^' position.
[R11-GigabitEthernet0/0/1]ip address 172.16.65.9 29
Oct 6 2022 19:28:01-08:00 R11 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R11-GigabitEthernet0/0/1]
R12
[R12]int g 0/0/0
[R12-GigabitEthernet0/0/0]ip add
[R12-GigabitEthernet0/0/0]ip address 172.16.65.10 29
Oct 6 2022 19:28:40-08:00 R12 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R12-GigabitEthernet0/0/0]
[R12-GigabitEthernet0/0/0]
[R12-GigabitEthernet0/0/0]q
因为R12后面为RIP所以使用分配的RIP的地址
[R12]
[R12]int l 0
[R12-LoopBack0]ip add
[R12-LoopBack0]ip address 172.16.160.1 20
[R12-LoopBack0]int l 1
[R12-LoopBack1]ip ad
[R12-LoopBack1]ip address 172.16.176.1 20
[R12-LoopBack1]
测试:
are3
R7
[R7]int g 0/0/1
[R7-GigabitEthernet0/0/1]ip add
[R7-GigabitEthernet0/0/1]ip address 172.16.97.1 29
Oct 6 2022 19:38:22-08:00 R7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R7-GigabitEthernet0/0/1]
R8
[R8]int g 0/0/0
[R8-GigabitEthernet0/0/0]ip add
[R8-GigabitEthernet0/0/0]ip address 172.16.97.2 29
Oct 6 2022 19:38:47-08:00 R8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R8-GigabitEthernet0/0/0]int l 0
[R8-LoopBack0]ip ad
[R8-LoopBack0]ip address 172.16.98.1 24
[R8-LoopBack0]int g 0/0/1
[R8-GigabitEthernet0/0/1]ip add
[R8-GigabitEthernet0/0/1]ip address 172.16.97.9 29
Oct 6 2022 19:39:40-08:00 R8 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R8-GigabitEthernet0/0/1]q
[R8]
R9
[R9]int g 0/0/0
[R9-GigabitEthernet0/0/0]ip add
[R9-GigabitEthernet0/0/0]ip address 172.16.97.10 29
Oct 6 2022 19:40:08-08:00 R9 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R9-GigabitEthernet0/0/0]int l 0
[R9-LoopBack0]ip add
[R9-LoopBack0]ip address 172.16.99.1 24
[R9-LoopBack0]
测试:
are4
R9
[R9-GigabitEthernet0/0/0]int g 0/0/1
[R9-GigabitEthernet0/0/1]ip add
[R9-GigabitEthernet0/0/1]ip address 172.16.129.1 29
Oct 6 2022 19:44:14-08:00 R9 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R9-LoopBack0]ip ad
[R9-LoopBack0]ip address 172.16.130.1 24
[R9-LoopBack0]
R10
[R10]int g 0/0/0
[R10-GigabitEthernet0/0/0]ip ad
[R10-GigabitEthernet0/0/0]ip address 172.16.129.2 29
Oct 6 2022 19:44:54-08:00 R10 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R10-GigabitEthernet0/0/0]q
[R10]int l 0
[R10-LoopBack0]ip add
[R10-LoopBack0]ip address 172.16.131.1 24
测试:
整个环境OSPF的搭建
R1
创建ospf区域
[R1]os
[R1]ospf 1 r
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]ar
[R1-ospf-1]area 1
宣告网段
[R1-ospf-1-area-0.0.0.1]ne
[R1-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
[R1-ospf-1-area-0.0.0.1]
R2与R1配置类似 router-id 2.2.2.2
R3
[R3]os
[R3]ospf 1 r
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]dis
[R3-ospf-1]display ip in
[R3-ospf-1]display ip interface br
[R3-ospf-1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.33.3/29 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.36.1/24 up up(s)
NULL0 unassigned up up(s)
Serial4/0/0 34.0.0.1/24 up up
Serial4/0/1 unassigned down down
Tunnel0/0/0 172.16.1.1/29 up up
[R3-ospf-1]
[R3-ospf-1]
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]net
[R3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.7.255
[R3-ospf-1-area-0.0.0.1]a 0
[R3-ospf-1-area-0.0.0.0]net
[R3-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
R5
[R6]os
[R6]ospf 1 ro
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]dis
[R6-ospf-1-area-0.0.0.0]display ip ro
[R6-ospf-1-area-0.0.0.0]display ip routing-table br
[R6-ospf-1-area-0.0.0.0]display ip in
[R6-ospf-1-area-0.0.0.0]display ip interface br
[R6-ospf-1-area-0.0.0.0]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.65.1/29 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.3.1/24 up up(s)
NULL0 unassigned up up(s)
Serial4/0/0 46.0.0.1/24 up up
Serial4/0/1 unassigned down down
Tunnel0/0/0 172.16.1.3/29 up up
[R6-ospf-1-area-0.0.0.0]ne
[R6-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.3.255
[R6-ospf-1-area-0.0.0.0]
Oct 6 2022 20:27:58-08:00 R6 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.16.172, Neighbo
rEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R6-ospf-1-area-0.0.0.0]
[R6-ospf-1-area-0.0.0.0]
[R6-ospf-1-area-0.0.0.0]a 2
[R6-ospf-1-area-0.0.0.2]ne
[R6-ospf-1-area-0.0.0.2]network 172.16.65.1 0.0.0.0
[R6-ospf-1-area-0.0.0.2]
R11
[R11]os
[R11]ospf 1 ro
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]ar
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]ne
[R11-ospf-1-area-0.0.0.2]network 172.16.0.0 0.0.255.255
[R11-ospf-1-area-0.0.0.2]
R12
[R12]os
[R12]ospf 1 ro
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]ar
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]net
[R12-ospf-1-area-0.0.0.2]network 172.16.65.10 0.0.0.0
[R12-ospf-1-area-0.0.0.2]
[R12-rip-1]v 2
[R12-rip-1]r 2
^
Error:Too many parameters found at '^' position.
[R12-rip-1]ne
[R12-rip-1]network 172.16.0.0
[R12-rip-1]
R7
[R7]os
[R7]ospf 1 r
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]dis
[R7-ospf-1-area-0.0.0.0]display ip in
[R7-ospf-1-area-0.0.0.0]display ip interface br
[R7-ospf-1-area-0.0.0.0]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 47.0.0.1/24 up up
GigabitEthernet0/0/1 172.16.97.1/29 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.4.1/24 up up(s)
NULL0 unassigned up up(s)
Tunnel0/0/0 172.16.1.4/29 up up
[R7-ospf-1-area-0.0.0.0]ne
[R7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.7.255
[R7-ospf-1-area-0.0.0.0]a 3
Oct 6 2022 20:33:45-08:00 R7 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.16.172, Neighbo
rEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R7-ospf-1-area-0.0.0.0]a 3
[R7-ospf-1-area-0.0.0.3]ne
[R7-ospf-1-area-0.0.0.3]network 172.16.97.1 0.0.0.0
[R7-ospf-1-area-0.0.0.3]
R8与R1类似
R9
[R9]osp
[R9]ospf 1 r
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]ar
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]network 172.16.97.10 0.0.0.0
[R9-ospf-1-area-0.0.0.3]are 4
[R9-ospf-1-area-0.0.0.4]net
[R9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.3.255
[R9-ospf-1-area-0.0.0.4]
R10与R1类似
测试:
有R3无法与R5,R6,R7建立邻居关系
更改R3tunnel0/0/0接口/R5/R7/R6接口的p2p为p2mp
原因:p2p接口网络类型只能建立一个邻居关系
[R3]int t 0/0/0 [R3-Tunnel0/0/0]os [R3-Tunnel0/0/0]ospf ne [R3-Tunnel0/0/0]ospf network-type p2 [R3-Tunnel0/0/0]ospf network-type p2mp
![]()
发现缺少are4 与rip的路由信息
解决:
1.rip;在边界路由器R12中设置重发布
2.are4;原因“属于不规则区域”
解决方法:1.tunnel接口;2.虚电路;3.重发布
采用多进程单向重发布
测试
之后将进程1中内容导入进程2中
测试:
减少LSA的更新量
1.汇总
are1配置
are2配置
are3配置
域外路由汇总
测试
2.做特殊区域
area1做成完全末梢区域
要让全部设备变成末梢区域,R2,R3操作与R1相同
变成完全末梢区域需要在ABR(R3)设备上stub no-summary
测试
area2做成完全NSSA区域
要让全部设备变成NSSA区域,R6,R12操作与R11相同
变成完全NSSA区域需要在ABR(R6)设备上stub no-summary
测试: ![](https://img-blog.csdnimg.cn/01ea199b598f46f3a952d2cedabe1e56.png)
area3做成完全NSSA区域
操作与area2类似:ABR设备为R7
测试:![](https://img-blog.csdnimg.cn/9c1c2ff88a1a42d5beaba53995cbb92a.png)
所有设备均可访问R4的环回
area4区域中配置路由缺省