10-02-2021 12:55 AM - edited 10-02-2021 12:57 AM
I'm currently studying for my CCNA and just had a little bit of confusion when it comes to OSPF and setting it up.
Here would be the scenario
10.16.0.10/24 10.16.0.0/24 172.168.1.1/29 10.16.8.0/24 10.16.8.10/24
PC1 <-----> Router1 <------> Router 2 <----> Router 3 <----> PC2
Sorry if this doesn't have all the info in regards to connectivity, but I can tell you that PC1 and PC2 can ping each other with no issues.
My question is, if I configure the Routers with these ospf statements
R1: network 10.0.0.0 0.255.255.255 area 0
R3: network 10.0.0.0 0.255.255.255 area 0
How does OSPF not get confused into where to route the traffic? If I break down the ospf statements as I understand it:
R1 is saying "I can route any network whose first octet is 10 since my wildcard mask is set to 0 on the first octet"
R2 is saying the same thing.
Why do these statements not conflict? Is it because of the CEF table and the routers knowing which hosts it is connected to? Or could these statement possibly conflict with each other if my network gets big enough?
Thank you in advance for helping me with my confusion!
Solved! Go to Solution.
10-02-2021 04:42 AM
Hello @willmaci ,
in OSPFv2 the network ..... area command tells to the router what interfaces should take part in the OSPF process.
So a statement like:
network 10.0.0.0 0.255.255.255 area 0
does not create a route 10.0.0.0/8 to be advertised to anyone.
The statement is used like an IP ACL and the router takes the list of currently configured L3 interfaces and if the address of the interface matches the network statement for example
interface gi0/0/0
ip address 10.12.255.128 255.255.255.128
this interface will be one where OSPF in area 0 will run and it will send out OSPF hellos and it will try to build OSPF neighborships over it.
To be noted that in any case the prefix associated to the interface will be advertised using the Router LSA as 10.12.255.128/25. Depending on the presence of neighobors or lack of them the link will be classified as a transit ( if other OSPF routers are out of it) or stub ( no OSPF neighbor is heard on it).
The capability to send/receive hellos and to build OSPF neighborships and adjacencies is influenced by the passive-interface command. if under the router ospf config we have a line like
passive-interface gi0/0/0
Only the associated prefix is advertised as a stub link and no Hellos are sent out and received hellos are silently discarded.
Finally, in Cisco implementation OSPF neighborships are built using the primary address
example:
int gi0/0/1
desc TEST
ip address 11.20.20.1 255.255.255.0
ip address 10.255.100.1 255.255.255.0 secondary
This interface can not build any OSPF adjacency. It may be able to advertise the secondary address or not.( I'm not sure it can as the primary addresss is out of network area scope)
In the following case
int gi0/0/2
ip address 10.40.40.1 255.255.255.0
ip address 10.160.40.1 255.255.255.0 secondary
in this case both subnets are advertised with the second one for sure is a stub and the first one depends if there are OSPF neighbors or not.
To be noted the source address of OSPF hellos will be 10.40.40.1 the primary address and only devices in the same subnet can become neighbors.
Hope to help
Giuseppe
10-02-2021 04:43 AM
Just to expand a bit on what Paul said.
With OSPF (and other IGPs) the "network ....." statement you configure is not telling the router what network to advertise to other routers, it is telling the router which interfaces to run OSPF on.
So when you configure "network 10.0.0.0 0.255.255.255 area 0" on your routers OSPF looks at each interface to see if the interface IP is in that network range and if it is it starts OSPF on that interface and sends advertisements for the interface subnet to other routers.
Note it is the interface subnet that is advertised ie. in your example router 1 would advertise 10.16.0.0/24 to router 2 and through to router 3 etc so only the specific subnets are advertised by each router.
I have mentioned router advertisements to keep it simple but be aware with OSPF it is actually LSAs that are being advertised.
Also worth mentioning that unlike IGPs above where the network statement tells the device which interfaces to run on with BGP the network statement does actually tell the device which networks to advertise.
Jon
10-02-2021 02:53 AM - edited 10-02-2021 03:02 AM
Hello
Basically, you are not advertising the whole 10.0.0.0/8 subnet what you saying with that ospf statement is that any active interfaces on this rrtr within this ip range can be enabled for ospf.
10-02-2021 04:42 AM
Hello @willmaci ,
in OSPFv2 the network ..... area command tells to the router what interfaces should take part in the OSPF process.
So a statement like:
network 10.0.0.0 0.255.255.255 area 0
does not create a route 10.0.0.0/8 to be advertised to anyone.
The statement is used like an IP ACL and the router takes the list of currently configured L3 interfaces and if the address of the interface matches the network statement for example
interface gi0/0/0
ip address 10.12.255.128 255.255.255.128
this interface will be one where OSPF in area 0 will run and it will send out OSPF hellos and it will try to build OSPF neighborships over it.
To be noted that in any case the prefix associated to the interface will be advertised using the Router LSA as 10.12.255.128/25. Depending on the presence of neighobors or lack of them the link will be classified as a transit ( if other OSPF routers are out of it) or stub ( no OSPF neighbor is heard on it).
The capability to send/receive hellos and to build OSPF neighborships and adjacencies is influenced by the passive-interface command. if under the router ospf config we have a line like
passive-interface gi0/0/0
Only the associated prefix is advertised as a stub link and no Hellos are sent out and received hellos are silently discarded.
Finally, in Cisco implementation OSPF neighborships are built using the primary address
example:
int gi0/0/1
desc TEST
ip address 11.20.20.1 255.255.255.0
ip address 10.255.100.1 255.255.255.0 secondary
This interface can not build any OSPF adjacency. It may be able to advertise the secondary address or not.( I'm not sure it can as the primary addresss is out of network area scope)
In the following case
int gi0/0/2
ip address 10.40.40.1 255.255.255.0
ip address 10.160.40.1 255.255.255.0 secondary
in this case both subnets are advertised with the second one for sure is a stub and the first one depends if there are OSPF neighbors or not.
To be noted the source address of OSPF hellos will be 10.40.40.1 the primary address and only devices in the same subnet can become neighbors.
Hope to help
Giuseppe
10-02-2021 10:12 PM
That cleared it up perfectly for me! I will definitely need to do some research on the secondary IP addresses and their functions. As well as what exactly a stub is (I'll research this on my own
I will have to test out your theory for:
int gi0/0/1
desc TEST
ip address 11.20.20.1 255.255.255.0
ip address 10.255.100.1 255.255.255.0 secondary
and see if OSPF advertises the second link or not.
Thank you very much for the detailed explanation!
10-02-2021 04:43 AM
Just to expand a bit on what Paul said.
With OSPF (and other IGPs) the "network ....." statement you configure is not telling the router what network to advertise to other routers, it is telling the router which interfaces to run OSPF on.
So when you configure "network 10.0.0.0 0.255.255.255 area 0" on your routers OSPF looks at each interface to see if the interface IP is in that network range and if it is it starts OSPF on that interface and sends advertisements for the interface subnet to other routers.
Note it is the interface subnet that is advertised ie. in your example router 1 would advertise 10.16.0.0/24 to router 2 and through to router 3 etc so only the specific subnets are advertised by each router.
I have mentioned router advertisements to keep it simple but be aware with OSPF it is actually LSAs that are being advertised.
Also worth mentioning that unlike IGPs above where the network statement tells the device which interfaces to run on with BGP the network statement does actually tell the device which networks to advertise.
Jon
10-02-2021 11:48 PM
Thank you very much Jon for the response. Just like Giuseepe's response I have a way better understanding of what OSPF is actually doing. Yeah I haven't gotten to BGP yet, but I know it is coming!
Also if you don't mind me digging a little deeper. My assumption then is with OSPF we could just advertise every single interface with a "network 0.0.0.0 255.255.255.255 area 0" statement on every single router but since you may not want to advertise certain routes, this would seem like a bad practice, does that sound correct to you?
Also thank you very much for the explanation!
10-03-2021 06:07 AM
Yes, that network statement would run OSPF on all interfaces on the router.
It's not necessarily bad practice if that is what you want to do but obviously you have to bear in mind any other interfaces you may bring up later on would also automatically run OSPF on them.
I tend to be more specific in my network statements but as I say nothing wrong using that as long as you understand what it is doing.
Jon
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: