MGRE之OSPF实验

目录

题目:

步骤二:拓扑设计与地址规划​编辑

步骤三:IP地址配置

步骤四:缺省路由配置

步骤五:NAT的配置

步骤六:MGRE配置

中心站点R1配置

分支站点配置

[中心站点R5 R1配置](#中心站点R5 R1配置)

分支站点配置

检测:

步骤七:使用OSPF配置路由

1.配置OSPF

2.修改接口网络类型

3.打开伪广播

4.强制规定DR

步骤八:检测

检测一:随机找俩台设备访问对方

检测二:随机抓包

题目:

步骤二:拓扑设计与地址规划

步骤三:IP地址配置

R1

[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/1]ip add 16.1.1.1 24
[R1-GigabitEthernet0/0/2]ip add 61.1.1.1 24

R2

[R2-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[R2-GigabitEthernet0/0/1]ip add 2.1.1.1 24

R3

[R3-GigabitEthernet0/0/0]ip add 192.168.3.1 24
[R3-GigabitEthernet0/0/1]ip add 3.1.1.1 24

R4

[R4]int l 0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-GigabitEthernet0/0/0]ip add 61.1.1.2  24
[R4-GigabitEthernet0/0/2]ip add 16.1.1.2 24
[R4-GigabitEthernet0/0/1]ip add 2.1.1.2 24
[R4-GigabitEthernet4/0/0]ip add 3.1.1.2 24
[R4-GigabitEthernet4/0/2]ip add 5.1.1.2 24
[R4-GigabitEthernet4/0/1]ip add 6.1.1.2 24

R5

[R5-GigabitEthernet0/0/0]ip add 192.168.5.1 24
[R5-GigabitEthernet0/0/1]ip add 5.1.1.1 24

R6

[R6-GigabitEthernet0/0/0]ip ADD 192.168.6.1 24 
[R6-GigabitEthernet0/0/1]ip add 6.1.1.1 24

步骤四:缺省路由配置

[R1]ip route-static 0.0.0.0 0 16.1.1.2
[R1]ip route-static 0.0.0.0 0 61.1.1.2
[R2]ip route-static 0.0.0.0 0 2.1.1.2
[R3]ip route-static 0.0.0.0 0 3.1.1.2
[R5]ip route-static 0.0.0.0 0 5.1.1.2
[R6]ip route-static 0.0.0.0 0 6.1.1.2

步骤五:NAT的配置

除路由器R4以外,其余R4直连的路由器接口均配置以下命令:

acl 2000

rule 1 permit source any

int g 0/0/1

nat outbound 2000

步骤六:MGRE配置

中心站点R1配置

[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R1-Tunnel0/0/0]source 16.1.1.1
[R1-Tunnel0/0/0]nhrp network-id 100

分支站点配置

R2

[R3]int t 0/0/0
[R3-Tunnel0/0/0]ip add 10.1.1.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R3-Tunnel0/0/0]source GigabitEthernet 0/0/1
[R3-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.1.1  register 
[R3-Tunnel0/0/0]nhrp network-id 100

R3

[R2]int t 0/0/0
[R2-Tunnel0/0/0]ip add 10.1.1.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R2-Tunnel0/0/0]source GigabitEthernet 0/0/1
[R2-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.1.1 register 
[R2-Tunnel0/0/0]nhrp network-id 100

中心站点R5 R1配置

R1

[R1]int t 0/0/1
[R1-Tunnel0/0/1]ip add 20.1.1.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp 
[R1-Tunnel0/0/1]source 61.1.1.1
[R1-Tunnel0/0/1]nhrp network-id 101
[R1-Tunnel0/0/1]nhrp entry 20.1.1.2 5.1.1.1 register 

R5

[R5]int t 0/0/1
[R5-Tunnel0/0/1]ip add 20.1.1.2 24
[R5-Tunnel0/0/1]tunnel-protocol gre p2mp 
[R5-Tunnel0/0/1]source 5.1.1.1
[R5-Tunnel0/0/1]nhrp network-id 101
[R5-Tunnel0/0/1]nhrp entry 20.1.1.1 61.1.1.1 register 

分支站点配置

R6

[R6]int t 0/0/1
[R6-Tunnel0/0/1]ip add 20.1.1.3 24
[R6-Tunnel0/0/1]tunnel-protocol gre p2mp 
[R6-Tunnel0/0/1]source GigabitEthernet 0/0/1
[R6-Tunnel0/0/1]nhrp entry 20.1.1.1 61.1.1.1 register 
[R6-Tunnel0/0/1]nhrp entry 20.1.1.2 5.1.1.1 register 
[R6-Tunnel0/0/1]nhrp network-id 101

检测:

[R1]display nhrp peer all 
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.1.2        32    2.1.1.1         10.1.1.2        dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:56
Expire time     : 01:59:04
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.1.3        32    3.1.1.1         10.1.1.3        dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:16
Expire time     : 01:59:44
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
20.1.1.2        32    5.1.1.1         20.1.1.2        static       hub          
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/1
Created time    : 00:14:58
Expire time     : --
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
20.1.1.3        32    6.1.1.1         20.1.1.3        dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/1
Created time    : 00:15:18
Expire time     : 01:44:42

Number of nhrp peers: 4

步骤七:使用OSPF配置路由

1.配置OSPF

R1

[R1]ospf 1 router-id 1.1.1.1	
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255

R2

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0 
[R2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255

R3

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255

R5

[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255

R6

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255

2.修改接口网络类型

查看接口网络类型方法:

display ospf interface Tunnel 0/0/0

修改接口网络类型方法:

进入对应接口(隧道接口)后 ospf network-type ~类型~

3.打开伪广播

进入对应接口(中心站点隧道)后 nhrp entry multicast dynamic

4.强制规定DR

将同时存在于俩个MGRE网络内的路由器设置为DR

更改一些接口优先级,以达让某些路由器接口不参与选举

进入对应接口(隧道接口)后 ospf dr-priority 0

步骤八:检测

检测一:随机找俩台设备访问对方

检测二:随机抓包

相关推荐
楚灵魈24 分钟前
[Linux]从零开始的网站搭建教程
linux·运维·服务器
小小不董26 分钟前
《Linux从小白到高手》理论篇:深入理解Linux的网络管理
linux·运维·服务器·数据库·php·dba
豆豆44 分钟前
为什么用PageAdmin CMS建设网站?
服务器·开发语言·前端·php·软件构建
DY009J1 小时前
深度探索Kali Linux的精髓与实践应用
linux·运维·服务器
什么鬼昵称2 小时前
Pikachu- Over Permission-垂直越权
运维·服务器
码农小白2 小时前
linux驱动:(22)中断节点和中断函数
linux·运维·服务器
4647的码农历程2 小时前
Linux网络编程 -- 网络基础
linux·运维·网络
醉颜凉3 小时前
银河麒麟桌面操作系统V10 SP1:取消安装应用的安全授权认证
运维·安全·操作系统·国产化·麒麟·kylin os·安全授权认证
2401_857610033 小时前
SpringBoot实现:校园资料分享平台开发指南
服务器·spring boot·php
C++忠实粉丝3 小时前
Linux环境基础开发工具使用(2)
linux·运维·服务器