0

I have read somewhere that:

OSPF router’s neighbors are usually the routers directly connected to it through its interfaces, from a layer-3 perspective. However, there are some exceptions, such as when using virtual links or GRE tunnels.

Regardless of the exceptions:

What is the meaning of "Directly Connected" in this context? Is it the same as the "C" entries in the routing table?

As I am still learning, I am confused a bit about these terms and what they mean exactly. I have read some explanations on the Internet but they were not clear to me.

Let us assume that there are three routers that run OSPF and that they are connected like this:

 R01--------R02--------R03

In this case:

Are R01 & R03 considered neighbors?

if yes,

How come they are neighbors while they are not directly connected?

It would be even more beneficial if there are clearer and more distinctive definitions for:

Directly Connection
Neighborhood.
Adjacency.

1 Answer 1

2

Just like in a physical neighborhood of people's homes, you might consider the house directly adjacent to yours to be your neighbor and the next house to be the neighbor of your neighbor, but the whole area is your neighborhood... well... it's complicated.

The first part of your question boils down to 'do OSPF neighbors need to be directly connected to each other to for a neighbor adjacency?'. The answer is generally yes, they need either a direct point-to-point link between the 2 neighbor devices or a 'logical' direct connection such as an encapsulated link like a GRE tunnel that simulates a direct link that can support broadcasts. You can form a neighbor adjacency over a non-broadcast multi-access network such as ATM or Frame-Relay but it is more complicated and requires special configuration to make it work properly.

And no, it does not relate directly to 'C' or connected state route entries in the routing table, though the router might coincidently end up listing routes in the C state which happen to be the same interfaces that are used for OSPF neighbor adjacency which can make them seem closely related.

Connected state routes simply mean routes learned due to it being configured on a connected interface on the router. That is not what OSPF refers to when it says neighbors must be connected.

OSPF neighbors need to be able to send and receive broadcast 'hello' packets to each other to begin establishing the neighbor adjacency so having them directly connected to each other via interfaces that are configured to participate in the OSPF area (neighborhood) makes that very easy to do with no additional work. You can establish OSPF adjacency without the use of broadcasts but it requires more configuration, as mentioned and is not as commonly done.

Editing here to add at Ron's suggestion that broadcast is not the only way to establish adjacency. OSPF can be configured manually to use unicast based connection setup over non-broadcast oriented connections. This can be useful in either very small environments or when the connection medium is not friendly to broadcasts or other complex setups.

In your example, R01 and R03 are not considered neighbors in most common implementations because they are not connected to each other, though they might be in the same OSPF Area meaning the routes they share with R02 can be passed on so that R01, R02 and R03 all end up with a coherent set of routes and can reach each others networks that are configured to participate in OSPF.

The terms you list at the end are not actually all specifically related to OSPF.

Directly Connected simply means that they are directly connected to each other via a single cable path or logical connection/tunnel. There are some edge cases where you might argue semantics but for the most part, this means exactly what you would expect.

Neighborhood is not a term in OSPF. You can use it but it is not a standard meaning or widely used term in my experience for OSPF. Area is probably the word you want and it has specific meanings in OSPF.

Adjacency also has specific meaning in OSPF and it means the OSPF neighbor state has been established between 2 OSPF neighbors and they are exchanging route information. IF they are not able to do that then they do not have an adjacency. They may be in some stage of trying to form one, but it is not a full adjacency until they are able to exchange route information.

Here is a good guide:

https://www.cisco.com/c/en/us/support/docs/ip/open-shortest-path-first-ospf/7039-1.html

5
  • "OSPF neighbors need to be able to send and receive broadcast 'hello' packets to each other to begin establishing the neighbor adjacency" That really is not true. OSPF can use unicast to form neighborships. For example, you can connect OSPF neighbors on serial interfaces using HDLC, PPP, and frame relay, none of which support broadcast or multicast. You can even configure OSPF to use unicast on a broadcast medium such as ethernet. OSPF hellos do not need broadcast or multicast. OSPF uses DR/BDR on a broadcast medium, but not with unicast neighbors.
    – Ron Maupin
    Commented Apr 28, 2023 at 1:17
  • I thought I mentioned that... Uh, yeah I did. I didn't go into it since it didn't seem relevant to the question which seemed to imply a pretty simple setup which, to me, usually implies point to point Ethernet links between routers in modern use. But yeah, for non broadcast medium you can/must use unicast design where you list the neighbor IPs specifically. Or you can setup other options for some medium like sub-interfaces to simulate a kind of point to point design. Commented Apr 28, 2023 at 2:12
  • With point-to-point ethernet (or even a small number of routers) on a broadcast medium, it may be good to simply connect routers with unicast rather than using multicast and DR/BDR.
    – Ron Maupin
    Commented Apr 28, 2023 at 2:17
  • "a direct point-to-point link between the 2 neighbor devices" - does OSPF not run on multipoint networks like Ethernet? I could've sworn it did Commented Apr 28, 2023 at 17:38
  • It does, and that is where you would need to specify neighbor configuration with unicast instead of using broadcast to allow it to build DR/BDR style adjacencies on its own. Though you can have point to point via Ethernet as well. It just depends on the design of the network. I would say that it is most commonly (at least in recent years) done with direct Ethernet point to point links via fiber, though in some circles overlay networks and similar remove some of the need for OSPF and similar solutions. Commented Apr 28, 2023 at 20:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.