ospf小实验

Ospf综合实验
ospf小实验1,拓扑搭建
2,地址划分
3,配置
(1)接口地址配置
(2)建立通道
(3)Ospf区域划分,配置,缺省下发
(4)Eigrp
(5)冲发布
(6)Nat,端口映射
(7)优化
①手工汇总
1)
②特殊区域

MGRE 多点GRE-NBMA网络类型没有广播机制,将多个网络通过一条tunnel来实现,每一个站点仅配置一个tunnel接口所有的分支站点ip地址可以动态变化
原理:中心站点,固定ip地址:建议定义为NHRP的server为中心站点,tunnel配置完成后分支站点将自己的当下信息发送给server生成映射列表

Ospf:标准的LS性协议(共享拓扑)两种更新(触发更新,30min周期更新),五种基本数据包(HELLO,DBD,LSR.LSU.,SACK),七个状态机(DOWN,lint初始化,2way 双向通信,Exstart 预启动,Exchange 准交换, Loding 加载 , Full 转发)
结构突变
1、新增网段
2、断开网段
3、无法沟通
建立邻居必须使hello包中的四个参数一致:1、hello和dead time 2、区域ID 3、认证字段 4、末梢区域标记
不规则区域1、远离骨干的非骨干区域 2、不连续骨干(存在水平分割)
解决方案:1、普通tunnel 2、ospf虚链路 3、多进程双向重发布

Acl 访问控制列表,抓取一定范围的流量并对其做出一定的策略实现对网路的控制,可以结合nat,端口映射
Nat 地址转换,解决内网访问公网的问题,将本地内网的地址在通过isp时转换为与公网连接的公网ip

接口地址配置
配置方法所有的路由器都相同
R1:
R1#conf terminal
R1(config)#interface serial 2/1
R1(config-if)#ip address 172.1.6.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface Loopback1
R1(config-if)#ip address 172.16.8.1 255.255.255.0ospf小实验R1----------R12

R4为ISP所以需要在R3,R5,R6,R7上配置缺省指向ISP(R4)
R3(config)#ip router 0.0.0.0 0.0.0.0 100.1.1.2
R5(config)#ip router 0.0.0.0 0.0.0.0 100.1.2.1
R6(config)#ip router 0.0.0.0 0.0.0.0 100.1.3.1
R7(config)#ip router 0.0.0.0 0.0.0.0 100.1.4.1

建立通道:
因为是MA网络类型,所以需要用NBMA来建立通道,将R3作为中心站点,R5,R6,R7为分支站点。
配置如下:
中心站点:
R3:
R3(config)#interface Tunnel0
R3(config-if) ip address 10.1.1.1 255.255.255.0
R3(config-if)tunnel source Serial2/1
R3(config-if)tunnel mode gre multipoint
使本地成为NHRP的SERVER
R3(config-if)ip nhrp map multicast dynamic
R3(config-if)ip nhrp network-id 100

分支站点:
R5,6,7配置方式相同
R5:
R5(config)#interface Tunnel0
R5(config-if)#ip address 10.1.1.2 255.255.255.0
R5(config-if)#tunnel source Serial2/0
R5(config-if)#tunnel mode gre multipoint
R5(config-if )#ip nhrp nhs 10.1.1.1
R5(config-if)# ip nhrp map 10.1.1.1 100.1.1.1
R5(config-if)# ip nhrp network-id 100
通道是建立在 ISP上的,不能进行广播,中心站点与分支站点的建立会有问题,所以需要定义流量的具体目标(中心站点映射的公网地址):
R5(config-if)#ip nhrp map multicast 100.1.1.1

配置OSPF:
所有的路由器上的ospf的配置相同,只需把相应的地址宣告到规划的区域中即可
R1:
R1(config)#router ospf 1
R1(config-if)#router-id 1.1.1.1
R1(config-if)#network 172.16.1.1 0.0.0.0 area 1
R1(config-if)#network 172.16.8.1 0.0.0.0 area 1

R3:
R3(config)#router ospf 1
R3(config-if)#router-id 3.3.3.3
经过通道时需要宣告本路由器上的通达的地址,使ospf可以通过通道与其公网对端的ospf建立邻居。
R3(config-if)#network 10.1.1.1 0.0.0.0 area 0
MGRE环境下,若使用tunnel口默认的工作方式,一个网段内存在两个以上的节点将会出现邻居翻滚,需要将R3,R5,R6,R7接口模式设为点到多点
R3(config-if)#ip ospf network point-to-multipoint

R8一边为3区域,一边为4区域,且4区域为远离骨干的非骨干,所以需要用重发布将两边的路由共享,重发布是通过进程号进行的,所以3区域和4区域的进程号不能相同,3区域进程号为1,4区域进程号为2
R8:
R8(config)#router ospf 1
R8(config-if)#redistribute ospf 2 subnets
R8(config)#router ospf 2
R8(config-if)#redistribute ospf 1 subnets

R12的一边运行的是eigrp,宣告完成后,因为另一边是ospf所以也需要重发布
R12:
R12(config)#router eigrp 90
R12(config-if)#network 172.16.14.1 0.0.0.0
R12(config-if)#network 172.16.15.1 0.0.0.0
R12(config-if)#redistribute ospf 1 metric 1544 100 255 1 1500

R12(config)#router ospf 1
R12(config-if)# router-id 12.12.12.12
R12(config-if)#network 172.16.7.2 0.0.0.0 area 2
R12(config-if)# redistribute eigrp 90 subnets

要求所有的设备都可以访问R4的环回,因为R4为ISP所以需要做nat,端口映射,缺省。
R3:
R3(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R3(config)#ip nat pool 1 100.1.1.1 100.1.1.1 netmask 255.255.255.0
R3(config)#ip nat inside source list 1 interface Serial2/1 overload
R3(config)#ospf 1
OSPF下发缺省
R3(config-if)#default-information originate

R6:
R6(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R6(config)#ip nat inside source list 1 interface Serial2/0 overload
定义接口的进出方向
R6(config)#interface serial 2/1
R6(config)#ip nat inside
R6(config)#interface serial 2/0
R6(config)#ip nat outside

R7:
R7(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R7(config)#ip nat inside source list 1 interface Serial2/0 overload
定义接口的进出方向
R7(config)#interface serial 2/1
R7(config)#ip nat inside
R7(config)#interface serial 2/0
R7(config)#ip nat outside

优化:
Area1区域为完全末梢区域,在末梢区域的基础上进一步拒绝3的LSA,只保留一条3类缺省
必须先配置为末梢区域。ospf小实验
ospf小实验R1(config-router)]#area 1 stub
R2(config-router)#area 1 stub
R3(config-router)#area 1 stub no-summary

NSSA:非完全末梢区域,拒绝4/5类LSA避免出环不会自动产生3类缺省,在管理员确定不会出环的情况下可以手工添加。
ospf小实验ospf小实验R6(config)#router ospf 1
R6(config-router)#area 2 nss no-summary
R11(config-router)#area 2 nss
R12(config-router)#area 2 nss

域外路由汇总,需要在ASBR上配置ospf小实验完全NSSA
在NSSA的基础上进一步拒绝3类LSA,自动产生3类缺省需要先将本区域配置为NSSA然后在ABR上定义完全
配之前:ospf小实验ospf小实验配置后:
ospf小实验
ospf小实验R7(config)]#router ospf 1
R7(config-router)#area 3 nssa no-summary
R8(config-router)#area 3 nssa
R9(config-router)#area 3 nssa

域外路由为172.16.14.0/24和172.16.15.0/24.经过汇总后五类的LSA为一条172.16.0.0/16的路由条目
ospf小实验

R12(config)#router ospf 1
R12(config-router)#summary-address 172.16.0.0 255.255.0.0