OSPF network command is confusing
kacper
Member Posts: 7 ■□□□□□□□□□
in CCNA & CCENT
If I understood it correctly the ospf network command does two things.
A command of network 17.16.0.1 0.0.0.0 area 1 does that mean that ospf neighbors will only have a route to 17.16.0.1 and not to 17.16.0.2 or 17.16.0.254?
I tested this in my lab and it seem that 17.16.0.0 was added the routing table. This is very confusing. I would have thought that network 17.16.0.0 0.0.0.0 area 1 would accomplish that.
- What interface to send HELLO packets on
- What networks to advertise to our neighbors
A command of network 17.16.0.1 0.0.0.0 area 1 does that mean that ospf neighbors will only have a route to 17.16.0.1 and not to 17.16.0.2 or 17.16.0.254?
I tested this in my lab and it seem that 17.16.0.0 was added the routing table. This is very confusing. I would have thought that network 17.16.0.0 0.0.0.0 area 1 would accomplish that.
Comments
-
bdepak.003 Member Posts: 16 ■□□□□□□□□□The Command "network 17.16.0.1 0.0.0.0 area 1" will take only 17.16.0.1 (it just specifies the host) because in wildcard bit concept 0 = Match (include) and 255 = ignore (any thing), so if you check in routing table, it shows default network address 172.16.0.0.
If you want to route 172.16.0.2, you can add in same way "network 17.16.0.2 0.0.0.0 area 1".
If you wish to know more about this command OSPF Network Command | Just another CCIE
Hope this will be useful to you. -
kacper Member Posts: 7 ■□□□□□□□□□Am I correct in assuming that when OSPF adds a route to say 17.16.0.1 they neightbor will be able to route to any host in the 17.16.0.0 subnet?
-
networker050184 Mod Posts: 11,962 ModThe network command only tells OSPF what interfaces to include in the process. It does not tell the process what network and mask to advertise.
For instance if you had the following interface:
FastEthernet0/1
ip address 10.0.0.1 255.0.0.0
And used the OSPF network statement:
router ospf 1
network 10.0.0.1 0.0.0.0 area 0
The router would include the f0/1 interface in the OSPF process and build an LSA for 10.0.0.0/8. The network command is for matching interfaces only.An expert is a man who has made all the mistakes which can be made. -
iamme4eva Member Posts: 272What networker said. ^^^
The actual network that will be advertised is based on the subnet mask of the interface that the network statement matched.
So on the opposite end of the scale, a really open network statement would still only match the interface - i.e:
interface FastEthernet0/1
ip address 10.2.3.4 255.255.255.0
router ospf 1
network 10.0.0.0 0.255.255.255 area 0
The network advertisement would be 10.2.3.0/24, because that's what the interface is, and the interface was matched by the network statement.Current objective: CCNA Security
My blog: mybraindump.co.uk -
theodoxa Member Posts: 1,340 ■■■■□□□□□□For all routing protocols that I've run into so far (RIP, EIGRP, OSPF) [except BGP, which can ignore for the time being] the network command specifies what interfaces to include in the routing process. By default, any interface that matches a network command will send updates and any networks directly connected to that interface will be advertised. If you want to advertise a network off of Fa0/0, but not send updates out Fa0/0 [because there are no other routers off Fa0/0]
R1(config)#router ospf 1
R1(config-router)#network 192.168.24.0 0.0.0.255 area 0
R1(config-router)#passive-interface Fa0/0
This will prevent the formation of adjacencies on the specified interface, but will still advertise the network directly connected to that interface.
OSPF also supports another way of specifying interfaces that will participate. Unfortunately, this method is not supported in Packet Tracer [last time I checked] and the network command is still Cisco's preferred method and what you will likely be tested on.
R1(config)#interface Fa0/0
R1(config-if)#ip ospf 1 area 0
This would explicitly specify that OSPF should run on Fa0/0 for Area 0.R&S: CCENT → CCNA → CCNP → CCIE [ ]
Security: CCNA [ ]
Virtualization: VCA-DCV [ ]