OSPF综合实验

实验要求

在这里插入图片描述

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

实验思路

IP地址规划

  • 公网IP随便配置,这里我R3-R4的网段为34.1.1.0/24, R5-R4的网段为54.1.1.0/24,其他同此
  • 私网基于172.16.0.0/16划分,首先整个私网运行了两个路由协议,所以先将172.16.0.0/16划分为172.16.0.0/17和172.16.128.0/17两个网段,其中172.16.0.0/16给ospf,172.16.128.0/17给rip
  • 整个OSPF域基于172.16.0.0/16划分,这里我们给每个OSPF区域掩码为24的网段,area 0为172.16.0.0/24;area 1为172.16.1.0/24;area 2为172.16.2.0/24,其他同此。
  • OSPF单个区域内部IP根据网段数进行划分
  • RIP域只有两个接口,分别配置为172.16.128.1/24和172.16.128.129.1/24

在这里插入图片描述

路由

  • 边界路由器配置一条指向ISP的静态缺省
  • 搭建MGRE环境,tunnel口IP为OSPFarea 0的IP。
  • 私网设备启动OSPF和RIP,OSPF不规则区域都使用重发布解决,并配置OSPF特殊区域,非骨干区域都会自动下发缺省指向骨干区域,在R9上将域外路由汇总为0.0.0.0导入到area 4中
  • 在边界路由器还需要配置空接口,防止路由黑洞
  • 在边界路由器上配置NAT

实验配置

R1上配置

# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 172.16.1.65 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.1.1 255.255.255.192 
# 启动OSPF宣告所有接口
ospf 1 router-id 1.1.1.1 
 area 0.0.0.1 
  network 172.16.1.0 0.0.0.255
  stub
#

R2上配置

# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 172.16.1.66 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.128.1 255.255.252.0 
# 启动OSPF进程宣告所有接口
ospf 1 router-id 2.2.2.2 
 area 0.0.0.1 
  network 172.16.1.0 0.0.0.255
  stub
#

R3上配置

# 使用ACL抓取私网流量
acl number 2000  
 rule 5 permit source 172.16.1.0 0.0.0.255 
# 配置接口IP
interface Serial4/0/0
 link-protocol ppp
 ip address 34.1.1.1 255.255.255.0 
 nat outbound 2000 -- 一对多NAT配置
#
interface GigabitEthernet0/0/0
 ip address 172.16.1.67 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.1.193 255.255.255.192 
# 创建tunnel口,搭建MGRE环境
interface Tunnel0/0/0
 ip address 172.16.0.1 255.255.255.192 
 tunnel-protocol gre p2mp
 source 34.1.1.1
 ospf network-type p2mp --- 更改tunnel口的接口网络类型为p2mp,该类型不需要进行DR/BDR选举,且可以建立多个邻居
 nhrp entry multicast dynamic
 nhrp network-id 100
# 启动OSPF进程
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 172.16.0.0 0.0.0.255 
 area 0.0.0.1 
  abr-summary 172.16.1.0 255.255.255.0 ---- 将该区域的路由进行汇总就传递给其他区域
  network 172.16.1.0 0.0.0.255 
  stub no-summary
# 缺省路由指向ISP
ip route-static 0.0.0.0 0.0.0.0 34.1.1.2
ip route-static 172.16.1.0 255.255.255.0 null0
#

R4上配置

# R4上只配置接口IP
interface Serial2/0/0
 link-protocol ppp
 ip address 34.1.1.2 255.255.255.0 
#
interface Serial2/0/1
 link-protocol ppp
 ip address 54.1.1.2 255.255.255.0 
#
interface Serial3/0/0
 link-protocol ppp
 ip address 64.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/0
 ip address 74.1.1.2 255.255.255.0 
#
interface LoopBack0
 ip address 8.8.8.8 255.255.255.0 
#

R5上配置

# 配置接口IP
interface Serial4/0/0
 link-protocol ppp
 ip address 54.1.1.1 255.255.255.0 
#
interface LoopBack0
 ip address 172.16.0.65 255.255.255.192 
# 创建tunne口,搭建MGRE环境
interface Tunnel0/0/0
 ip address 172.16.0.2 255.255.255.192 
 tunnel-protocol gre p2mp
 source Serial4/0/0
 ospf network-type p2mp --- 更改接口类型为OSPF,因为p2mp模式的hello时间为30s,如果hello时间不同,无法建立邻居关系
 nhrp network-id 100
 nhrp entry 172.16.0.1 34.1.1.1 register
# 启动ospf进程
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 172.16.0.0 0.0.0.255 
# 缺省路由和空接口路由
ip route-static 0.0.0.0 0.0.0.0 54.1.1.2
#

R6上配置

# 使用acl抓取私网流量
acl number 2000  
 rule 5 permit source 172.16.0.0 0.0.255.255 
# 配置接口IP
interface Serial4/0/0
 link-protocol ppp
 ip address 64.1.1.1 255.255.255.0 
 nat outbound 2000 --- 一对多NAT配置
#
interface GigabitEthernet0/0/0
 ip address 172.16.2.1 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.0.129 255.255.255.192 
# 创建tunne口,搭建MGRE环境
interface Tunnel0/0/0
 ip address 172.16.0.3 255.255.255.192 
 tunnel-protocol gre p2mp
 source Serial4/0/0
 ospf network-type p2mp
 nhrp network-id 100
 nhrp entry 172.16.0.1 34.1.1.1 register
# 启动OSPF进程
ospf 1 router-id 6.6.6.6 
 area 0.0.0.0 
  network 172.16.0.0 0.0.0.255 
 area 0.0.0.2 
  abr-summary 172.16.2.0 255.255.255.0 --- 将该区域的路由进行汇总就传递给其他区域
  network 172.16.2.0 0.0.0.255 
  nssa no-summary --- 配置该区域为完全的末梢区域
# 缺省路由和空接口路由
ip route-static 0.0.0.0 0.0.0.0 64.1.1.2
ip route-static 172.16.2.0 255.255.255.0 null0
#

R7上配置

# 使用acl抓取私网流量
acl number 2000  
 rule 5 permit source 172.16.0.0 0.0.255.255 
# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 74.1.1.1 255.255.255.0 
 nat outbound 2000 --- 一对多NAT配置
#
interface GigabitEthernet0/0/1
 ip address 172.16.3.1 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.0.193 255.255.255.192 
#配置接口IP
interface Tunnel0/0/0
 ip address 172.16.0.4 255.255.255.192 
 tunnel-protocol gre p2mp
 source GigabitEthernet0/0/0
 ospf network-type p2mp
 nhrp network-id 100
 nhrp entry 172.16.0.1 34.1.1.1 register
# 启动OSPF进程
ospf 1 router-id 7.7.7.7 
 area 0.0.0.0 
  network 172.16.0.0 0.0.0.255 
 area 0.0.0.3 
  abr-summary 172.16.3.0 255.255.255.0 ---- 将该区域的路由进行汇总就传递给其他区域
  network 172.16.3.0 0.0.0.255 
  nssa no-summary --- 配置该区域为完全的非完全末梢区域
# 缺省路由和空接口路由
ip route-static 0.0.0.0 0.0.0.0 74.1.1.2
ip route-static 172.16.3.0 255.255.255.0 null0  
#

R8上配置

# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 172.16.3.2 255.255.255.192 
#
interface GigabitEthernet0/0/1
 ip address 172.16.3.129 255.255.255.192 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.3.65 255.255.255.192 
# 启动OSPF进程
ospf 1 router-id 8.8.8.8 
 area 0.0.0.3 
  network 172.16.3.0 0.0.0.255 
  nssa --- 配置该区域为NSSA
#

R9上配置

# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 172.16.3.130 255.255.255.192 
#
interface GigabitEthernet0/0/1
 ip address 172.16.4.65 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.4.1 255.255.255.192 
# 启动OSPF进程1
ospf 1 router-id 9.9.9.9 
 asbr-summary 172.16.4.0 255.255.255.0 --- 将域外路由进行汇总
 import-route ospf 2 --- 将OSPF进程2的路由导入
 area 0.0.0.3 
  network 172.16.3.0 0.0.0.255 
  nssa --- 配置该区域为NSSA
# 启动OSPF进程2
ospf 2 router-id 9.9.9.9 
 asbr-summary 0.0.0.0 0.0.0.0 --- 将导入的路由汇总为0.0.0.0,即所有路由,相当于下发一条缺省路由
 import-route ospf 1 --- 导入ospf进程1的路由
 area 0.0.0.4 
  network 172.16.4.0 0.0.0.255 
#

R10上配置

# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 172.16.4.66 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.4.129 255.255.255.192 
# 启动OSPF进程
ospf 1 router-id 10.10.10.10 
 area 0.0.0.4 
  network 172.16.4.0 0.0.0.255 
#

R11上配置

# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 172.16.2.2 255.255.255.192 
#
interface GigabitEthernet0/0/1
 ip address 172.16.2.129 255.255.255.192 
#
interface LoopBack0
 ip address 172.16.2.65 255.255.255.192 
# 启动OSPF进程
ospf 1 router-id 11.11.11.11 
 area 0.0.0.2 
  network 172.16.2.0 0.0.0.255 
  nssa --- 配置该区域为NSSA
#

R12上配置

# 配置接口IP
interface GigabitEthernet0/0/0
 ip address 172.16.2.130 255.255.255.192 
# 
interface LoopBack1
 ip address 172.16.128.1 255.255.255.0 
#
interface LoopBack2
 ip address 172.16.129.1 255.255.255.0 
# 启动OSPF进程
ospf 1 router-id 12.12.12.12 
 asbr-summary 172.16.128.0 255.255.192.0 ---将导入的路由进行汇总
 import-route rip 1 --- 导入RIP进程的路由
 area 0.0.0.2 
  network 172.16.2.0 0.0.0.255 
  nssa --- 配置该区域为NSSA
# 启动RIP,宣告两个环回
rip 1
 undo summary
 version 2
 network 172.16.0.0 
 import-route ospf 1
#

实验测试

R10pingR4的环回

在这里插入图片描述

R10pingR12的环回

在这里插入图片描述

R10pingR1

在这里插入图片描述

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值