OSPF loopback network type


The main advantage of OSPF over other IGP protocols is its organizational aspect, it brings routing design efforts down to the infrastructure, providing better stability and faster troubleshooting.

OSPF network type classification is an example of this organization. In production environment you certainly have been dealing with  “point-to-point”, “broadcast”, ”NBMA”,  “point-to-multipoint” and “point-to-multipoint-non Broadcast” but less with “loopback” type.

“Loopback” type is frequently used in testbeds and lab environments to imitate subnet segments, but there is some limitations related to this network type. The purpose of this lab is enumerate different methods that will help get rid of these limitations to make the lab topology as close as possible to the production environment.

Figure1 shows an example of Lab topology in which a loopback interfaces are used:

Figure1: topology

R3:

R3#sh ip ospf int loo1

Loopback1 is up, line protocol is up

  Internet Address 30.0.0.1/24, Area 23

  Process ID 10, Router ID 3.3.3.3, Network Type LOOPBACK, Cost: 1

  Loopback interface is treated as a stub Host

R3#

 

R3#sh ip ospf int loo2

Loopback2 is up, line protocol is up

  Internet Address 33.33.33.33/16, Area 23

  Process ID 10, Router ID 3.3.3.3, Network Type LOOPBACK, Cost: 1

  Loopback interface is treated as a stub Host

R3#

All loopback interfaces are considered as OSPF “LOOPBACK” network type and treated as stub host.

Stub hosts are visible to the routing protocols but not used for forwarding.

Loopback interface is advertised as a host with /32 mask as shown below from the routing table of other OSPF routers:

R2:

R2#sh ip route

 

Gateway of last resort is not set

 

     33.0.0.0/32 is subnetted, 1 subnets

O       33.33.33.33 [110/2] via 10.32.129.3, 00:03:48, FastEthernet0/0

     10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks

C       10.1.1.0/24 is directly connected, FastEthernet2/0

O       10.0.0.1/32 [110/2] via 10.32.1.1, 00:12:06, FastEthernet1/0

C       10.32.0.0/17 is directly connected, FastEthernet1/0

C       10.32.128.0/17 is directly connected, FastEthernet0/0

     30.0.0.0/32 is subnetted, 1 subnets

O       30.0.0.1 [110/2] via 10.32.129.3, 00:03:48, FastEthernet0/0

R2#

To change this and make OSPF advertise routes such 33.33.33.33 with its subnet mask, three methods area used:

1           If the area to which the loopback belongs is contiguous to area 0:

1.1          Change loopback OSPF network type.

1.2          Summarize loopback IP (as from ABR).

2           If the area to which the loopback belongs is non-contiguous to area 0, join the two area using traditional methods (OSPF virtual links or GRE/IPIP tunneling) in addition to either (1.1) or (1.2).

3           Redistribute connected (as from ASBR).

 

1.1- Directly change OSPF interface type

In this section we consider R3 loopback1 interface as it belongs to area 23 contiguous to area0 (figure2), the interface type is changed to point-to-point and the route to the interface is seen as intra-area route.

Figure2: case1 topology

R3:

R3(config-router)#int loo2

R3(config-if)#ip ospf network point-to-point

 

R3(config-if)#do sh ip ospf int loo2

Loopback2 is up, line protocol is up

  Internet Address 33.33.33.33/16, Area 23

  Process ID 10, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 1

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

  Supports Link-local Signaling (LLS)

  Index 3/3, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

R3(config-if)#

Now the interface is recognized as point-to-point and advertised with its configured subnet mask:

R2:

R2#sh ip route

 

Gateway of last resort is not set

 

     33.0.0.0/16 is subnetted, 1 subnets

O       33.33.0.0 [110/2] via 10.32.129.3, 00:09:45, FastEthernet0/0

     10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks

C       10.1.1.0/24 is directly connected, FastEthernet2/0

O       10.0.0.1/32 [110/2] via 10.32.1.1, 01:13:14, FastEthernet1/0

C       10.32.0.0/17 is directly connected, FastEthernet1/0

C       10.32.128.0/17 is directly connected, FastEthernet0/0

     30.0.0.0/32 is subnetted, 1 subnets

O       30.0.0.1 [110/2] via 10.32.129.3, 00:09:45, FastEthernet0/0

R2#

 

1.2- Summarize loopback IP:

Let’s consider R2 loopback2:

R2(config-router)#do sh ip ospf int loo1

Loopback1 is up, line protocol is up

  Internet Address 22.22.22.22/16, Area 23

  Process ID 10, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1

  Loopback interface is treated as a stub Host

R2(config-router)#

The interface is configured to belong to area 23, and summarized using area range command because R2 is an ABR, consequently it will be advertised as “O IA» an inter-area type route:


R1:






R1(config-router)#do sh ip route


Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP


       D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area


       N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2


       E1 – OSPF external type 1, E2 – OSPF external type 2


       i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2


       ia – IS-IS inter area, * – candidate default, U – per-user static route


       o – ODR, P – periodic downloaded static route


 


Gateway of last resort is not set


 


     33.0.0.0/32 is subnetted, 1 subnets


O IA    33.33.33.33 [110/3] via 10.32.1.2, 00:20:39, FastEthernet0/0


     22.0.0.0/16 is subnetted, 1 subnets


O IA    22.22.0.0 [110/2] via 10.32.1.2, 00:00:10, FastEthernet0/0


     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks


C       10.1.1.0/24 is directly connected, FastEthernet1/0


C       10.0.0.0/24 is directly connected, Loopback1


C       10.32.0.0/17 is directly connected, FastEthernet0/0


O IA    10.32.128.0/17 [110/2] via 10.32.1.2, 02:05:16, FastEthernet0/0


     30.0.0.0/32 is subnetted, 1 subnets


O IA    30.0.0.1 [110/3] via 10.32.1.2, 02:05:16, FastEthernet0/0


R1(config-router)#


However, it is still treated by R2 as STUB host; loopback interface IP address is advertised with its configured subnet mask /16:


R2:






R2(config-router)#do sh ip ospf int loo1


Loopback1 is up, line protocol is up


  Internet Address 22.22.22.22/16, Area 23


  Process ID 10, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1


  Loopback interface is treated as a stub Host


R2(config-router)#


R1:






R1(config-router)#do sh ip route


Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP


       D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area


       N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2


       E1 – OSPF external type 1, E2 – OSPF external type 2


       i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2


       ia – IS-IS inter area, * – candidate default, U – per-user static route


       o – ODR, P – periodic downloaded static route


 


Gateway of last resort is not set


 


     33.0.0.0/32 is subnetted, 1 subnets


O IA    33.33.33.33 [110/3] via 10.32.1.2, 00:20:39, FastEthernet0/0


     22.0.0.0/16 is subnetted, 1 subnets


O IA    22.22.0.0 [110/2] via 10.32.1.2, 00:00:10, FastEthernet0/0


     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks


C       10.1.1.0/24 is directly connected, FastEthernet1/0


C       10.0.0.0/24 is directly connected, Loopback1


C       10.32.0.0/17 is directly connected, FastEthernet0/0


O IA    10.32.128.0/17 [110/2] via 10.32.1.2, 02:05:16, FastEthernet0/0


     30.0.0.0/32 is subnetted, 1 subnets


O IA    30.0.0.1 [110/3] via 10.32.1.2, 02:05:16, FastEthernet0/0


R1(config-router)#


 


2- Non-contiguous area:


a)  With R3 loopback IP in a different area than 23 (figure3), we can apply virtual-link to join the non-contiguous area to the backbone through regular area 23.


Figure3: non-contiguous areas



R3:






router ospf 10


 network 33.33.0.0 0.0.255.255 area 33


 






Interface  Loopback 2


 ip ospf network point-to-point


 






area 23 virtual-link 2.2.2.2


R2:






area 23 virtual-link 3.3.3.3


R2:






R2#sh ip route


Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP


       D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area


       N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2


       E1 – OSPF external type 1, E2 – OSPF external type 2


       i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2


       ia – IS-IS inter area, * – candidate default, U – per-user static route


       o – ODR, P – periodic downloaded static route


 


Gateway of last resort is not set


 


     33.0.0.0/16 is subnetted, 1 subnets


O IA    33.33.0.0 [110/2] via 10.32.129.3, 00:00:26, FastEthernet0/0


     22.0.0.0/16 is subnetted, 1 subnets


C       22.22.0.0 is directly connected, Loopback1


     10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks


C       10.1.1.0/24 is directly connected, FastEthernet2/0


O       10.0.0.1/32 [110/2] via 10.32.1.1, 00:06:10, FastEthernet1/0


C       10.32.0.0/17 is directly connected, FastEthernet1/0


C       10.32.128.0/17 is directly connected, FastEthernet0/0


     30.0.0.0/32 is subnetted, 1 subnets


O       30.0.0.1 [110/2] via 10.32.129.3, 00:06:10, FastEthernet0/0


R2#


 


b) Another alternative to Virtual-links is GRE/IPIP tunneling, whether it is GRE or IPIP it depends on your needs, GRE has the advantage of supporting other layer 3 protocols against only “IP” for IPIP, both cases are presented here:


R2:






interface Tunnel0


 ip address 1.1.1.6 255.255.255.252


 ip ospf 10 area 33


 tunnel source FastEthernet0/0


 tunnel destination 10.32.129.3


 tunnel mode ipip


Actually, the tunnel subnet belongs to the same area as R3 loopback2 IP, area 33 to make it directly connected to area 0 through R2.


The only difference in configuration with GRE tunneling is mode as shown in the following line:






tunnel mode gre ip


R3 :






interface Tunnel0


 ip address 1.1.1.5 255.255.255.252


 ip ospf 10 area 33


 tunnel source FastEthernet0/0


 tunnel destination 10.32.129.2


 tunnel mode ipip


Figure3 illustrates the logical topology using GRE/IPIP tunnels


Figure3: logical topology with GRE/IPIP tunnels



R2:






R2#sh int tunn 0


Tunnel0 is up, line protocol is up


  Hardware is Tunnel


  Internet address is 1.1.1.6/30


  MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec,


     reliability 255/255, txload 1/255, rxload 1/255


  Encapsulation TUNNEL, loopback not set


  Keepalive not set


  Tunnel source 10.32.129.2 (FastEthernet0/0), destination 10.32.129.3


  Tunnel protocol/transport IP/IP


  Tunnel TTL 255


  Fast tunneling enabled


  Tunnel transmit bandwidth 8000 (kbps)


  Tunnel receive bandwidth 8000 (kbps)



 






R2#sh ip route



 


Gateway of last resort is not set


 


     1.0.0.0/30 is subnetted, 1 subnets


C       1.1.1.4 is directly connected, Tunnel0


     33.0.0.0/16 is subnetted, 1 subnets


O       33.33.0.0 [110/11112] via 1.1.1.5, 00:56:19, Tunnel0


     22.0.0.0/16 is subnetted, 1 subnets


C       22.22.0.0 is directly connected, Loopback1


     10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks


C       10.1.1.0/24 is directly connected, FastEthernet2/0


O       10.0.0.1/32 [110/2] via 10.32.1.1, 00:55:59, FastEthernet1/0


C       10.32.0.0/17 is directly connected, FastEthernet1/0


C       10.32.128.0/17 is directly connected, FastEthernet0/0


     30.0.0.0/32 is subnetted, 1 subnets


O       30.0.0.1 [110/2] via 10.32.129.3, 00:55:59, FastEthernet0/0


R2#


Do not forget that for R3 Loopback2 subnet to be announced with its subnet mask you have to either change the interface OSPF network type or perform summarization at R2 (the ABR between area 33 and area 0).


R1:






R1#sh ip route



 


Gateway of last resort is not set


 


     1.0.0.0/30 is subnetted, 1 subnets


O IA    1.1.1.4 [110/11112] via 10.32.1.2, 01:06:07, FastEthernet0/0


     33.0.0.0/16 is subnetted, 1 subnets


O IA    33.33.0.0 [110/11113] via 10.32.1.2, 01:06:07, FastEthernet0/0


     22.0.0.0/16 is subnetted, 1 subnets


O IA    22.22.0.0 [110/2] via 10.32.1.2, 01:06:07, FastEthernet0/0


     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks


C       10.1.1.0/24 is directly connected, FastEthernet1/0


C       10.0.0.0/24 is directly connected, Loopback1


C       10.32.0.0/17 is directly connected, FastEthernet0/0


O IA    10.32.128.0/17 [110/2] via 10.32.1.2, 01:06:07, FastEthernet0/0


     30.0.0.0/32 is subnetted, 1 subnets


O IA    30.0.0.1 [110/3] via 10.32.1.2, 01:06:07, FastEthernet0/0


R1#


Finally, the verification that traffic destined to R2 loopback2 takes the configured tunnel:






R1#trace 33.33.33.33 source 10.0.0.1


 


Type escape sequence to abort.


Tracing the route to 33.33.33.33


 


  1 10.32.1.2 68 msec 72 msec 44 msec


  2 1.1.1.5 88 msec *  104 msec


R1#


 


3- Route redistribution:


Let’s go back to loopback 2 interface defined in R3, it doesn’t matter whether the loopback interface IP is announced with OSPF or not, as soon as redistribute connected is configured, the route will be announced as external type E2 route and we will lose control over it, though it is configured inside our OSPF domain:


R3:






R3(config-if)#do sh ip ospf int loo2


%OSPF: OSPF not enabled on Loopback2


R3(config-if)#


 






R3(config-router)#redistribute connected subnet


R2:






R2(config-router)#do sh ip route


Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP


       D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area


       N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2


       E1 – OSPF external type 1, E2 – OSPF external type 2


       i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2


       ia – IS-IS inter area, * – candidate default, U – per-user static route


       o – ODR, P – periodic downloaded static route


 


Gateway of last resort is not set


 


     33.0.0.0/16 is subnetted, 1 subnets


O E2    33.33.0.0 [110/20] via 10.32.129.3, 00:00:51, FastEthernet0/0


     22.0.0.0/16 is subnetted, 1 subnets


C       22.22.0.0 is directly connected, Loopback1


     10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks


C       10.1.1.0/24 is directly connected, FastEthernet2/0


O       10.0.0.1/32 [110/2] via 10.32.1.1, 00:32:49, FastEthernet1/0


C       10.32.0.0/17 is directly connected, FastEthernet1/0


C       10.32.128.0/17 is directly connected, FastEthernet0/0


     30.0.0.0/32 is subnetted, 1 subnets


O       30.0.0.1 [110/2] via 10.32.129.3, 00:00:56, FastEthernet0/0


R2(config-router)#


 






R2(config-router)#do sh ip ospf data


 


            OSPF Router with ID (2.2.2.2) (Process ID 10)


 



 


                Type-5 AS External Link States


 


Link ID         ADV Router      Age         Seq#       Checksum Tag


33.33.0.0       3.3.3.3         456         0x80000001 0x005101 0


R2(config-router)#


 


SUMMARY


The /32 advertisement limitation of loopback interfaces can be overcome by either changing OSPF network type to point-to-point or creating summary route with the desired mask.


In case the loopback interface belongs to a non-contiguous area use either OSPF virtual-links or GRE/IPIP tunnels to join it to area 0.


 

Tags: