eNSP 构建星型MGRE、全连网状MGRE

一、配置IP地址

 

二、缺省路由以及NAT

 此处列举R1的配置

[r1]ip route-static 0.0.0.0 0 14.1.1.2
[r1]ip route-static 0.0.0.0 0 14.2.2.2

[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255

[r1-acl-basic-2000]int g0/0/2
[r1-GigabitEthernet0/0/2]nat outbound 2000
[r1-GigabitEthernet0/0/2]int g0/0/1
[r1-GigabitEthernet0/0/1]nat outbound 2000

 二、构建R1-2-3 MGRE

星型MGRE需要一个注册点用R1来担任

R1

[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip ad 123.1.1.1 24

[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 14.1.1.1

[r1-Tunnel0/0/0]nhrp entry multicast dynamic 
[r1-Tunnel0/0/0]nhrp network-id 100

R2/R3

R2和R3在R1上进行注册

[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]ip ad 123.1.1.2 24

[r2-Tunnel0/0/0]tunnel-protocol gre p2mp 

[r2-Tunnel0/0/0]source g0/0/1
Jul 21 2022 01:15:17-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state. 

[r2-Tunnel0/0/0]nhrp entry 123.1.1.1 14.1.1.1 register 
[r2-Tunnel0/0/0]nhrp network-id 100

三、构建R1-5-6 MGRE

全连型MGRE让所有节点都互相注册

R1

[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]ip ad 156.1.1.1 24

[r1-Tunnel0/0/1]tunnel-protocol gre p2mp 

[r1-Tunnel0/0/1]source 14.2.2.1

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

[r1-Tunnel0/0/1]nhrp entry 156.1.1.2 54.1.1.1 register 

[r1-Tunnel0/0/1]nhrp entry 156.1.1.3 64.1.1.1 register 

[r1-Tunnel0/0/1]nhrp network-id 200

三、配置ospf

1、全连

此处列举R1的配置

宣告一个内网接口和两个tunnel口

而R5 R6则宣告各自的内网接口和一个tunnel口

因为该MGRE是全连型,三个路由器相互进行注册,所以ospf的dr/bdr选举能正常进行

但ospf在MGRE环境中接口的网络类型默认为p2p的网络类型,该工作方式仅允许建立一个邻居关系

导致在MGRE环境中无法建立所有的邻居关系

则需要将该网络环境中所有接口的网络类型更改为broadcast

[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 123.1.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 156.1.1.0 0.0.0.255

[r1-Tunnel0/0/1]ospf network-type broadcast

2、星型

在R1-2-3中则需要额外注意,在星型结构中,虽然修改了接口网络类型为broadcast,

但可能出现在dr/dbr选举时:

会出现R1(rid 1.1.1.1)会认为R3(rid 3.3.3.3)是R1的DR,而R2(rid 2.2.2.2)是R1的BDR;

但R3和R2并不是邻居关系,他们都会认为自己是R1的DR;

此时就会出现DR/BDR的选举冲突,解决办法就是让R2、R3放弃选举,让中心节点R1来担任DR。

[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ospf dr-priority 0

[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ospf dr-priority 0

3、邻居表

[r1]display ospf peer 

         OSPF Process 1 with Router ID 1.1.1.1
                 Neighbors 

 Area 0.0.0.0 interface 123.1.1.1(Tunnel0/0/0)'s neighbors
 Router ID: 2.2.2.2          Address: 123.1.1.2       
   State: Full  Mode:Nbr is  Master  Priority: 0
   DR: 123.1.1.1  BDR: None   MTU: 0    
   Dead timer due in 38  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:25:11     
   Authentication Sequence: [ 0 ] 

 Router ID: 3.3.3.3          Address: 123.1.1.3       
   State: Full  Mode:Nbr is  Master  Priority: 0
   DR: 123.1.1.1  BDR: None   MTU: 0    
   Dead timer due in 28  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:25:11     
   Authentication Sequence: [ 0 ] 

                 Neighbors 

 Area 0.0.0.0 interface 156.1.1.1(Tunnel0/0/1)'s neighbors
 Router ID: 5.5.5.5          Address: 156.1.1.2       
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 156.1.1.3  BDR: 156.1.1.2  MTU: 0    
   Dead timer due in 36  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:30:06     
   Authentication Sequence: [ 0 ] 

 Router ID: 6.6.6.6          Address: 156.1.1.3       
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 156.1.1.3  BDR: 156.1.1.2  MTU: 0    
   Dead timer due in 39  sec              
   Retrans timer interval: 5              
   Neighbor is up for 00:30:06            
   Authentication Sequence: [ 0 ]  

四、测试

1、pc访问4.4.4.4

PC>ping 4.4.4.4

Ping 4.4.4.4: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 4.4.4.4: bytes=32 seq=2 ttl=254 time=47 ms
From 4.4.4.4: bytes=32 seq=3 ttl=254 time=16 ms
From 4.4.4.4: bytes=32 seq=4 ttl=254 time=15 ms
From 4.4.4.4: bytes=32 seq=5 ttl=254 time=16 ms

--- 4.4.4.4 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/23/47 ms

2、相同或不同MGRE之间访问

[r1]ping -a 123.1.1.1 192.168.2.2
  PING 192.168.2.2: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.2: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 192.168.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 192.168.2.2: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 192.168.2.2: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 192.168.2.2: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.2.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/28/40 ms

[r1]ping -a 123.1.1.1 192.168.4.2
  PING 192.168.4.2: 56  data bytes, press CTRL_C to break
    Reply from 192.168.4.2: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 192.168.4.2: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 192.168.4.2: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 192.168.4.2: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 192.168.4.2: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.4.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/28/30 ms

pc

PC>ping 192.168.2.2

Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
From 192.168.2.2: bytes=32 seq=1 ttl=254 time=31 ms
From 192.168.2.2: bytes=32 seq=2 ttl=254 time=16 ms
From 192.168.2.2: bytes=32 seq=3 ttl=254 time=31 ms
From 192.168.2.2: bytes=32 seq=4 ttl=254 time=31 ms
From 192.168.2.2: bytes=32 seq=5 ttl=254 time=16 ms

--- 192.168.2.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 16/25/31 ms

PC>ping 192.168.3.2

Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break
From 192.168.3.2: bytes=32 seq=1 ttl=254 time=31 ms
From 192.168.3.2: bytes=32 seq=2 ttl=254 time=15 ms
From 192.168.3.2: bytes=32 seq=3 ttl=254 time=32 ms
From 192.168.3.2: bytes=32 seq=4 ttl=254 time=32 ms
From 192.168.3.2: bytes=32 seq=5 ttl=254 time=31 ms

--- 192.168.3.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 15/28/32 ms

PC>ping 192.168.4.2

Ping 192.168.4.2: 32 data bytes, Press Ctrl_C to break
From 192.168.4.2: bytes=32 seq=1 ttl=254 time=16 ms
From 192.168.4.2: bytes=32 seq=2 ttl=254 time=31 ms
From 192.168.4.2: bytes=32 seq=3 ttl=254 time=16 ms
From 192.168.4.2: bytes=32 seq=4 ttl=254 time=31 ms
From 192.168.4.2: bytes=32 seq=5 ttl=254 time=31 ms

--- 192.168.4.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 16/25/31 ms

PC>ping 192.168.5.2

Ping 192.168.5.2: 32 data bytes, Press Ctrl_C to break
From 192.168.5.2: bytes=32 seq=1 ttl=254 time=16 ms
From 192.168.5.2: bytes=32 seq=2 ttl=254 time=16 ms
From 192.168.5.2: bytes=32 seq=3 ttl=254 time=31 ms
From 192.168.5.2: bytes=32 seq=4 ttl=254 time=31 ms
From 192.168.5.2: bytes=32 seq=5 ttl=254 time=32 ms

--- 192.168.5.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 16/25/32 ms

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值