OSPF networks

Hello,
why are the networks we add in OSPF shared to other routers?

configuration of the following instance:

/routing ospf instance> print 
name="default" 
router-id=10.255.255.2 
distribute-default=never 
redistribute-connected=no 
redistribute-static=no 
redistribute-rip=no 
redistribute-bgp=no 
redistribute-other-ospf=no 
metric-default=1 
metric-connected=20 
metric-static=20 
metric-rip=20 
metric-bgp=auto 
metric-other-ospf=auto 
in-filter=ospf-in 
out-filter=ospf-out

What is listed under OSPF Networks ?

[admin@R1] /routing ospf network> print
Flags: X - disabled, I - invalid 
 #   NETWORK            AREA                                                     
 0   192.168.150.248/29 area1                                                    
 1   192.168.100.128/25 area1



[admin@R2] /routing ospf network> print
Flags: X - disabled, I - invalid 
 #   NETWORK            AREA                                                     
 0   192.168.150.248/29 area1                                                    
 1   192.168.250.248/29 backbone



[admin@R1] /routing ospf route> print
 # DST-ADDRESS        STATE          COST          GATEWAY         INTERFACE    
 0 192.168.100.128/25 intra-area     10            0.0.0.0         b-vlan100     
 1 192.168.150.248/29 intra-area     10            0.0.0.0         b-vlan150    
 2 192.168.250.248/29 inter-area     20            192.168.150.252 b-vlan150



[admin@R2] /routing ospf route> print
 # DST-ADDRESS        STATE          COST          GATEWAY         INTERFACE     
 0 192.168.100.128/25 intra-area     20            192.168.150.250 b-vlan150     
 1 192.168.150.248/29 intra-area     10            0.0.0.0         b-vlan150    
 2 192.168.250.248/29 intra-area     10            0.0.0.0         b-vlan250

Why network 192.168.250.248/29 appear on the router1?
Why network 192.168.100.128/25 appear on the router2?

The purpose of OSPF is to exchange routes between routers, so OSPF is doing exactly what it was designed to do. :slight_smile:

R1 is learning 192.168.250.248/29 from R2 via OSPF
R2 is learning 192.168.100.128/25 from R1 via OSPF

Is this not what you wanted to happen?

So what are these settings for? Since they are in “no” were not supposed to not share?

distribute-default=never 
redistribute-connected=no  
redistribute-other-ospf=no

When the subnet is added to ‘ospf network’ it will advertise the prefix

Ok, thanks!

If you would like 192.168.250.248/29 not to appear on router 1 you need move this network on router to into it’s own area so that it is not passed as a backbone area would be.
If you would like 192.168.100.128/25 not to appear on router 2 you should not put it in area1 as you defined area 1 on both routers.
What routes are you wanting to be passed between the two routers?

Thank you.
I’ve already tested what you said, and it worked. Thanks.
This doubt arose, since before they were allowed to share routes, they were already shared. However, it has already been explained that when I add a subnet to “OSPF networks” this will share its prefix.

good news.