12-27-2004 08:11 PM - edited 03-02-2019 08:47 PM
Can someone explain to me the logic behind the way OSPF handles loopback interfaces? BTW, this is using 12.2(17a).
If you include a loopback interface in an OSPF process, it gets advertised as a stub host. For example, if my loopback interface has ip address 192.168.96.1 255.255.255.0, it is advertised as 192.168.96.1/32. I can sort of see the logic to this: you might want to give all your routers host addresses in the same subnet. To change this behavior, the command is ip ospf network point-to-point, then it gets advertised as /24. I don't understand why the choice of that command; the words command does not seem to reflect what it actually does.
Also, I am puzzled by the way show ip route n.n.n.n behaves on an adjacent router for such a loopback. With the ip ospf network point-to-point, the route shows up on an adjacent router, complete with its OSPF details:
Chardin# show ip route 192.168.49.0
Routing entry for 192.168.49.0/24
Known via "ospf 20", distance 110, metric 65, type intra area
Last update from 192.168.20.2 on Serial0/0.2, 00:00:05 ago
Routing Descriptor Blocks:
* 192.168.20.2, from 192.168.96.1, 00:00:05 ago, via Serial0/0.2
Route metric is 65, traffic share count is 1
Without the ip ospf network point-to-point in place, the route shows up on the adjacent router with no OSPF details:
Chardin# show ip route 192.168.49.0
Routing entry for 192.168.49.0/32, 1 known subnets
O 192.168.49.1 [110/65] via 192.168.20.2, 0:11:33, Serial0/0.2
Why no details?
Unexpected behavior of the RID. If the RID is based on a loopback, say lo96 with address 192.168.96.1, then I destroy the lo96 interface and create a different one with a different address, the OSPF process does not even blink - it carries on being 192.168.96.1. Even if I clear ip ospf 30 process, the adjacencies get reset, but it still keeps the old RID. If I think it through, I guess I am not surprised; you don't want the RIDs changing too often. But it does not seem to agree with Jeff Doyle's book, bottom of page 524.
Could anyone comment on these observations?
Kevin Dorrell
Luxembourg
Solved! Go to Solution.
12-28-2004 06:14 AM
The fact that a /32 is used on a loopback interface is only common sense. In most cases, you do not need more than a host addresz on the loopback interface. Note that the default ospf network type for the loopback interface is "loopback", which causes this behavior. This is why you need to use "ip ospf network point-to-point" to change the default behavior. You shouldn't do it though unless you have a good reason to do so.
The behavior you get with "show ip route 192.168.49.0" is normal. The subnet you are trying to display is a /32, so try "show ip route 192.168.49.1" instead if you want detail information. "show ip route 192.168.49.0" only shows you a summary of the more specific subnets.
The best way to change the RID is actually to get rid of the ospf process altogether and then to reconfigure in the following way:
r2#wr mem
Building configuration...
[OK]
r2#config t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#no router ospf 1
r2(config)#end
r2#config mem
This is a good trick to remember for the CCIE lab.
Hope this helps,
12-27-2004 09:11 PM
Not familiar with the routing behaviour, so I can't comment on that. However, I have seen the RID issue.
We migrated from a public address scheme to a private address scheme. Many times the RID did not update after changing the loopback address and clearing the OSPF process. After several TAC cases, we learned that the only way to fix it was to reload the router. This happened on different platforms running different code levels mostly 12.1.
12-28-2004 06:14 AM
The fact that a /32 is used on a loopback interface is only common sense. In most cases, you do not need more than a host addresz on the loopback interface. Note that the default ospf network type for the loopback interface is "loopback", which causes this behavior. This is why you need to use "ip ospf network point-to-point" to change the default behavior. You shouldn't do it though unless you have a good reason to do so.
The behavior you get with "show ip route 192.168.49.0" is normal. The subnet you are trying to display is a /32, so try "show ip route 192.168.49.1" instead if you want detail information. "show ip route 192.168.49.0" only shows you a summary of the more specific subnets.
The best way to change the RID is actually to get rid of the ospf process altogether and then to reconfigure in the following way:
r2#wr mem
Building configuration...
[OK]
r2#config t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#no router ospf 1
r2(config)#end
r2#config mem
This is a good trick to remember for the CCIE lab.
Hope this helps,
12-29-2004 03:29 AM
Harold,
Thanks once again for the full and comprehensive reply to my question.
As you probably guessed, the loopback interface was /24 in order to generate O and IA routes for the lab exercise. I cannot think of any other good reason one would want to use more than a /32 on a loopback - perhaps there are others. In fact, by default, you can get the same effect by setting a /32 mask on the interface in the first place.
I tried the show ip route 192.168.49.1, and as you say, it gives me the full OSPF information. That is a useful fact to know, and helps me become more familiar with the behavior of the router, and the way the engineer's mind works. Thanks.
Thanks also for the tip about how to reset the RID. It is a workaround, but I tried it and it works, and is not much more disruptive than clear ip ospf 30 process (unless you mess up the order of steps, which I did first time I tried it - I removed the unwanted loopback before I saved, then wondered why it came back again, huh? - oh well, practice makes perfect).
Thanks once again.
Kevin Dorrell
Luxembourg
01-12-2005 09:43 AM
I am glad this thread was there. I am about to embark on a journey from static routes to OSPF, and have a few questions if you can answer them.
None of my routers have the loopback interface configured with an IP address. Yet, I have read in the OSPF information I dug out, that to give the loopback interface an IP, is very beneficial and also more stable. I have dug and dug on Cisco website to find out more about the loopback interface, but have not yet found anything to answer my questions.
What is the reason for the loopback interface outside of using it for loopback int test and loopback line test. What other circumstances besides OSPF is there for giving it an IP address? Have I been missing something all along?
Any information you can provide will be appreciated.
Susan
01-12-2005 10:29 AM
The reason you want to use a loopback address is that the interface is always up because it is a logical interface allowing for it not to depend on physical interfaces for it RID.
01-12-2005 11:16 AM
The Loopback interface IP address is also commonly used as an end-point for BGP, DLSW, GRE tunnels, RTR, etc. This ensures the sessions or IP connectivity will not be lost as long as their is an alterne path to that IP address, whereas if you use a physical interface IP address and the interface goes down you then lose IP connectivity.
Hope this helps,
01-12-2005 01:30 PM
Susan,
Having a loopback interface is quite beneficial to OSPF. It used to be even more so, but I'll tell you about that in a minute ...
OSPF is based on identifying routers and their links, and the router is identified by its RID, which is a 32-bit number that looks like an IP address. If you have loopback interfaces, the RID of the router is the highest IP address of these. If you have no loopback interfaces, then it takes the IP address of the highest "no shut" interface. If all of your interfaces are shut down, then the OSPF process doesn't start 'cos it can't get an RID. And if the OSPF doesn't start, all the config lines for OSPF will be marked as errors, and will not find their way into the running config. Having even one loopback address will ensure that the router can get an RID, so the OSPF can start regardless of the state of the physical interfaces.
Now, what happens if you have started the OSPF, and used the highest loopback address as the RID, and then you go and change or delete the IP address of the loopback. Well, the RID stays put. It was not always so; in earlier versions it used to change with the loopback interface, and every time that happened the whole area had to know about it.
Even worse, in those older versions, if you were basing the RID on an interface, and that interface had a hardware failure, or had to be shut down, then the RID would change, which would make the whole network reconverge. I think this has been fixed as well now, but at the time it was a good motivation for having an always-up loopback interface.
Some strange trivia I learned about loopback addresses wheîle I was playing with routers in the lab: 1) OSPF does not necessarily need to be running on an interface for its address to be used as the RID. 2) The loopback address does not necessarily have to be reachable from other routers; it is just an ID.
There's lots more, interesting stuff. I found the best book was "Routing TCP/IP" by Jeff Doyle.
Good luck with the migration.
Kevin Dorrell
Luxembourg
01-12-2005 03:38 PM
I'd like to thank everyone who offered up advice. I have read many of the things that were mentioned, A book by Steven Thomas also mentions the delima of the RID.
You have all reinforced that I have not missed anything through my travels of networking to this point, the loopback interface is for specific circumstances, such as OSPF that I have not yet worked with.
The migration shoudl go pretty well, it is frame-relay, the only exception is the VPN tunnels, and they are next on my list of figuring out what to do about. So I may have a few more questions in that area if you guys are hanging around this thread.
Thanks again,
Susan
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide