OSPF大实验

OSPF大实验总结

一、实验相关知识点总结

1.OSPF概念

开放式最短路径优先协议
无类别链路状态路由协议—组播更新协议:224.0.0.5/6
触发更新、周期更新(30min);跨层封装到网络层–协议号89
基于LSA更新导致更新量很大-----需要为中大型网络服务—周期的维护—结构化部署结构化部署–区域划分、地址规划

2.数据包——5种基本数据包

HELLO – 邻居的发现、建立、保活
DBD --数据库描述包 – 数据库目录信息
LSR --链路状态请求
LSU —链路状态更新—携带各种
LSALSack ----链路状态确认

3.OSPF的工作过程

启动配置完成后,本地收发hello包,建立邻居关系,生成邻居表;
再进行条件的匹配,匹配失败将停留于邻居关系,仅hello包周期保活即可;
匹配成功者间可以建立邻接(毗邻)关系,需要DBD共享数据库目录,LSR/LSU/LSack来获取未知的LSA信息,当收集完网络中所有的LSA后,生成数据表–LSDB
LSDB建立完成后,本地基于SPF选路规则,计算本地到达所有未知网段的最短路径,然后将其加载到路由表中;完成收敛收敛完成后–hello包周期保活 – 30min周期的DBD比对,若不一致将使用LSR/LSU/LSack重新获取

4.OSPF的邻居建立成为邻接关系的条件

基于网络类型------点到点 MA多路访问
在点到点网络中,邻居关系必须成为邻接关系,否则无法正常收敛在MA网络若全网均为邻接关系,那么将可能出现大量重复性的LSA洪泛;
为避免该现象,将进行DR/BDR的选举;所有的非DR/BDR间不得建立成为邻接关系;

5.建立 tunnel 隧道

tunnel 隧道:一种的简单的VPN技术; 普通的tunnel为点到点网络类型;
生成隧道接口,流量通过路由查询后,若通过隧道接口转发时,需要在原有的三层报头前,再添加一个公有地址间的报头;
将两个仅可以通过WAN通讯的LAN,合成一个;
r1(config)#interface tunnel 0
r1(config-if)#ip address 10.1.1.1 255.255.255.0
r1(config-if)#tunnel source 12.1.1.1
r1(config-if)#tunnel destination 23.1.1.2
切记:建立tunnel,还需要编辑路由表,来将流量引向隧道接口

6.MGRE 多点GRE–NBMA网路类型

若需要将多个网络VPN为一个,普通的tunnel将成指数配置接口和路由;
MGRE可以将多个网络通过一条tunnel来实现;
优点
1、每个站点仅需配置一个tunnel接口;所有分支站点ip地址可以动态变化;
2、所有分支节点仅和中心节点建立tunnel,但也可以直接和其他分支站点直接通讯;
原理
1、中心站点,固定的公有ip地址;建议定义为NHRP的server为中心站点
2、tunnel配置完成,所有的分支站点将自己当下的信息发送到NHRP的server处,
生成映射列表;
3、此时中心站点可以直接和所有的分支站点进行GRE通讯;分支站点间直接GRE
通讯时,需要先到NHRP的server处下载映射列表,之后再进行GRE通讯;

6.多进程双向重发布

一台设备上若同时运行多个进程,那么不同进程拥有不同的RID,生成各自的数据库,当数据库不共享;仅将各自计算所得路由加载于同一张路由表内;若多个进程工作于同一个接口上,仅最新启动的进程生效;
在解决不规则区域时,让连接两个非骨干区域的ABR设备,将不同区域宣告到本地的不同进程下,之后使用重发布技术,进行路由共享即可;
r4(config)#router ospf 1
r4(config-router)#redistribute ospf 2 subnets
r4(config-router)#exit
r4(config)#router ospf 2
r4(config-router)#redistribute ospf 1 subnets

二、实验要求

1、拓扑图及地址规划

在这里插入图片描述

2.要求

(1)R4为ISP,其上只能配置IP地址;R4与其他所有直连设备间使用公有IP;
(2)R3-R5/R6/R7为MGRE环境,R3为中心站点;
(3)整个OSPF环境IP地址为172.16.0.0/16;
(4)所有设备均可访问R4的环回;
(5)减少LSA的更新量,加快收敛,保障更新安全
(6)全网可达

三、实验步骤

1.先对IP地址172.16.0.0/16进行子网划分

AREA1地址为:
172.16.32.0/21
172.16.40.0/21
172.16.48.0/21
172.16.56.0/21

AREA2地址为:
172.16.96.0/21
172.16.104.0/21
172.16.112.0/21

AREA3地址为:
172.16.128.0/21
172.16.136.0/21
172.16.144.0/21

AREA4地址为:
172.16.160.0/21
172.16.168.0/21
172.16.176.0/21

AREA0地址为:
172.16.64.0/21
172.16.72.0/16
172.16.80.0/21
172.16.88.0/21

EIGRP地址为:
172.16.192.0/20
172.16.208.0/20

2.对各路由进行地址与环回的配置

(1)R1的配置为:
R1(config)#int lo 1
R1(config-if)#ip add 172.16.32.1 255.255.248.0
R1(config-if)#no shu
R1(config-if)#int f0/0
R1(config-if)#ip add 172.16.40.1 255.255.248.0
R1(config-if)#no shu

(2)R2的配置为:
R2(config)#int lo 1
R2(config-if)#ip add
R2(config-if)#ip add 172.16.48.1 255.255.248.0
R2(config-if)#no shu
R2(config-if)#int f0/0
R2(config-if)#ip add 172.16.40.2 255.255.248.0
R2(config-if)#no shu

(3)R3的配置为:
R3(config)#in lo1
R3(config-if)#ip
R3(config-if)#ip add 172.16.56.1 255.255.248.0
R3(config-if)#no shu
R3(config-if)#int f0/0
R3(config-if)#ip add 172.16.40.3 255.255.248.0
R3(config-if)#no shu
R3(config)#interface serial 2/0
R3(config-if)#ip add 34.1.1.1 255.255.255.0
R3(config-if)#no shu

(4)R4的配置为:
R4(config-if)#int s2/0
R4(config-if)#ip add 34.1.1.2 255.255.255.0
R4(config-if)#no shu
R4(config-if)#int s2/1
R4(config-if)#ip add 45.1.1.2 255.255.255.0
R4(config-if)#no shu
R4(config-if)#int s2/2
R4(config-if)#ip add 46.1.1.2 255.255.255.0
R4(config-if)#no shu
R4(config-if)#int s2/3
R4(config-if)#ip add 47.1.1.2 255.255.255.0
R4(config-if)#no sh
R4(config)#in lo 1
R4(config-if)#ip add
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#no sh

(5)R5的配置为:
R5(config)#int s2/0
R5(config-if)#ip add 45.1.1.1 255.255.255.0
R5(config-if)#in lo 1
R5(config-if)#ip add 172.16.72.1 255.255.248.0

(6)R6的配置为:
R6(config-if)#int lo 1
R6(config-if)#ip add 172.16.80.1 255.255.248.0
R6(config-if)#in s2/0
R6(config-if)#ip add 172.16.46.1 255.255.255.0
R6(config-if)#no shu

(7)R7的配置为:
R7(config)#int s2/0
R7(config-if)#ip add 172.16.47.1 255.255.255.0
R7(config-if)#no shu
R7(config-if)#in lo 1
R7(config-if)#ip add 172.16.88.1 255.255.248.0
R7(config)#in s2/1
R7(config-if)#ip add 172.16.128.1 255.255.248.0
R7(config-if)#no shu

(8)R8的配置为:
R8(config)#in s2/0
R8(config-if)#ip add 172.16.128.2 255.255.248.0
R8(config-if)#no sh
R8(config-if)#in lo 1
R8(config-if)#ip add 172.16.136.1 255.255.248.0
R8(config-if)#no shu
R8(config-if)#in s2/1
R8(config-if)#ip add 172.16.144.1 255.255.248.0
R8(config-if)#no shu

(9)R9的配置为:
R9(config)#in s2/0
R9(config-if)#ip add 172.16.144.2 255.255.248.0
R9(config-if)#no sh
R9(config-if)#in lo 1
R9(config-if)#ip add 172.16.160.1 255.255.248.0
R9(config-if)#no shu
R9(config-if)#in s2/1
R9(config-if)#ip add 172.16.168.1 255.255.248.0
R9(config-if)#no shu

(10)R10的配置为:
R10(config)#int s2/0
R10(config-if)#ip add 172.16.168.2 255.255.248.0
R10(config-if)#no shu
R10(config-if)#in lo 1
R10(config-if)#ip add 172.16.176.1 255.255.248.0
R10(config-if)#no shu

(11)R11的配置为:
R11(config)#in s2/0
R11(config-if)#ip add 172.16.96.2 255.255.248.0
R11(config-if)#no shu
R11(config-if)#in lo 1
R11(config-if)#ip add 172.16.104.1 255.255.248.0
R11(config-if)#no shu
R11(config-if)#in s2/1
R11(config-if)#ip add 172.16.112.1 255.255.248.0
R11(config-if)#no sh

(12)R12的配置为:
R12(config)#in s2/0
R12(config-if)#ip add 172.16.112.2 255.255.248.0
R12(config-if)#no sh
R12(config-if)#in lo 1
R12(config-if)#ip add 172.16.192.1 255.255.240.0
R12(config-if)#no shu
R12(config-if)#in lo 2
R12(config-if)#ip add 172.16.208.1 255.255.240.0
R12(config-if)#no shu

3.建立隧道
(1)通公网

R3的配置:
R3(config)#ip route 0.0.0.0 0.0.0.0 34.1.1.2
R5的配置:
R5(config)#ip route 0.0.0.0 0.0.0.0 45.1.1.2
R6的配置:
R6(config)#ip route 0.0.0.0 0.0.0.0 46.1.1.2
R7的配置:
R7(config)#ip route 0.0.0.0 0.0.0.0 47.1.1.2
在R3上分别 ping R5、R6、R7的公网地址,看能否 ping 通,结果如下:
在这里插入图片描述
说明公网ping的通

(2)建隧道

R3的配置(R3为中心站点):
R3(config)#interface tunnel 1
R3(config-if)#ip add 172.16.64.1 255.255.248.0
R3(config-if)#tunnel source 34.1.1.1
R3(config-if)#tunnel mode gre multipoint
R3(config-if)#ip nhrp map multicast dynamic
R3(config-if)#ip nhrp network-id 100

R5的配置:
R5(config)#in tu 1
R5(config-if)#ip add 172.16.64.2 255.255.248.0
R5(config-if)#tunnel source serial 2/0
R5(config-if)#tunnel mode gre multipoint
R5(config-if)#ip nh nh 172.16.64.1
R5(config-if)#ip nh map 172.16.64.1 34.1.1.1
R5(config-if)#ip nh network-id 100

R6的配置:
R6(config)#in tu 1
R6(config-if)#ip add 172.16.64.3 255.255.248.0
R6(config-if)#tunnel source serial 2/0
R6(config-if)#tunnel mode gre multipoint
R6(config-if)#ip nh nh 172.16.64.1
R6(config-if)#ip nh map 172.16.64.1 34.1.1.1
R6(config-if)#ip nh net 100

R7的配置:
R7(config)#interface tunnel 1
R7(config-if)#ip add 172.16.64.4 255.255.248.0
R7(config-if)#tunnel source 2/0
R7(config-if)#tunnel mode gre multipoint
R7(config-if)#ip nh nh 172.16.64.1
R7(config-if)#ip nh map 172.16.64.1 34.1.1.1
R7(config-if)#ip nh net 100

检测隧道是否ping的通,结果如下:
在这里插入图片描述
说明可以ping的通

(3)启用OSPF

R1的配置:
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 172.16.0.0 0.0.255.255 a 1

R2的配置:
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 172.16.0.0 0.0.255.255 a 1

R3的配置:
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#net 172.16.40.3 0.0.0.0 a 1
R3(config-router)#net 172.16.64.1 0.0.0.0 a 0
R3(config-router)#net 172.16.56.1 0.0.0.0 a 1

R5的配置:
R5(config)#router ospf 1
R5(config-router)#router
R5(config-router)#router-id 5.5.5.5
R5(config-router)#net 172.16.0.0 0.0.255.255 a 0

R6的配置:
R6(config)#router ospf 1
R6(config-router)#router-id 6.6.6.6
R6(config-router)#net 172.16.64.3 0.0.0.0 a 0
R6(config-router)#net 172.16.80.1 0.0.0.0 a 0
R6(config-router)#net 172.16.96.1 0.0.0.0 a 2

R7的配置:
R7(config)#router ospf 1
R7(config-router)#router-id 7.7.7.7
R7(config-router)#net 172.16.64.4 0.0.0.0 a 0
R7(config-router)#net 172.16.88.1 0.0.0.0 a 0
R7(config-router)#net 172.16.128.1 0.0.0.0 a 3

R8的配置:
R8(config)#router ospf 1
R8(config-router)#router-id 8.8.8.8
R8(config-router)#net 172.16.0.0 0.0.255.255 a 3

R11的配置:
R11(config)#router ospf 1
R11(config-router)#router-id 11.11.11.11
R11(config-router)#net 172.16.0.0 0.0.255.255 a 2

R12的配置:
R12(config)#router ospf 1
R12(config-router)#router-id 12.12.12.12
R12(config-router)#net 172.16.112.2 0.0.0.0 a 2
R12(config-router)#exit
R12(config)#router ei 90
R12(config-router)#net 172.16.192.1 0.0.0.0
R12(config-router)#net 172.16.208.1 0.0.0.0
R12(config-router)#no au

R5的配置:
R5(config-if)#in tu 1
R5(config-if)#ip ospf network point-to-multipoint

R6的配置:
R6(config-if)#in tu 1
R6(config-if)#ip os network point-to-multipoint

R7的配置:
R7(config)#in tu 1
R7(config-if)#ip os net point-to-multipoint

R3的配置:
R3(config)#in tu 1
R3(config-if)#ip ospf net point-to-multipoint

R9的配置:
R9(config)#router ospf 1
R9(config-router)#router-id 9.9.9.9
R9(config-router)#net 172.16.144.2 0.0.0.0 a 3
R9(config-router)#exit
R9(config)#router ospf 2
R9(config-router)#router-id 99.9.9.9
R9(config-router)#net 172.16.160.1 0.0.0.0 a 4
R9(config-router)#net 172.16.168.1 0.0.0.0 a 4

R10的配置:
R10(config)#router ospf 1
R10(config-router)#router-id 10.10.10.10
R10(config-router)#net 172.16.0.0 0.0.255.255 a 4

R9的配置:
R9(config)#router ospf 1
R9(config-router)#redistribute ospf 2 subnets
R9(config-router)#exit
R9(config)#router ospf 2
R9(config-router)#redistribute ospf 1 subnets

R12的配置:
R12(config)#router ospf 1
R12(config-router)#redistribute ei 90 subnets

到这里就达到全网可达了

R3的配置:
R3(config)#int s2/0
R3(config-if)#ip nat outside
R3(config-if)#int f0/0
R3(config-if)#ip nat inside
R3(config-if)#exit
R3(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R3(config)#ip nat inside source list 1 interface s2/0

R5的配置:
R5(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R5(config)#int s2/0
R5(config-if)#ip nat outside
R5(config-if)#exit
R5(config)#ip nat inside source list 1 in s2/0

R6的配置:
R6(config)#in s2/0
R6(config-if)#ip nat outside
R6(config-if)#int s2/2
R6(config-if)#ip nat inside
R6(config-if)#exit
R6(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R6(config)#ip nat in sou list 1 int s2/0

R7的配置:
R7(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R7(config)#int s2/0
R7(config-if)#ip nat outside
R7(config)#in s2/1
R7(config-if)#ip nat in
R7(config-if)#exit
R7(config)#ip nat inside source list 1 interface serial 2/0

R3的配置:
R3(config)#router ospf 1
R3(config-router)#default-information originate

R5的配置:
R5(config)#router ospf 1
R5(config-router)#default-information originate

R6的配置:
R6(config)#router ospf 1
R6(config-router)#default-information originate

R7的配置:
R7(config)#router ospf 1
R7(config-router)#default-information originate

R3的配置:
R3(config)#router ospf 1
R3(config-router)#area 1 range 172.16.32.0 255.255.224.0

R6的配置:
R6(config-router)#area 2 range 172.16.96.0 255.255.224.0

R7的配置:
R7(config-router)#area 3 range 172.16.128.0 255.255.224.0

R9的配置:
R9(config)#router ospf 2
9(config-router)#default-information originate
R9(config)#router ospf 1
R9(config-router)#summary-address 172.16.160.0 255.255.224.0

R12的配置:
R12(config)#router ospf 1
R12(config-router)#summary-address 172.16.192.0 255.255.224.0

R3的配置:
R3(config)#router ospf 1
R3(config-router)#area 1 stub
R3(config-router)#area 1 range 172.16.32.0 255.255.224.0
R3(config-router)#area 1 stub no-summary

R12的配置:
R12(config)#router ospf 1
R12(config-router)#default-information originate
R12(config-router)#area 2 range 172.16.96.0 255.255.224.0
R12(config-router)#area 2 nssa

R6的配置:
R6(config)#router ospf 1
R6(config-router)#area 2 nssa no-s
R6(config-router)#area 2 nssa no-summary

R8的配置:
R8(config)#router ospf 1
R8(config-router)#summary-address 172.16.160.0 255.255.224.0
R8(config-router)#area 3 nssa

R7的配置:
R7(config)#router ospf 1
R7(config-router)#area 3 nssa no-summary

完成以上哦内容,则OSPF实验完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值