Wednesday, March 23, 2011

EIGRP Next Hop, RIPv2 Next Hop, and OSPF Forward Address

I came across to the following information as I was doing research when writing the CCNP ROUTE Complete Guide 1st Edition.


In IGRP, if router X sends an update to router A with a destination network number of N, router A's next hop for packets to N will be X. In EIGRP, router X can send an update to router A with a destination network number of N and a next hop field of Y. This is useful, say, in a scenario where X and Y are running RIP and X is redistributing routes from RIP to IGRP. When X sends an update to its neighbors on a shared network, X can tell them to send traffic for network N directly to Y and not to X. This saves X from having to accept traffic on a shared network and then reroute it to Y.

OReilly - IP Routing - Chapter 4 - Enhanced Interior Gateway Routing Protocol (EIGRP)
http://oreilly.com/catalog/iprouting/chapter/ch04.html

My way of studying networking is always setup simulation labs to see things in action and prove them really work as claimed.

Firstly, let's have a look on the packet formats for EIGRP IP Internal and EIGRP IP External routes.

EIGRP IP Internal Route Packet Format

EIGRP IP External Route Packet Format

Take note upon the Next Hop field in the packet formats, we are going to see how it really works. :-)
Whether it works as claimed in the OReilly book. *grin*


The figure above shows the network setup used for our demonstration purpose.
RT1, RT2, and RT3 reside on the same subnet - 10.10.10.0/24.
RT1 and RT2 will be setup in sequence as RIPv2, OSPF, and EIGRP neighbors...
RT2 is configured with a static route to 172.16.1.0/24 via RT3.
RT2 is redistributing the static route into RIPv2, OSPF, and EIGRP respectively.
Theoretically, RT2 should advertise the external route to RT1 with the next hop of RT3 in order to eliminate the extra hop of routing via RT2, which is inefficient.

Firstly, let's see how RIPv2 behaves.
RT1 Configuration:
!
router rip
 version 2
 network 10.0.0.0
 no auto-summary
!

RT2 Configuration:
!
interface FastEthernet0/0
 ip address 10.10.10.2 255.255.255.0
 no ip split-horizon
 duplex auto
 speed auto
!
router rip
 version 2
 redistribute static
 network 10.0.0.0
 no auto-summary
!
ip route 172.16.1.0 255.255.255.0 10.10.10.3
!
================================================================================
RT1#debug ip rip
RIP protocol debugging is on
RT1#
00:13:33: RIP: received v2 update from 10.10.10.2 on FastEthernet0/0
00:13:33:      10.10.10.0/24 via 0.0.0.0 in 1 hops
00:13:33:      172.16.1.0/24 via 10.10.10.3 in 1 hops
RT1#
RT1#sh ip protocols
Routing Protocol is "rip"
  Sending updates every 30 seconds, next due in 4 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    FastEthernet0/0       2     2
  Automatic network summarization is not in effect
  Maximum path: 4
  Routing for Networks:
    10.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    10.10.10.2           120      00:00:06
  Distance: (default is 120)

RT1#
RT1#sh ip route

Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
R       172.16.1.0 [120/1] via 10.10.10.3, 00:00:06, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, FastEthernet0/0
RT1#
RT1#sh ip rip database
10.0.0.0/8    auto-summary
10.10.10.0/24    directly connected, FastEthernet0/0
172.16.0.0/16    auto-summary
172.16.1.0/24
    [1] via 10.10.10.2, 00:00:06, FastEthernet0/0
RT1#
RT1#debug ip icmp
ICMP packet debugging is on
RT1#
RT1#ping 172.16.1.1 repeat 1

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 8/8/8 ms
RT1#
00:13:40: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
RT1#

Below shows the RIPv2 update packet generated by RT2 and received on RT1.
Notice the next hop is RT3.
This is efficient. :-)




Now, let's see how OSPF works in this network setup.
RT1 Configuration:
!
router ospf 100
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
!

RT2 Configuration:

!
router ospf 100
 log-adjacency-changes
 redistribute static subnets
 network 0.0.0.0 255.255.255.255 area 0
!
ip route 172.16.1.0 255.255.255.0 10.10.10.3
!
================================================================================
RT1#debug ip ospf events
OSPF events debugging is on
RT1#
00:03:04: OSPF: Rcv LS UPD from 10.10.10.2 on FastEthernet0/0 length 64 LSA count 1
00:03:04: OSPF: Schedule partial SPF - type 5 id 172.16.1.0 adv rtr 10.10.10.2
00:03:04: OSPF: Service partial SPF 0/1/0
00:03:04: OSPF: Start partial processing Type 5 External LSA 172.16.1.0, mask 255.255.255.0, adv 10.10.10.2, age 1, seq 0x80000001, metric 20, metric-type 2
00:03:04:    Add path: next-hop 10.10.10.3, interface FastEthernet0/0
00:03:04:  network update dest_addr 172.16.1.0 mask 255.255.255.0 gateway 10.10.10.3
00:03:04:    Add External Route to 172.16.1.0. Metric: 20, Next Hop: 10.10.10.3
00:03:04: OSPF: insert route list LS ID 172.16.1.0, type 5, adv rtr 10.10.10.2
00:03:05: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 10.10.10.1
00:03:06: OSPF: Rcv hello from 10.10.10.2 area 0 from FastEthernet0/0 10.10.10.2
00:03:06: OSPF: End of hello processing
RT1#
RT1#sh ip route

Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
O E2    172.16.1.0 [110/20] via 10.10.10.3, 00:00:10, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, FastEthernet0/0
RT1#
RT1#sh ip ospf database

            OSPF Router with ID (10.10.10.1) (Process ID 100)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
10.10.10.1      10.10.10.1      79          0x80000002 0x00FBB8 1
10.10.10.2      10.10.10.2      79          0x80000003 0x00FDB0 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.10.10.2      10.10.10.2      80          0x80000001 0x00A119

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
172.16.1.0      10.10.10.2      12          0x80000001 0x00EDB3 0
RT1#
RT1#sh ip ospf database external

            OSPF Router with ID (10.10.10.1) (Process ID 100)

                Type-5 AS External Link States

  Routing Bit Set on this LSA
  LS age: 43
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 172.16.1.0 (External Network Number )
  Advertising Router: 10.10.10.2
  LS Seq Number: 80000001
  Checksum: 0xEDB3
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 10.10.10.3
        External Route Tag: 0

RT1#
RT1#debug ip icmp
ICMP packet debugging is on
RT1#
RT1#ping 172.16.1.1 repeat 1

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 36/36/36 ms
RT1#
00:05:45: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
RT1#

OSPF also works efficiently as like RIPv2.
OSPF utilizes the Forwarding Address field in the Type-5 AS-External LSA which is similar to the Next Hop field in the RIPv2 Update packets.
Below shows the OSPF LSU packet generated by RT2 to RT1 for the sake of completeness. :-)




Lastly, come back to our main focus on EIGRP... :-)
RT1 Configuration:
!
router eigrp 100
 network 10.0.0.0
 no auto-summary
!

RT2 Configuration:
!
router eigrp 100
 redistribute static
 network 10.0.0.0
 no auto-summary
!
ip route 172.16.1.0 255.255.255.0 10.10.10.3
!
================================================================================
RT1#debug ip eigrp
IP-EIGRP Route Events debugging is on
RT1#
00:05:40: IP-EIGRP(Default-IP-Routing-Table:100): Processing incoming UPDATE packet
00:05:40: IP-EIGRP(Default-IP-Routing-Table:100): Ext 172.16.1.0/24 M 30720 - 25600 5120 SM 28160 - 25600 2560
00:05:40: IP-EIGRP(Default-IP-Routing-Table:100): Ext 172.16.1.0/24 metric 30720 - 25600 5120
RT1#
RT1#sh ip route

Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
D EX    172.16.1.0 [170/30720] via 10.10.10.2, 00:01:56, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, FastEthernet0/0
RT1#
RT1#sh ip eigrp neighbors
IP-EIGRP neighbors for process 100
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   10.10.10.2              Fa0/0             11 00:02:23 1396  5000  0  3
RT1#
RT1#sh ip eigrp topology
IP-EIGRP Topology Table for AS(100)/ID(10.10.10.1)

Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status

P 10.10.10.0/24, 1 successors, FD is 28160
        via Connected, FastEthernet0/0
P 172.16.1.0/24, 1 successors, FD is 30720
        via 10.10.10.2 (30720/28160), FastEthernet0/0
RT1#
RT1#sh ip eigrp topology 172.16.1.0/24
IP-EIGRP (AS 100): Topology entry for 172.16.1.0/24
  State is Passive, Query origin flag is 1, 1 Successor(s), FD is 30720
  Routing Descriptor Blocks:
  10.10.10.2 (FastEthernet0/0), from 10.10.10.2, Send flag is 0x0
      Composite metric is (30720/28160), Route is External
      Vector metric:
        Minimum bandwidth is 100000 Kbit
        Total delay is 200 microseconds
        Reliability is 255/255
        Load is 1/255
        Minimum MTU is 1500
        Hop count is 1
      External data:
        Originating router is 10.10.10.2
        AS number of route is 0
        External protocol is Static, external metric is 0
        Administrator tag is 0 (0x00000000)
RT1#
RT1#debug ip icmp
ICMP packet debugging is on
RT1#
RT1#ping 172.16.1.1 repeat 1

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 92/92/92 ms
RT1#
00:06:47: ICMP: redirect rcvd from 10.10.10.2- for 172.16.1.1 use gw 10.10.10.3
00:06:47: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
RT1#
RT1#ping 172.16.1.1 repeat 1

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 36/36/36 ms
RT1#
00:06:50: ICMP: redirect rcvd from 10.10.10.2- for 172.16.1.1 use gw 10.10.10.3
00:06:50: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
RT1#
RT1#sh ip redirects
Default gateway is not set

Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty
RT1#

hmm... the next hop is not RT3 as like RIPv2 and OSPF.
ICMP redirect packets were generated by RT2 every time as a packet originated from RT1 to 172.16.1.0/24.
The ICMP layer of RT2 is trying to solve the inefficiency problem in EIGRP, but RT1 is too stubborn to listen to the suggestion / recommendation by RT2. :-)

And let's examine the EIGRP update packet generated by RT2.


hey, what?!? 0.0.0.0!

This problem is still exists in recent IOS.
RT2#sh ver | in IOS|Compiled
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 15.0(1)M5, RELEASE SOFTWARE (fc2)
Compiled Wed 23-Feb-11 18:55 by prod_rel_team
RT2#

Cisco DEs, DO SOMETHING and don't make people laugh!!!

9 comments:

  1. this RIP thing is not working for me. I am not able to influence NExt-Hop by redistributing static route..Is this any IOS specific ?/

    Thanks,
    Amit

    ReplyDelete
  2. Hi Amit, should be a basic stuff for RIP and not that I know it is IOS specific. Please send some show version, show running and show ip route to yapchinhoong@hotmail.com if you require another pair of eyes to look into it. Thanks. :)

    ReplyDelete
  3. surely I will be sending logs required in few hours.. though thanks for the reply n your bolgs are too good..cheers:)

    ReplyDelete
  4. It is because EIGRP by default uses next-hop self most likely. Try set it so EIGRP doesn't do this by default and you will get the desired result.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Well in testing this in 12.4 train in the lab it seems to still target the same neighbor regardless of the setting.

    ReplyDelete
    Replies
    1. The trick is this; with EIGRP you can disable the next-hop self. It doesn't seem to work in the lab scenario with a static route being redistributed.

      However with using Fa0/0 on the 10.10.10.0/24 segment; apply the following to R2 'no ip next-hop-self eigrp 100'

      When I redistributed the route via another routing protocol it works as you intend it.

      R1#show ip eigrp top
      IP-EIGRP Topology Table for AS(100)/ID(10.10.10.1)

      Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
      r - reply Status, s - sia Status

      P 10.10.10.0/24, 1 successors, FD is 281600
      via Connected, FastEthernet0/0
      P 172.16.1.0/24, 1 successors, FD is 537600
      10.10.10.3 via 10.10.10.2 (537600/512000), FastEthernet0/0


      R1#show 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

      172.16.0.0/24 is subnetted, 1 subnets
      D EX 172.16.1.0 [170/537600] via 10.10.10.3, 00:02:36, FastEthernet0/0
      10.0.0.0/24 is subnetted, 1 subnets
      C 10.10.10.0 is directly connected, FastEthernet0/0
      R1#

      debug ip icmp

      R1#ping 172.16.1.1

      Type escape sequence to abort.
      Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
      !!!!!
      Success rate is 100 percent (5/5), round-trip min/avg/max = 36/40/48 ms
      R1#
      *Mar 1 00:32:16.067: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
      *Mar 1 00:32:16.103: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
      *Mar 1 00:32:16.147: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
      *Mar 1 00:32:16.187: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
      *Mar 1 00:32:16.235: ICMP: echo reply rcvd, src 172.16.1.1, dst 10.10.10.1
      R1#



      So with R2 advertising it via a redistributed static; it does as you show. With R2 advertising it via another routing protocol the command works and doesn't use self as the next-hop.

      Keep in mind this is in testing on a 3725 running Version 12.4(15)T14.


      Delete
    2. hi Mike, thanks for the great findings!
      Tested working even all the 3 routers are running 12.3(26). :-)

      Delete