eNSP——vpn-mgre

上篇我们学习了在mgre中的rip宣告,本次我们练习ospfx宣告

分析:

1、全连网络:R1即为中心,也为分支,R2、R3即为分支,也为中心,那么“分支”也相互可知。R1也要向分支进行注册。再更为广播网络类型后,DR、BDR的选举是三者之间。此为全连网络。

2、hub-spoke网络:即中心-站点网络 R1为中心,R2、R3为分支。

3、用ospf进行宣告时,要注意ospf要解决的问题

配置思路:

一、路由器回环与IP
二、实现物理链路到ISP的可达,私网可通公网
三、建立隧道,实现R1、R4、R3之间的mgre环境、全连网络
四、R1、R4、R3ospf宣告,并解决所属问题
五、测试R1、R4、R3的mgre环境下互通是否成功
六、建立隧道,实现R1、R5、R6之间的mgre环境、R1为中心
七、R1、R5、R6ospf宣告,并解决所属问题
八、测试R1、R5、R6的mgre环境下互通是否成功
九、测试全网是否可达

配置过程:

一、路由

r1

[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 12.0.0.1 8
Jan 28 2024 03:08:48-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

[R1-GigabitEthernet0/0/1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 21.0.0.1 8
Jan 28 2024 03:11:37-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 

[R1-GigabitEthernet0/0/0]q
[R1]int lo0
[R1-LoopBack0]ip add 192.168.1.1 24
[R1-LoopBack0]q

r3

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 23.0.0.1 8
[R3-GigabitEthernet0/0/0]
Jan 28 2024 03:35:47-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]q
[R3]int lo0
[R3-LoopBack0]ip add 192.168.3.1 24

r4 

[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 24.0.0.1 8
Jan 28 2024 03:37:17-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R4-GigabitEthernet0/0/0]q
[R4]int lo0
[R4-LoopBack0]ip add 192.168.4.1 24
[R4-LoopBack0]q

r5 

[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 25.0.0.1 8
Jan 28 2024 03:38:40-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R5-GigabitEthernet0/0/0]q
[R5]int lo0
[R5-LoopBack0]ip add 192.168.5.1 24
[R5-LoopBack0]q

r6

[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 26.0.0.1 8
Jan 28 2024 03:40:26-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]q
[R6]int lo0 
[R6-LoopBack0]ip add 192.168.6.1 24

r2(isp)

[ISP]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 21.0.0.2 8
Jan 28 2024 03:41:47-08:00 ISP %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[ISP-GigabitEthernet0/0/0]q
[ISP]int g0/0/1
[ISP-GigabitEthernet0/0/1]ip add 12.0.0.2 8
Jan 28 2024 03:42:05-08:00 ISP %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[ISP-GigabitEthernet0/0/1]q
[ISP]int g0/0/2
[ISP-GigabitEthernet0/0/2]ip add 23.0.0.2 8
Jan 28 2024 03:42:34-08:00 ISP %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
 on the interface GigabitEthernet0/0/2 has entered the UP state. 
[ISP-GigabitEthernet0/0/2]q
[ISP]int g4/0/0
[ISP-GigabitEthernet4/0/0]
[ISP-GigabitEthernet4/0/0]ip add 24.0.0.2 8
[ISP-GigabitEthernet4/0/0]
Jan 28 2024 03:43:05-08:00 ISP %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
 on the interface GigabitEthernet4/0/0 has entered the UP state. 
[ISP-GigabitEthernet4/0/0]q
[ISP]int g4/0/1
[ISP-GigabitEthernet4/0/1]ip add 25.0.0.2 8
Jan 28 2024 03:43:34-08:00 ISP %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
 on the interface GigabitEthernet4/0/1 has entered the UP state. 
[ISP-GigabitEthernet4/0/1]q
[ISP]int g4/0/2
[ISP-GigabitEthernet4/0/2]ip add 26.0.0.2 8
Jan 28 2024 03:44:11-08:00 ISP %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
 on the interface GigabitEthernet4/0/2 has entered the UP state. 
[ISP-GigabitEthernet4/0/2]q

全部按照图片指示设置好IP

二、物理网络可达
[R1]ip route-static 0.0.0.0 0 12.0.0.2
[R1]ip route-static 0.0.0.0 0 21.0.0.2
[R1]
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000
[R1-GigabitEthernet0/0/0]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000
[R1-GigabitEthernet0/0/1]q
[R3]ip route-static 0.0.0.0 0 23.0.0.2
[R3]
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]nat outbound 2000
[R3-GigabitEthernet0/0/0]q
[R4]ip route-static 0.0.0.0 0 24.0.0.2
[R4]
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-acl-basic-2000]q
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000
[R4-GigabitEthernet0/0/0]q
[R5]ip route-static 0.0.0.0 0 25.0.0.2
[R5]
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.5.0 0.0.0.255
[R5-acl-basic-2000]q
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]nat outbound 2000
[R5-GigabitEthernet0/0/0]q
[R6]ip route-static 0.0.0.0 0 26.0.0.2
[R6]
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 192.168.6.0 0.0.0.255
[R6-acl-basic-2000]q
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]nat outbound 2000
[R6-GigabitEthernet0/0/0]q

 

三、R1、R4、R3的mgre封装实现

建立隧道
[R1]int tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.7.1 24
[R1-Tunnel0/0/0]tunnel-pro gre p2mp
[R1-Tunnel0/0/0]source 12.0.0.1
Jan 29 2024 02:40:03-08:00 R1 %%01IFNET/4/LINK_STATE(l)[14]:The line protocol IP
 on the interface Tunnel0/0/0 has entered the UP state. 
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]source 21.0.0.1
Jan 29 2024 02:40:15-08:00 R1 %%01IFNET/4/LINK_STATE(l)[15]:The line protocol IP
 on the interface Tunnel0/0/0 has entered the DOWN state. 
[R1-Tunnel0/0/0]
Jan 29 2024 02:40:15-08:00 R1 %%01IFNET/4/LINK_STATE(l)[16]:The line protocol IP
 on the interface Tunnel0/0/0 has entered the UP state. 
[R1-Tunnel0/0/0]nhrp network-id 100

[R1-Tunnel0/0/0]nhrp entry 192.168.7.2 23.0.0.1 register 
Info: This peer protocol address conflicts with hub register peer protocol addre
ss. 
[R1-Tunnel0/0/0]nhrp entry 192.168.7.3 24.0.0.1 re	
[R1-Tunnel0/0/0]nhrp entry 192.168.7.3 24.0.0.1 register 

网段为21 

[R3]int t0/0/0
[R3-Tunnel0/0/0]ip add 192.168.7.2 24
[R3-Tunnel0/0/0]tunnel-pro gre p2mp
[R3-Tunnel0/0/0]source g0/0/0
Jan 29 2024 02:44:00-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 network-id 100
[R3-Tunnel0/0/0]nhrp entry 192.168.7.1 21.0.0.1 register
[R3-Tunnel0/0/0]nhrp entry 192.168.7.3 24.0.0.1 register 
[R4]int t0/0/0
[R4-Tunnel0/0/0]ip add 192.168.7.3 24
[R4-Tunnel0/0/0]tunnel-pro gre p2mp
[R4-Tunnel0/0/0]source g0/0/0
Jan 29 2024 02:46:55-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R4-Tunnel0/0/0]
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]nhrp entry 192.168.7.1 21.0.0.1 register 
[R4-Tunnel0/0/0]nhrp entry 192.168.7.2 23.0.0.1 register

成功相互建立nhrp邻居 ,形成全连网段

进行ospf宣告
[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.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.7.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]q
[R1-ospf-1]q
[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.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 192.168.7.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]q

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 192.168.7.3 0.0.0.0
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1]

解决两个问题:开启伪广播,才能将路由信息共享

                         将网络类型改为广播,才能符合ospf机制

[R1]int t0/0/0
[R1-Tunnel0/0/0]nhrp entry multicast dynamic 
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]ospf network-type broadcast 
[R3]int t0/0/0
[R3-Tunnel0/0/0]nhrp entry multicast dynamic 
[R3-Tunnel0/0/0]ospf network-type broadcast 
[R4]int t0/0/0
[R4-Tunnel0/0/0]nhrp entry multicast dynamic 
[R4-Tunnel0/0/0]ospf network-type broadcast 
测试:

 

达成全连网段,DR和BDR 的问题不用再管理不一致问题,三者会自动选举,而不再是hub-spoke分支互相不知两两选举。

四、R1、R6、R5的mgre封装
建立隧道
[R1]int t0/0/1
[R1-Tunnel0/0/1]ip add 192.168.8.1 24
[R1-Tunnel0/0/1]tunnel-pro gre p2mp
[R1-Tunnel0/0/1]source 12.0.0.1
Jan 29 2024 04:10:42-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/1 has entered the UP state. 
[R1-Tunnel0/0/1]
[R1-Tunnel0/0/1]source 21.0.0.1
Error: The specified source and destination addresses have been configured on an
other Tunnel0/0/0.
[R1-Tunnel0/0/1]nhrp network-id 200
[R1-Tunnel0/0/1]q

这个接口为12网段

[R5]int t0/0/0
[R5-Tunnel0/0/0]ip add 192.168.8.2 24
[R5-Tunnel0/0/0]tunnel-pro gre p2mp
[R5-Tunnel0/0/0]source g0/0/0
Jan 29 2024 04:20:42-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]nhrp network-id 200
[R5-Tunnel0/0/0]nhrp entry 192.168.8.1 12.0.0.1 re	
[R5-Tunnel0/0/0]nhrp entry 192.168.8.1 12.0.0.1 register 
[R5-Tunnel0/0/0]q
[R6]int t0/0/0
[R6-Tunnel0/0/0]ip add 192.168.8.3 24
[R6-Tunnel0/0/0]tunnel-pro gre p2mp
[R6-Tunnel0/0/0]source g0/0/0
Jan 29 2024 04:25:39-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R6-Tunnel0/0/0]
[R6-Tunnel0/0/0]nhrp network-id 200
[R6-Tunnel0/0/0]nhrp entry 192.168.8.1 12.0.0.1 re	
[R6-Tunnel0/0/0]nhrp entry 192.168.8.1 12.0.0.1 register 
[R6-Tunnel0/0/0]q
宣告ospf
[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.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.8.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]q
[R1-ospf-1]
[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.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 192.168.8.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]q
[R5-ospf-1]
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 192.168.6.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 192.168.8.3 0.0.0.0
[R6-ospf-1-area-0.0.0.0]q

解决问题

发现没有邻居,也没有路由表

在中心开启伪广播,使得匹配成功

 [R1-Tunnel0/0/1]nhrp entry multicast dynamic

邻居只有一个 是因为没有广播,不符合ospf机制,

第一种

将接口网络类型改为广播

[R1-Tunnel0/0/1] ospf network-type broadcast
[R5-Tunnel0/0/0] ospf network-type broadcast
[R6-Tunnel0/0/0] ospf network-type broadcast

结果

 

关于DR与BDR选举问题:如果DR与BDR,不一致则需要使R5、R6放弃选举,使R1成为DR;或者使R5、R6成为DR、R1为BDR。通过OSPF dr-priority o的指令修改接口优先级

[R6-Tunnel0/0/0]ospf dr-priority 0
[R5-Tunnel0/0/0]ospf dr-priority 0

成功

第二种

将接口类型改为p2mp

[R1-Tunnel0/0/1]ospf network-type p2mp
[R5-Tunnel0/0/0]ospf network-type p2mp
[R6-Tunnel0/0/0]ospf network-type p2mp

 

不需要管理DR与BDR的事情

成功

测试

五、全网可达

其隧道拓扑图

查看路由表和ospf邻居情况

路由表已经全啦!

R4可访问R6

总结:

在mgre环境中的ospf是重点部分,更要理解ospf的工作过程及ospf的数据包。

在mgre环境中 ospf也同rip一样有需要解决的问题,但ospf用在拓扑复杂的大型网络中会更加广泛。

!!拜拜!!

 

  • 20
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值