Wednesday, March 2, 2011

Subnet Mask in IGP for Loopbacks

Topology :



Configuration :

R1#

interface Serial0/0
 ip address 10.0.12.1 255.255.255.0

router eigrp 100
 network 0.0.0.0
 no auto-summary


router ospf 100
 router-id 11.11.11.11
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0


R2#

interface Serial0/0
 ip address 10.0.12.2 255.255.255.0

interface Serial0/1
 ip address 10.0.23.2 255.255.255.0

router eigrp 100
 network 0.0.0.0
 no auto-summary


router ospf 100
 router-id 22.22.22.22
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0


R3#

interface Loopback3
 ip address 3.3.3.3 255.255.0.0


interface Loopback33
 ip address 33.33.33.33 255.255.255.248

interface Serial0/0
 ip address 10.0.23.3 255.255.255.0
 clock rate 2000000


router eigrp 100
 network 3.3.0.0 0.0.255.255
 network 10.0.23.0 0.0.0.255
 network 33.33.33.32 0.0.0.7
 no auto-summary


router ospf 100
 router-id 32.32.32.32
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0


 Testing :

Related configuration :

R3(config)#do sh int lo33
Loopback33 is up, line protocol is up
  Hardware is Loopback
  Internet address is 33.33.33.33/29


Observe the output carefully :

R1#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/8 is variably subnetted, 2 subnets, 2 masks
O       33.33.33.33/32 [110/129] via 10.0.12.2, 00:21:22, Serial0/0
D       33.33.33.32/29 [90/2809856] via 10.0.12.2, 00:12:11, Serial0/0
     3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O       3.3.3.3/32 [110/129] via 10.0.12.2, 00:21:22, Serial0/0
D       3.3.0.0/16 [90/2809856] via 10.0.12.2, 00:12:11, Serial0/0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.0.12.0 is directly connected, Serial0/0
D       10.0.23.0 [90/2681856] via 10.0.12.2, 00:32:09, Serial0/0

I want to reach 33.33.33.33 which is configured in R3 and this Network is learned by both IGP's EIGRP and OSPF.
So obviously i expect to reach by EIGRP as this is preferred and less AD value than OSPF.

R1#sh ip route 33.33.33.33
Routing entry for 33.33.33.33/32
  Known via "ospf 100", distance 110, metric 129, type intra area  Last update from 10.0.12.2 on Serial0/0, 00:17:52 ago
  Routing Descriptor Blocks:
  * 10.0.12.2, from 32.32.32.32, 00:17:52 ago, via Serial0/0
      Route metric is 129, traffic share count is 1

R2#sh ip route 33.33.33.33
Routing entry for 33.33.33.33/32
  Known via "ospf 100", distance 110, metric 65, type intra area  Last update from 10.0.23.3 on Serial0/1, 00:18:41 ago
  Routing Descriptor Blocks:
  * 10.0.23.3, from 32.32.32.32, 00:18:41 ago, via Serial0/1
      Route metric is 65, traffic share count is 1

Why it did not prefer to take the path by EIGRP ?
Have you noticed the mask information ?

Then you are good to go.

** Always longest match will be preferred first then followed by AD or metric values etc..
** So here OSPF took the advantage of taking / learning this as /32 but EIGRP still took as it is so it is still /29
** obviously OSPF is preferred.


How to fix this ?

Check how OSPF is treating Loopback interface details here :

R3(config)#do sh ip ospf inter l33
Loopback33 is up, line protocol is up
  Internet Address 33.33.33.33/29, Area 0
  Process ID 100, Router ID 32.32.32.32, Network Type LOOPBACK, Cost: 1
  Loopback interface is treated as a stub Host
Check how EIGRP is treating Loopback interface details here :

R3(config)#do sh ip eigrp int l33
IP-EIGRP interfaces for process 100
                        Xmit Queue   Mean   Pacing Time   Multicast    Pending
Interface        Peers  Un/Reliable  SRTT   Un/Reliable   Flow Timer   Routes
Lo33               0        0/0         0       0/1            0           0

** So there is a difference in treatment.
** So to advertise currect subnet mask for Loopbacks there are multiple ways to do this but

simple way is just change the Network type from Loopback to "Point-to-Point"

Solution:

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

And the Routing table update is :

R1#sh ip route 33.33.33.33
Routing entry for 33.33.33.32/29
  Known via "eigrp 100", distance 90, metric 2809856, type internal  Redistributing via eigrp 100
  Last update from 10.0.12.2 on Serial0/0, 00:34:52 ago
  Routing Descriptor Blocks:
  * 10.0.12.2, from 10.0.12.2, 00:34:52 ago, via Serial0/0
      Route metric is 2809856, traffic share count is 1
      Total delay is 45000 microseconds, minimum bandwidth is 1544 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 2

R2#sh ip route 33.33.33.33
Routing entry for 33.33.33.32/29
  Known via "eigrp 100", distance 90, metric 2297856, type internal  Redistributing via eigrp 100
  Last update from 10.0.23.3 on Serial0/1, 00:34:39 ago
  Routing Descriptor Blocks:
  * 10.0.23.3, from 10.0.23.3, 00:34:39 ago, via Serial0/1
      Route metric is 2297856, traffic share count is 1
      Total delay is 25000 microseconds, minimum bandwidth is 1544 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1

** So this is just to make sure the behavior of these IGP protocols on how they treat the Network types based on media types. The same follows for 3.3.3.3 also


Happy Labbing  ^_^

No comments:

Post a Comment