OSPF network command

altjxaltjx Posts: 194Member
I'm only curious about something. Does these two commands advertise the same thing on an OSPF network?
network 10.1.2.0 0.0.0.3 area 0
and
network 10.1.2.2 0.0.0.0 area 0

I see on this Boson exam environment, there's a router that's configured with the second command, and it advertises perfectly. What does the OSPF router advertise when the IP address is so specific like the second one?
CompTIA: A+, Security+, Network+
Microsoft: MCTS: Windows 7, Configuring, MCTS: Windows Server 2008 Applications Infrastructure, Configuring
Cisco: CCENT, CCNA

Comments

  • jude56gjude56g Senior Member Posts: 107Member ■■■□□□□□□□
    altjx wrote: »
    I'm only curious about something. Does these two commands advertise the same thing on an OSPF network?
    network 10.1.2.0 0.0.0.3 area 0
    
    and
    network 10.1.2.2 0.0.0.0 area 0
    

    I see on this Boson exam environment, there's a router that's configured with the second command, and it advertises perfectly. What does the OSPF router advertise when the IP address is so specific like the second one?

    network 10.1.2.0 0.0.0.3 area 0 advertises the /30 network (10.1.2.0 thru 10.1.2.4)

    where as

    network 10.1.2.2 0.0.0.0 area 0 advertises the /32, the specific host of 10.1.2.2

    hope this helps.
  • nelnel Posts: 2,859Member ■□□□□□□□□□
    its as the OP says, one covers a range, the other a specific interface IP.

    My preference is the specific /32 IP. Gives me more control of what should and shouldnt be enabled.
    Xbox Live: Bring It On

    Bsc (hons) Network Computing - 1st Class
    WIP: Msc advanced networking
  • altjxaltjx Posts: 194Member
    Thanks for feedback, but for exam purposes, is it safe to always use the /32?

    I mean in a huge network, using either command should advertise properly, correct?
    CompTIA: A+, Security+, Network+
    Microsoft: MCTS: Windows 7, Configuring, MCTS: Windows Server 2008 Applications Infrastructure, Configuring
    Cisco: CCENT, CCNA
  • jude56gjude56g Senior Member Posts: 107Member ■■■□□□□□□□
    altjx wrote: »
    Thanks for feedback, but for exam purposes, is it safe to always use the /32?

    I mean in a huge network, using either command should advertise properly, correct?

    It really depends what your trying to do. Are you trying to advertise a single IP or the /30 network?
  • altjxaltjx Posts: 194Member
    jude56g wrote: »
    It really depends what your trying to do. Are you trying to advertise a single IP or the /30 network?

    Well, I think I'm wording this correctly. But let's say I have a router with FA0/0 192.168.1.1 /24..

    Would it be necessary to advertise as "network 192.168.1.0 0.0.0.255 area 0" or "network 192.168.1.1 0.0.0.0 area 0"?
    CompTIA: A+, Security+, Network+
    Microsoft: MCTS: Windows 7, Configuring, MCTS: Windows Server 2008 Applications Infrastructure, Configuring
    Cisco: CCENT, CCNA
  • jude56gjude56g Senior Member Posts: 107Member ■■■□□□□□□□
    altjx wrote: »
    Well, I think I'm wording this correctly. But let's say I have a router with FA0/0 192.168.1.1 /24..

    Would it be necessary to advertise as "network 192.168.1.0 0.0.0.255 area 0" or "network 192.168.1.1 0.0.0.0 area 0"?

    The proper statement would be "network 192.168.1.0 0.0.0.255 area 0"
  • altjxaltjx Posts: 194Member
    jude56g wrote: »
    The proper statement would be "network 192.168.1.0 0.0.0.255 area 0"

    Gotcha. Thanks!
    CompTIA: A+, Security+, Network+
    Microsoft: MCTS: Windows 7, Configuring, MCTS: Windows Server 2008 Applications Infrastructure, Configuring
    Cisco: CCENT, CCNA
  • altjxaltjx Posts: 194Member
    Wow... according to another test sim, the proper way is network 10.1.2.2 0.0.0.0 area 0 for a LAN that has the 10.1.2.0/24 subnet assigned... Omg wtf!

    I understand that 10.1.2.2 is the IP address assigned to its LAN interface, but why is the network 10.1.2.2 0.0.0.0 area 0 command required instead of network 10.1.2.0 0.0.0.255 area 0?? that's so confusing!
    CompTIA: A+, Security+, Network+
    Microsoft: MCTS: Windows 7, Configuring, MCTS: Windows Server 2008 Applications Infrastructure, Configuring
    Cisco: CCENT, CCNA
  • alxxalxx Posts: 755Member
    not directly related but interesting
    Black Hat: Routers using OSPF open to attacks
    Goals CCNA by dec 2013, CCNP by end of 2014
  • pham0329pham0329 Posts: 556Member
    altjx wrote: »
    Wow... according to another test sim, the proper way is network 10.1.2.2 0.0.0.0 area 0 for a LAN that has the 10.1.2.0/24 subnet assigned... Omg wtf!

    I understand that 10.1.2.2 is the IP address assigned to its LAN interface, but why is the network 10.1.2.2 0.0.0.0 area 0 command required instead of network 10.1.2.0 0.0.0.255 area 0?? that's so confusing!

    It depends on what you want to do. If you want to enable OSPF on any interface that starts with 10.1.2.0, then you would use your method. However, it's generally best practice to use a 0.0.0.0 mask to avoid any confusion, and to prevent any unwanted interface from running OSPF.
  • altjxaltjx Posts: 194Member
    alxx wrote: »
    not directly related but interesting
    Black Hat: Routers using OSPF open to attacks

    Interesting article. Thank you :D I'm actually in IT Security so this is pretty good knowledge
    CompTIA: A+, Security+, Network+
    Microsoft: MCTS: Windows 7, Configuring, MCTS: Windows Server 2008 Applications Infrastructure, Configuring
    Cisco: CCENT, CCNA
  • SharkDiverSharkDiver Posts: 844Member
    jude56g wrote: »
    network 10.1.2.0 0.0.0.3 area 0 advertises the /30 network (10.1.2.0 thru 10.1.2.4)

    Just a small correction.
    The subnet would actually only cover 10.1.2.0 thru 10.1.2.3

    A cool tip that I learned in the CCNP Route material is that you can add the network to the wildcard mask to find the range.

    Examples:
    10.1.2.0 0.0.0.3 = 10.1.2.0 thru 10.1.2.3
    192.168.1.0 0.0.0.15 = 192.168.1.0 thru 192.168.1.15
    172.16.10.0 0.0.0.31 = 172.16.10.0 thru 172.16.10.31

    It even works on non-zero networks.
    172.16.10.64 0.0.0.31 = 172.16.10.64 thru 172.16.10.95
  • altjxaltjx Posts: 194Member
    SharkDiver wrote: »
    jude56g wrote: »
    network 10.1.2.0 0.0.0.3 area 0 advertises the /30 network (10.1.2.0 thru 10.1.2.4)

    Just a small correction.
    The subnet would actually only cover 10.1.2.0 thru 10.1.2.3

    A cool tip that I learned in the CCNP Route material is that you can add the network to the wildcard mask to find the range.
    Examples:
    10.1.2.0 0.0.0.3 = 10.1.2.0 thru 10.1.2.3
    192.168.1.0 0.0.0.15 = 192.168.1.0 thru 192.168.1.15
    172.16.10.0 0.0.0.31 = 172.16.10.0 thru 172.16.10.31

    It even works on non-zero networks.
    172.16.10.64 0.0.0.31 = 172.16.10.64 thru 172.16.10.95

    Very interesting man. I thought of something like this similar too when I was reading it. It made perfect sense, but I just didn't want to get confused. But I guess I wasn't the only one, lol. This will be very helpful! Thank you! This will save me a lot of seconds (which means a lot on CCNA exam I presume)
    CompTIA: A+, Security+, Network+
    Microsoft: MCTS: Windows 7, Configuring, MCTS: Windows Server 2008 Applications Infrastructure, Configuring
    Cisco: CCENT, CCNA
  • jude56gjude56g Senior Member Posts: 107Member ■■■□□□□□□□
    pham0329 wrote: »
    It depends on what you want to do. If you want to enable OSPF on any interface that starts with 10.1.2.0, then you would use your method. However, it's generally best practice to use a 0.0.0.0 mask to avoid any confusion, and to prevent any unwanted interface from running OSPF.

    This is pretty interesting, I have never seen a configuration like that. I have always used the inverse mask that matched the subnet on the interface in question.

    I'll have to lab this out to confirm, but I think if you advertise 10.2.2.2 0.0.0.0 area 0, the other routers in area 0 will only add the /32 to their routing table as opposed to the entire /24 network. So the router that receives this update will have a route to 10.2.2.2/32 but not to the other addresses in the /24.

    Any thoughts on my theory? icon_confused.gif:
  • SharkDiverSharkDiver Posts: 844Member
    The network statement only decides which interfaces to enable for OSPF and which area to place them in, not what is advertised.

    As a shortcut, if you have a router and you want all of the interfaces OSPF enabled and placed into area 0, you can actually use this:

    R1(config-router)#network 0.0.0.0 255.255.255.255 area 0
  • pham0329pham0329 Posts: 556Member
    jude56g wrote: »
    This is pretty interesting, I have never seen a configuration like that. I have always used the inverse mask that matched the subnet on the interface in question.

    I'll have to lab this out to confirm, but I think if you advertise 10.2.2.2 0.0.0.0 area 0, the other routers in area 0 will only add the /32 to their routing table as opposed to the entire /24 network. So the router that receives this update will have a route to 10.2.2.2/32 but not to the other addresses in the /24.

    Any thoughts on my theory? icon_confused.gif:

    As SharkDriver said, the network command only determines what interface is actively participating in OSPF. The actual network advertised is the one assigned to that interface.

    When you lab this out, make sure that if you're advertising a loopback, you change the OSPF network type on the loopback or else it will advertise a /32 no matter what you do.
Sign In or Register to comment.