9

Why do we use the ip ospf network point-to-point command on loopback interfaces?

interface Loopback0
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point

kindly explain that..

Ryan Foley
  • 5,479
  • 4
  • 23
  • 43
Trojan
  • 1,398
  • 5
  • 17
  • 29

3 Answers3

8

If we create a loopback and give classful or classless addresses, then by default the route to that loop back is advertised as the most specific route: /32 prefix and it will ignore any configured prefix.

Eg:

interface Loopback0
 ip address 2.2.2.2 255.255.255.0

Here, the loopback network address is 2.2.2.0/24. By default OSPF will advertise this route to loopback0 as 2.2.2.2/32 (most specific route to that loopback).

To override this we have to change the network type to point-to-point. After this OSPF will advertise the address to loopback as 2.2.2.0/24.

interface Loopback0
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point
Ryan Foley
  • 5,479
  • 4
  • 23
  • 43
6

By using point-to-point command you will be overriding the default categorization of OSPF.

Per RFC 2328, OSPF only supports following types of links:

               Link type   Description       Link ID
               __________________________________________________
               1           Point-to-point    Neighbor Router ID
                           link
               2           Link to transit   Interface address of
                           network           Designated Router
               3           Link to stub      IP network number
                           network
               4           Virtual link      Neighbor Router ID

Loopback interfaces fall in link-type 3: the stub network. The RFC states:

            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.

Thanks.

Rais
  • 352
  • 1
  • 6
-2

Since there are only two routers on a point-to-point link, there is no need to hold an election for a Designated Router (DR) and a backup DR as OSPF would in a broadcast network.

An OSPF router on a point-to-point link will multicast its OSPF on the link for the other end to receive. On a point-to-point link, a router can only establish one neighborship.

A loopback interface in OSPF will be in loopback mode. Setting OSPF to point-to-point mode results in advertised routes containing the actual subnet mask instead of the default behaviour of advertising /32 for a loopback interface.

Iirc I read something about scenarios in which advertising a /32 instead of the actual mask causes trouble. I have only ever used this to start advertising a network that was not yet attached to the router.

Gerben
  • 4,670
  • 20
  • 32
  • Could you comment on the reason for using this configuration on a loopback? – Mike Pennington Nov 19 '14 at 13:59
  • I believe that's typically done when a loopback is configured with a mask with something other than a /32. By default, OSPF will advertise the loopback network as a /32 regardless of the actual mask configured. However, with the "ip ospf network point-to-point" configured on the loopback, the actual mask of the interface will be advertised. However, in this case, I don't see any benefit of the command, as it will be advertised as a /32 either way. – Ryan Nov 19 '14 at 14:37
  • @Mike @ Ryan if we give the ip ospf network point-to-point it changes the default mask to real mask we configured.my question is is there any calculation behind that command? – Trojan Nov 19 '14 at 16:15
  • @Mike, @ Trojan Sorry, I missed the (important) part about the loopback interface when I first replied. – Gerben Nov 19 '14 at 20:33