cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
264
Views
0
Helpful
8
Replies
Beginner

OSPF Network Command Confusion

Hi there,

I am having a problem to understand the exact role of the network command under the OSPF process, I am talking about OSPF V.2 here.

 

I understand that network statement is NOT used to advertise networks but it is used to enable OSPF on an interface.

 

So for example if I have the attached setup.

 

And on router B I want to advertise network 10.3.5.2/16 to router A and I made the following command on Router B under the ospf process.

 

RouterB(config)# network 10.3.5.2 0.0.255.255 Area 0

 

In this case, will router A see also the network 10.4.5.2/16 since it is directly connected on Router B?

 

And in case Router A will not see network 10.4.5.2/16 and I need this network to be reachable to router A, then should I configure the network command on Router B for the network 10.4.5.2/16 ? But at the same time I don't want Router B & Router C to become neighbors or adjacent.

 

Will appreciate your help please, thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Hall of Fame Master

Re: OSPF Network Command Confusion

There are several aspects of the original post that need some clarification. The post mentions network statements on router B but has nothing about network statements on router A or C.

 

The post says that router B wants to advertise 10.3.5.2 to router A. But that network connects router B and A. Since it is a connected network router A will already know about the network and the advertisement from router B is superfluous. Also the post does not specify whether router A has a network statement that includes network 10.3.0.0. If router A does have a network statement including that network then A and B will become OSPF neighbors. If router A does not have such a network statement then the routers will not become neighbors and A will not learn anything from B.

The post then talks about network 10.4.5.2, which connects B and C. If there is no network statement on B for that network then B will not advertise it to A and A will not know about that network (unless there might be a static route on A for that network).

The post then states that they do not want B and C to be neighbors or adjacent. But there is no indication of whether C has a network statement for 10.4.0.0. If C has no network statement for the network then certainly the routers will not become neighbors or adjacent. If C does have a network statement for the network then making the interface passive in OSPF on B will prevent the routers from becoming neighbors or adjacent.

 

HTH

 

Rick

8 REPLIES 8
Advocate

Re: OSPF Network Command Confusion

Hi @Network Digger 

 

In routing protocols, the network command indicates to the protocol the interfaces (networks) that participate and are shared.

Therefore, if you want Router A to learn Router B networks, you must first enable, on router A, the interface (netrwork) that connects to Router B.

Router A

network 10.1.5.0 0.0.255.255 area 0

network 10.3.5.0 0.0.255.255 area 0

 

Router B

network 10.3.5.0 0.0.255.255 area 0

network 10.4.5.0 0.0.255.255 area 0

 

With these commands, router A will know its connected networks and the 10.4.5.0/16 network connected to router B. In addition, router B will know its connected networks and the 10.1.5.0/16 network connected to router A

If you do not enable any interface (network) on router C, it will not achieve adjacency and will only know directly connected networks.

Regards

 

VIP Advisor

Re: OSPF Network Command Confusion

Hello

The network statement is used to identify connected host within the subnet it resides in - infact its best practice to use the most specific network statement you can.

 

example:
int x/x
ip address 1.1.1.1 255.255.255.0

exit


router ospf 1

network 1.1.1.1. 0.0.0.0 area x  instead network 1.1.1.0 0.0.0.255 area 0

Lastly newer software allows you to enable ospf direct on the interface so you dont even have to use the network command. and in ospf3 you have to enable ospf on the interface.

 

int x/x
ip ospf 1 area x

ospfv3 1 ipv6 area x

 

 



kind regards
Paul

Please rate and mark posts accordingly if you have found any of the information provided useful.
It will hopefully assist others with similar issues in the future

Re: OSPF Network Command Confusion

If you enable the interfaces with network the adjacent routers will become neighbors and as result the network id's are propagated by the protocol, but if you dont want B & C to become neighbors you can use the passive-interface to not send messages to specific interfaces. Also the other end needs to have the network command and ospf process to create an adjacency.

Regards,
VIP Expert

Re: OSPF Network Command Confusion

The OSPF v2 network statement works like an ACL. An interface IP that matches is included.

You can have overlapping IP address block network statements. 1st match "wins". I recall on later IOSs, network statements are auto sequenced by how specific they are too.
Highlighted
Hall of Fame Master

Re: OSPF Network Command Confusion

There are several aspects of the original post that need some clarification. The post mentions network statements on router B but has nothing about network statements on router A or C.

 

The post says that router B wants to advertise 10.3.5.2 to router A. But that network connects router B and A. Since it is a connected network router A will already know about the network and the advertisement from router B is superfluous. Also the post does not specify whether router A has a network statement that includes network 10.3.0.0. If router A does have a network statement including that network then A and B will become OSPF neighbors. If router A does not have such a network statement then the routers will not become neighbors and A will not learn anything from B.

The post then talks about network 10.4.5.2, which connects B and C. If there is no network statement on B for that network then B will not advertise it to A and A will not know about that network (unless there might be a static route on A for that network).

The post then states that they do not want B and C to be neighbors or adjacent. But there is no indication of whether C has a network statement for 10.4.0.0. If C has no network statement for the network then certainly the routers will not become neighbors or adjacent. If C does have a network statement for the network then making the interface passive in OSPF on B will prevent the routers from becoming neighbors or adjacent.

 

HTH

 

Rick

VIP Advocate

Re: OSPF Network Command Confusion

Hi,

As everyone is mentioned that "Network" command is enabling OSPF on the particular interface and start sending and listing the OSPF Multicast (224.0.0.5) packet.  If neighbor router will also sending and receiving this same Multicast packet then both routers will start the process to a neighbor (here many other requirements must match, I am not including here). 

As you mentioned that 

Spoiler

And on router B I want to advertise network 10.3.5.2/16 to router A and I made the following command on Router B under the ospf process.

 

RouterB(config)# network 10.3.5.2 0.0.255.255 Area 0

Then Router B will start listing and sending OSPF Hello packets on the interface S/0 but if you didn't configure the same command on the Router A then nothing will happen. If this command has configured on Router A as well then it will start the process for Neighborship and adjacency.

 

In this case, will router A see also the network 10.4.5.2/16 since it is directly connected on Router B?

Ans: By default not. Router A will not see (learn route) the 10.4.5.2/16 because you didn't advertise or added in the OSPF to the particular interface or subnet. If Router A and B are the finished adjacency (means shared OSPF routing table) and you added 10.4.5.2/16 subnet also in the OSPF routing table as with "Network" or "Redistribution" statement then it will only learned by router A.

 

Basic fundamentals of Dynamic routing table as If you added any subnet or interface in the Routing table of particular routing table as OSPF then it will only share with the it's neighbor/adjacent router. 

 

 

Regards,
Deepak Kumar,
Don't forget to vote and accept the solution If this comment will make help you!
Beginner

Re: OSPF Network Command Confusion

Thank you all, it is much clearer now

Hall of Fame Master

Re: OSPF Network Command Confusion

You are welcome. Thank you for marking this question as solved. This will help other participants in the community to identify discussions which have helpful information.

 

HTH

 

Rick

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards