Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

OSPF loopback interface

Hi

I have 2 questions regarding loopback interfaces usage for OSPF.

1) What are the reason or advantages behind using an exact address (ex: network 192.168.1.254 0.0.0.0 area 0) over a whole subnet (ex: network 192.168.1.254 0.0.0.255 area 0) when setting a loopback interface?

2) What are the benefits of using a loopback interface over router priority to manipulate the DR election process?

Thanks

-Assaf

1 ACCEPTED SOLUTION

Accepted Solutions

Re: OSPF loopback interface

Hi Assaf,

I have to disagree, first of all the RID needs not be advertised via OSPF, secondly a RID will never be rechosen unless the ospf process is manually cleared or the router is reloaded - or if the RID is manually configured.

Accordingly, i totally agree with Rick that using the priority is the most recommended action, although manually setting the RID (or controlling it via the highest loopback address) has other benefits when it comes to using virtual-links for example.

Anyway the DR election process is not that straight forward, i hope that the following explanation would be satisfactory:

A router declares its priority value via the "Rtr Pri" field in the OSPF hello packet. This value is configured under the interface via the "ip ospf priority <0-255>" command, with 1 being the default, and 0 meaning that the router is ineligible to become a DR or a BDR, and the higher priority wins. The RID serves as a tie-breaker when the priority values are the same. One important thing to keep in mind, the DR/BDR election is not pre-empitive, thus the first router to come up will be the DR and the second will be the BDR, the rules of election are o­nly effective when o­ne of them fail. If the BDR fails, a new BDR is elected according to the rules of election. o­n the other hand if the DR fails, the BDR takes the DR role, and a new BDR is elected according to the rules of election. Using "ip ospf priority 0" is the strongest tool with the lowest impact if you wish to have an instantaneous action, it doesn't require resetting the OSPF process. If configured o­n router that is a DR or a BDR, this router will resign its role immediately.

I hope that i've been informative.

BR,

Mohammed Mahmoud.

9 REPLIES
Hall of Fame Super Silver

Re: OSPF loopback interface

Assaf

1) Assuming that the loopback is configured as:

ip address 192.168.1.254 255.255.255.0

then it makes no difference which form of network statement that you use. Both the statement with mask 0.0.0.0 and with mask 0.0.0.255 will have the effect of including the loopback into the OSPF process in area 0.

Some of us prefer the process of using an exact match because it makes it somewhat more obvious what we are doing and obvious what interface is matched. Other people prefer the process of a more general match (0.0.0.255) because it has the possibility of reducing the number of network statements (it might match several interfaces - for example if there were two interfaces 192.168.1.1/25 and 192.168.1.129/25 then both would match one network statement).

But the effect in OSPF is exactly the same for both types of network statement.

2) If you set the router priority it will win the election for DR no matter what the address (and no matter whether it is a loopback or a physical address). So if you are comparing the effects of setting a loopback or setting priority for election of DR, then there is no benefit of setting loopback that is more beneficial than setting priority.

HTH

Rick

New Member

Re: OSPF loopback interface

Hi Rick

Thanks for the feedback.

Regarding number 2, I am currently studying for CCNP BSCI exam and watching CBT nuggets videos. At one point the guy says that it's a better solution to use the loopback address because it never goes down as a hardware interface and in the case of a hardware interface going down a new election process will take place. To avoid this, he suggests, creating a loopback address with the highest ip and advertising it in the OSPF area.

Is there any logical explanation behind this?

Is this method ever used in practice?

Thanks

-Assaf

Re: OSPF loopback interface

Hi Assaf,

I have to disagree, first of all the RID needs not be advertised via OSPF, secondly a RID will never be rechosen unless the ospf process is manually cleared or the router is reloaded - or if the RID is manually configured.

Accordingly, i totally agree with Rick that using the priority is the most recommended action, although manually setting the RID (or controlling it via the highest loopback address) has other benefits when it comes to using virtual-links for example.

Anyway the DR election process is not that straight forward, i hope that the following explanation would be satisfactory:

A router declares its priority value via the "Rtr Pri" field in the OSPF hello packet. This value is configured under the interface via the "ip ospf priority <0-255>" command, with 1 being the default, and 0 meaning that the router is ineligible to become a DR or a BDR, and the higher priority wins. The RID serves as a tie-breaker when the priority values are the same. One important thing to keep in mind, the DR/BDR election is not pre-empitive, thus the first router to come up will be the DR and the second will be the BDR, the rules of election are o­nly effective when o­ne of them fail. If the BDR fails, a new BDR is elected according to the rules of election. o­n the other hand if the DR fails, the BDR takes the DR role, and a new BDR is elected according to the rules of election. Using "ip ospf priority 0" is the strongest tool with the lowest impact if you wish to have an instantaneous action, it doesn't require resetting the OSPF process. If configured o­n router that is a DR or a BDR, this router will resign its role immediately.

I hope that i've been informative.

BR,

Mohammed Mahmoud.

New Member

Re: OSPF loopback interface

Hi,

If a priority is increased above 1, does the OSPF process still have to be restarted to trigger an election? I thought that was the case, but now you have confirmed that decreasing the priority to 0 makes the DR/BDR resign its role, I want to double-check.

Thanks!

Re: OSPF loopback interface

Hi James,

Yes, you are correct, the only priority value that has an instantaneous reaction is 0, setting any other value needs you to manually clear the OSPF process.

CE2(R6)(config-if)#do sh ip osp ne

Neighbor ID Pri State Dead Time Address Interface

16.16.16.1 200 FULL/BDR 00:00:30 16.16.16.1 FastEthernet0/0

CE2(R6)(config-if)#ip osp pri

CE2(R6)(config-if)#ip osp priority 0

CE2(R6)(config-if)#

CE2(R6)(config-if)#do sh ip osp ne

Neighbor ID Pri State Dead Time Address Interface

16.16.16.1 200 FULL/DR 00:00:36 16.16.16.1 FastEthernet0/0

I hope that i've been informative.

BR,

Mohammed Mahmoud.

New Member

Re: OSPF loopback interface

Hi Mohammed

Thanks for the feedback, all clear now.

-Assaf

New Member

Re: OSPF loopback interface

Great - thanks!

New Member

Re: OSPF loopback interface

Hi guys, great explanation....

I only disagree with the fact that RID not needs to be advertised via OSPF. I think to use virtual links you need advertise the RID address...

My Best Regards,

Andre Lomonaco

Silver

Re: OSPF loopback interface

Just a few words to add to the already comprehensive answers provided.

1) If you configure loopbacks, and you should imo, then select /32 mask on the interface. This is for simplicity and I see no obvious benefit for /24 loopbacks. If fact it's quite a waste of addresses.

2) Configure the loopbacks as passive like this:

router ospf 100

passive-interface loopback 0

This will reduce the hello overhead when advertising the loopbacks. You see routers don't really know that it's only a virtual interface. Finally, if you have only 2 routers participating in DR/BDR election process (multi-access), there is no benefit for priority at all. Instead configure the interfaces for point-to-point networks type. Again this is best practice and a way of fine tuning ospf.

OSPF can be CPU intensive in large networks or if networks configuration is incorrect. Or it can be CPU intensive for other reasons too, like improper design or a flapping link. Whatever the reason we should always take precautionary measures to reduce the OSPF process load on any spf active router by using it, and it's protocols (hello's) only where absolutely necessary.

hth,

Ajaz

1881
Views
10
Helpful
9
Replies
CreatePlease to create content