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..
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
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.
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.