Technology Sharing

OSPF-MGRE Review Experiment

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

First, according to the network segment information in the above topology diagram, configure the interface IP and ospf

Then configure the default route to ensure that the physical link is accessible.

Here we take R1 as an example

  1. ip route-static 0.0.0.0 0 16.0.0.2
  2. ip route-static 0.0.0.0 0 16.0.1.2

Then create a tunnel interface for MGRE configuration:

R1

  1. interface Tunnel0/0/0                        #R1,R4,R5全连mgre
  2.  ip address 192.168.1.1 24
  3.  tunnel-protocol gre p2mp                        #设定隧道协议为mgre
  4.  source 16.0.1.1
  5.  nhrp network-id 1
  6.  nhrp entry 192.168.1.4 46.0.0.1 register #按照全连要求,R1,R4,R5互为彼此中心和分支
  7.  nhrp entry 192.168.1.5 56.0.0.1 register
  1. interface Tunnel0/0/1                        #R1为中心,R2,R3为分支的mgre
  2.  ip address 192.168.0.1 24
  3.  tunnel-protocol gre p2mp
  4.  source 16.0.0.1
  5.  nhrp network-id 2

R2

  1. interface Tunnel0/0/0
  2.  ip address 192.168.0.2 24
  3.  tunnel-protocol gre p2mp
  4.  source 26.0.0.1
  5.  nhrp network-id 2
  6.  nhrp entry 192.168.0.1 16.0.0.1 register

R3

  1. interface Tunnel0/0/0
  2.  ip address 192.168.0.3 24
  3.  tunnel-protocol gre p2mp
  4.  source 36.0.0.1
  5.  nhrp network-id 2
  6.  nhrp entry 192.168.0.1 16.0.0.1 register

R4

  1. interface Tunnel0/0/0
  2.  ip address 192.168.1.4 24
  3.  tunnel-protocol gre p2mp
  4.  source 46.0.0.1
  5.  nhrp network-id 1
  6.  nhrp entry 192.168.1.1 16.0.1.1 register #按照全连要求,R1,R4,R5互为彼此中心和分支
  7.  nhrp entry 192.168.1.5 56.0.0.1 register

R5

  1. interface Tunnel0/0/0
  2.  ip address 192.168.1.5 24 
  3.  tunnel-protocol gre p2mp
  4.  source 56.0.0.1
  5.  nhrp network-id 1
  6.  nhrp entry 192.168.1.1 16.0.1.1 register        #按照全连要求,R1,R4,R5互为彼此中心和分支
  7.  nhrp entry 192.168.1.4 46.0.0.1 register

After configuration, I checked R1 and found that there were no R3 and R5 in the OSPF neighbor table, but there were R4 and R2. However, the state machine was init and no hello packet reply was received.

R2's neighbor table does not contain R1

R3 neighbor table does not have R1

R4's neighbor table has R5 and an adjacency relationship is established, but not R1

R5's neighbor table has R4 and an adjacency relationship is established, but R1 is not in the table.

First solve the problem of R1, R4, and R5. The default OSPF interface type for identifying the tunnel interface in OSPF is P2P, and there can only be two devices. Therefore, choose to change the tunnel interface type to broadcast.

  1. interface tunnel0/0/0
  2. ospf network-type broadcast

Check the OSPF neighbor table of R1, R4, and R5 again and find that R1, R4, and R5 have established neighbor relationships with each other.

After that, the problem between R1, R2, and R3 was solved. It was determined that MGRE only supports unicast, while OSPFV2 transmits information through multicast, so pseudo broadcast needs to be enabled.

R1

  1. interface Tunnel0/0/1
  2. nhrp entry multicast dynamic

R1 and R2 are neighbors, but the neighbor table does not contain R3.

R3's neighbor table has R1, but the state machine is init, and no hello packet is received from R1.

This phenomenon is the same as that of R1, R4, and R5. The interface type is p2p, which causes R1 to only send information to one router. Set the interface type of tunnel tunnel0/0/1 to p2mp.

The reason for choosing p2mp is that compared with broadcast, p2mp will not trigger DR and BDR elections. R1, R2, and R3 are in a center-branch structure, which will cause R2 and R3 to only know R1 as the center, and cannot know each other and have a branch. When electing DR and BDR, R1-R2 and R1-R3 will be divided into two areas for election. If R1 is the DR in one area and the BDR in another area during the election, the inconsistent recognition of DR and BDR in the center and branch will make some LSA information sent by DR devices in the network incomplete, resulting in the inability to obtain complete routing information.

R1

  1. interface Tunnel0/0/1
  2. ospf network-type p2mp #修改接口类型为p2mp
  3. ospf timer hello 10 #p2mp是人为接口类型,默认30s发送一次,为了加快收敛修改发送周期为10s

R2/R3

  1. interface Tunnel0/0/0
  2. ospf network-type p2mp
  3. ospf timer hello 10

Check the routing tables of R1-R5 and find that they all have routing entries for each other's private networks.

R1 pings R2, R3, R4, and R5

R2 pings R3, R4, and R5

R4 pings R2 and R5, proving that the private networks are reachable to each other.