Advertising loopback network as /24 instead of /32 in OSPF?
FrankGuthrie
Member Posts: 245
in CCNP
Ok, I know how to advertise a loopback as a /24 into an OSPF area. This is done by using the command #ip opsf network point-to-point
I'm wondering how the /32 is now made into a /24 network. I don't understand how this can change by changing the network to point to point. Why is it advertised as a /24 as opposed to a /32.
What is the logic behind it?
I'm wondering how the /32 is now made into a /24 network. I don't understand how this can change by changing the network to point to point. Why is it advertised as a /24 as opposed to a /32.
What is the logic behind it?
Comments
-
OfWolfAndMan Member Posts: 923 ■■■■□□□□□□IP ospf point-to-point has nothing to do with advertising a loopback. You use the network [network] [mask] command to advertise a network. IP ospf network [type] is used to manually define an interface's network type.:study:Reading: Lab Books, Ansible Documentation, Python Cookbook 2018 Goals: More Ansible/Python work for Automation, IPSpace Automation Course [X], Build Jenkins Framework for Network Automation []
-
FrankGuthrie Member Posts: 245Well, when I advertise a /24 loopback using the network command in OSPF, it is automatically converted to /32. To negate this I used the piont-to-point command.
-
deth1k Member Posts: 312loopback is also considered a network type in OSPF and expected to have a /32 mask, so to change this behavior we configure it with point to point NT. When we change NT to p2p (note it's only one that is supported for loopback interface), network mask is preserved:
R4#sh ip ospf int brie
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 0 150.1.4.4/24 1 LOOP 0/0
R4#
R4#sh ip ospf int
Loopback0 is up, line protocol is up
Internet Address 150.1.4.4/24, Area 0, Attached via Network Statement
Process ID 1, Router ID 150.1.4.4, Network Type LOOPBACK, Cost: 1
Topology-MTID Cost Disabled Shutdown Topology Name
0 1 no no Base
Loopback interface is treated as a stub Host
R4#sh ip ospf data router 150.1.4.4
OSPF Router with ID (150.1.4.4) (Process ID 1)
Router Link States (Area 0)
LS age: 14
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 150.1.4.4
Advertising Router: 150.1.4.4
LS Seq Number: 80000003
Checksum: 0xDB75
Length: 36
Number of Links: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 150.1.4.4
(Link Data) Network Mask: 255.255.255.255
Number of MTID metrics: 0
TOS 0 Metrics: 1
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int lo0
R4(config-if)#ip ospf network point-to-point
R4(config-if)#end
R4#sh ip ospf database router 150.1.4.4
OSPF Router with ID (150.1.4.4) (Process ID 1)
Router Link States (Area 0)
LS age: 142
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 150.1.4.4
Advertising Router: 150.1.4.4
LS Seq Number: 80000005
Checksum: 0xAFA3
Length: 36
Number of Links: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 150.1.4.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1 -
OfWolfAndMan Member Posts: 923 ■■■■□□□□□□Ahh my bad I see your question now. +1 to deth1k.:study:Reading: Lab Books, Ansible Documentation, Python Cookbook 2018 Goals: More Ansible/Python work for Automation, IPSpace Automation Course [X], Build Jenkins Framework for Network Automation []
-
FrankGuthrie Member Posts: 245Hi deth1k
Thank you. But I'm still not clear as to why it is converted to /24. What makes it on a point to point link that OPSF preserves the /24 . -
Fitzi Member Posts: 40 ■■■□□□□□□□I'm not sure I am following your question. Are you asking: why is the loopback address now advertised as a /24 after you use the ip ospf point-to-point command?
I would think this is because you have the netmask configured as a /24 on your loopback interface and it is now advertising the complete prefix and mask.
According to this link:
OSPF: Frequently Asked Questions - CiscoQ. Why are loopbacks advertised as /32 host routes in OSPF?
A. Loopbacks are considered host routes in OSPF, and they are advertised as /32. For more information, refer to section 9.1 of RFC 2328. In Cisco IOS Software Releases 11.3T and 12.0, if the ip ospf network point-to-point command is configured under loopbacks, OSPF advertises the loopback subnet as the actual subnet configured on loopbacks. -
FrankGuthrie Member Posts: 245Are you asking: why is the loopback address now advertised as a /24 after you use the ip ospf point-to-point command?
I would think this is because you have the netmask configured as a /24 on your loopback interface and it is now advertising the complete prefix and mask.
According to this link:
OSPF: Frequently Asked Questions - Cisco
Yes,that exactly what I'm asking. Nobody seems to be able to explain that to me.
Everyone is showing me this output, but I have labbed this and I understand the output.
No one seems to awnser the real question: Why does configuring te Loopback as point to point, preserve the /24? what is it on a point to point link that presererves the /24. -
Fitzi Member Posts: 40 ■■■□□□□□□□The last line I quoted tells you why. It's just the command that stops OSPF advertising the loopback address as a host route, a loopback interface is not a point to point link it's a software interface on the router. This has nothing to do with point to point links in the general sense.
The point to point command just tells ospf to advertise the actual address and mask that you have assigned the loopback interface. -
fredrikjj Member Posts: 879FrankGuthrie wrote: »Yes,that exactly what I'm asking. Nobody seems to be able to explain that to me.
Everyone is showing me this output, but I have labbed this and I understand the output.
No one seems to awnser the real question: Why does configuring te Loopback as point to point, preserve the /24? what is it on a point to point link that presererves the /24.
You don't know enough OSPF if you are asking these questions. At the very minimum you need to read up on the link state database and the Router LSA. There's obviously nothing wrong with asking questions, necessarily, but it does seem like you focus too much on small little details instead of learning about the big picture. Once you have a better grasp of OSPF, questions like this one will simply answer themselves.
Additionally, deth1k has answered the question on how OSPF handles this from a LSDB perspective. The answers anyone here can provide will mostly be centered around how a protocol works, not why the designers decided to pick one way of doing something over another. -
FrankGuthrie Member Posts: 245There's obviously nothing wrong with asking questions, necessarily, but it does seem like you focus too much on small little details instead of learning about the big picture. Once you have a better grasp of OSPF, questions like this one will simply answer themselves.
Additionally, deth1k has answered the question on how OSPF handles this from a LSDB perspective. The answers anyone here can provide will mostly be centered around how a protocol works, not why the designers decided to pick one way of doing something over another.
Don't agree at all with what you've said. I think it make me a better engineer to understand the details. I'm actually questioning things. This is coming from the need to fully understand stuff.
I think that only focusing on the big picture is not smart at all. You also need to know about the details to fully understand OSPF and to troubleshoot etc...
I now got the awnser that it is used a a software tick so the loopback is advertised as /24. What's wrong with asking if it might have to do with a point to point link (Media)? I'm trying to understand why is is done. If it would have to do with the type of link, I would have learned something else. Now I know it's just a software config to get the /24 to be advertised as /24. -
lrb Member Posts: 526FrankGuthrie, if you check out 12.4.1 of RFC2328 it will tell you why this occurs. When in doubt, always check the RFCs! Get into the habit of doing this now and you will be golden moving into the IE space Before you even question why the proper netmask is advertised when you change the OSPF network type on a loopback interface, ask yourself why it was advertised as host route in the first place.
Consider the following output:
R2#sh ip o i br
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Fa0/1 1 0 1.0.2.2/24 10 DR 0/0
Lo0 1 0 20.20.20.2/24 1 LOOP 0/0
Fa0/0 1 0 1.0.0.2/24 10 DROTH 2/2
Why is interface Loopback0 in the state "LOOP"? If we look at the insterface FSM in the RFC we can see how it gets to this point.
[From Page 73]State(s): Any StateAnd once we are in the LOOP state, this is what should happen:
Event: LoopInd (this is an internal event raised by IOS when OSPF is started on a Loopback interface)
New state: Loopback
Action: Since this interface is no longer connected to the
attached network the actions associated with the
above InterfaceDown event are executed.
[From Page 66]Loopback
In this state, the router's interface to the network is
looped back. The interface may be looped back in hardware
or software. The interface will be unavailable for regular
data traffic. However, it may still be desirable to gain
information on the quality of this interface, either through
sending ICMP pings to the interface or through something
like a bit error test. For this reason, IP packets may
still be addressed to an interface in Loopback state. To
facilitate this, such interfaces are advertised in router-
LSAs as single host routes, whose destination is the IP
interface address.
And because Loopback 0 is considered a "link" in OSPF terms, it must be included R2s router LSA right? Following the theme of "from the RFCs", check out how the router LSAs are constructed for each interface in each area running OSPF:
[From Page 128]For each interface, the following steps are taken:
o If the attached network does not belong to Area A, no
links are added to the LSA, and the next interface
should be examined.
o If the state of the interface is Down, no links are
added.
o If the state of the interface is Loopback, add a Type 3
link (stub network) as long as this is not an interface
to an unnumbered point-to-point network. The Link ID
should be set to the IP interface address, the Link Data
set to the mask 0xffffffff (indicating a host route),
and the cost set to 0.
o Otherwise, the link descriptions added to the router-LSA
depend on the OSPF interface type. Link descriptions
used for point-to-point interfaces are specified in
Section 12.4.1.1, for virtual links in Section 12.4.1.2,
for broadcast and NBMA interfaces in 12.4.1.3, and for
Point-to-MultiPoint interfaces in 12.4.1.4.
If you are particularly interested you can go read sections 12.4.1.1 through to 12.4.1.4 but I think this should give you enough detail as to why IOS/XR advertise the Loopback interface as host routes by default inside the router LSAs. -
creamy_stew Member Posts: 406 ■■■□□□□□□□FrankGuthrie, if you check out 12.4.1 of RFC2328 it will tell you why this occurs. When in doubt, always check the RFCs! Get into the habit of doing this now and you will be golden moving into the IE space Before you even question why the proper netmask is advertised when you change the OSPF network type on a loopback interface, ask yourself why it was advertised as host route in the first place.
<snip>
If you are particularly interested you can go read sections 12.4.1.1 through to 12.4.1.4 but I think this should give you enough detail as to why IOS/XR advertise the Loopback interface as host routes by default inside the router LSAs.
Well, that shut him up