OSPF non directly connected neighbor adjacencies

OSPF neighbor adjacencies should be directly connected but there are situations where you can establish neighbor adjacencies when two routers are not directly connected.

Here are some examples.

These are used to connect an OSPF non-backbone area to the backbone area (Area 0) when no direct physical link to the backbone is present. Virtual links maintain OSPF area hierarchy and allow for proper routing within the OSPF domain.

https://networklessons.com/ospf/how-to-configure-ospf-virtual-link

GRE tunnels

OSPF adjacencies can be formed over GRE tunnels, making routers at opposite ends of the tunnel appear to be directly connected. This method encapsulates OSPF packets within GRE, allowing them to traverse intermediary networks.

https://networklessons.com/cisco/ccie-routing-switching/how-to-configure-gre-tunnel-on-cisco-ios-router

MPLS VPN

OSPF can also be used over MPLS VPNs, a common practice in enterprise networks where branch offices are interconnected via an MPLS cloud. This allows OSPF to create adjacencies over the MPLS infrastructure, treating the VPN as a direct link.

https://networklessons.com/mpls/mpls-layer-3-vpn-explained