1 2 Previous Next 20 Replies Latest reply: Jan 11, 2012 10:53 PM by Flexin RSS

    load balanced default routes

    Flexin

      Hi Guys,

       

      If you configure two static default routes to diffrent next hops and through diffrent links. I understand that it would install both routes to the routing table and would load balance but in reality which link goes first? How is that chosen?

        • 1. Re: load balanced default routes
          Mike Gannon

          Hi Flexin,

          I configured the router to do this:

          Interestingly it doesn't work if you specify the outbound interface because ARP fails. You need to use next hop IP in the configuration (I learn something new every day).

           

          I used the R#debug ip packet detail command to watch the packet flow and found that it has nothing to do with which interface you configure first. It always goes to the first physical interface on the router for the very first packet (ie F0/0 rather than F0/1). After that it load balances across each interface specified.

           

          You can see which interface the next packet will be sent using R#sh ip route 0.0.0.0 0.0.0.0. The interface with the * is the active interface

          • 2. Re: load balanced default routes
            Flexin

            Thanks for the reply.

             

            I did configure with the next hop and i got some weird results in terms of i could ping one direction but not the other. This problem was fixed by removing one of the default routes. Which has led me to this question.

             

            My thinking is that the icmp echo request is coming in one direction and the echo reply going out another based on the choice the router makes on which link of the two it has to load balance over. so is it round robin starting lowest interface number first and is this based on tcp connection or just bring the interfaces up starts at f0/0 and continues to round robin over the lifetime of the interface?

            • 3. Re: load balanced default routes
              cadetalain

              Hi Mike,

               

              Interestingly it doesn't work if you specify the outbound interface because ARP fails. You need to use next hop IP in the configuration (I learn something new every day).

               

              If the next-hop router has proxy-arp enabled then it shall work with specifying the outgoing interface.This is because when specifying the outgoing interface then the L3 to L2 mapping is gonna be done for the destination address and not the next-hop.

               

              Regards.

               

              Alain.

              • 4. Re: load balanced default routes
                cadetalain

                Hi,

                with the default of CEF activated on all interfaces then the CEF process will load-balance per src-dst IP pair or even per flow( UDP,TCP).

                This is for traffic forwarded by the router and you can change the load-balancing to per-packet with the interface command: ip load-sharing per-packet

                Packets locally originated or destined to the router are process switched and in this case load-balancing is per-packet.

                 

                Regards.

                 

                Alain

                • 5. Re: load balanced default routes
                  Flexin

                  Thanks Guys,

                   

                  Makes more sense now. so the key thing to take away from any load balancing is lowest interface first right.

                  • 6. Re: load balanced default routes
                    Vijay Swaminathan

                    Hi Mike,

                     

                    Just an attempt to understand your post. I have labbed up the following. I'm not sure if this is inline with what you have described. sorry if it sounded out of track.

                     

                    I have the following topology..

                     

                    Image_1.png

                    I have created a default route from R1 to reach 10.10.23.0/30 as shown below. Just to simulate that we have two default route to reach the destination

                     

                    R1#sh run | i ip route

                    ip route 0.0.0.0 0.0.0.0 10.10.12.2

                    ip route 0.0.0.0 0.0.0.0 10.10.13.2

                    R1#sh ip route

                    Gateway of last resort is 10.10.13.2 to network 0.0.0.0

                     

                     

                         10.0.0.0/30 is subnetted, 2 subnets

                    C       10.10.12.0 is directly connected, FastEthernet0/0

                    C       10.10.13.0 is directly connected, FastEthernet0/1

                    S*   0.0.0.0/0 [1/0] via 10.10.13.2

                                   [1/0] via 10.10.12.2

                    R1#

                     

                    Similarly for the return path, I have configured the default route as below on R2 and R3.

                     

                    R2:

                    ===

                    R2#sh ip route

                     

                         10.0.0.0/30 is subnetted, 2 subnets

                    C       10.10.12.0 is directly connected, FastEthernet0/0

                    C       10.10.23.0 is directly connected, FastEthernet0/1

                    S*   0.0.0.0/0 [1/0] via 10.10.12.1

                    R2#

                     

                    now how did you conclude that the first packet always goes via the first physical inteface on the router? I enabled the "debug ip packet detail" but could not make out the interface on which it is sent out.

                     

                    R1#ping 10.10.23.2

                     

                     

                    Type escape sequence to abort.

                    Sending 5, 100-byte ICMP Echos to 10.10.23.2, timeout is 2 seconds:

                    !!!!!

                    Success rate is 100 percent (5/5), round-trip min/avg/max = 4/35/152 ms

                    R1#

                    *Mar  1 00:14:09.995: IP: tableid=0, s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), routed via FIB

                    *Mar  1 00:14:09.999: IP: s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), len 100, sending

                    *Mar  1 00:14:09.999:     ICMP type=8, code=0

                    *Mar  1 00:14:10.143: IP: tableid=0, s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1 (FastEthernet0/0), routed via RIB

                    *Mar  1 00:14:10.143: IP: s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1, len 100, rcvd 4

                    *Mar  1 00:14:10.147:     ICMP type=0, code=0

                    *Mar  1 00:14:10.147: IP: tableid=0, s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), routed via FIB

                    *Mar  1 00:14:10.151: IP: s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), len 100, sending

                    *Mar  1 00:14:10.151:     ICMP type=8, code=0

                    *Mar  1 00:14:10.159: IP: tableid=0, s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1 (FastEthernet0/0), routed via RIB

                    *Mar  1 00:14:10.159: IP: s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1, len 100, rcvd 4

                    *Mar  1 00:14:10.159:     ICMP typ

                    R1#e=0, code=0

                    *Mar  1 00:14:10.159: IP: tableid=0, s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), routed via FIB

                    *Mar  1 00:14:10.159: IP: s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), len 100, sending

                    *Mar  1 00:14:10.159:     ICMP type=8, code=0

                    *Mar  1 00:14:10.163: IP: tableid=0, s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1 (FastEthernet0/0), routed via RIB

                    *Mar  1 00:14:10.163: IP: s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1, len 100, rcvd 4

                    *Mar  1 00:14:10.163:     ICMP type=0, code=0

                    *Mar  1 00:14:10.163: IP: tableid=0, s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), routed via FIB

                    *Mar  1 00:14:10.163: IP: s=10.10.12.1 (local), d=10.10.23.2 (FastEthernet0/1), len 100, sending

                    *Mar  1 00:14:10.163:     ICMP type=8, code=0

                    *Mar  1 00:14:10.167: IP: tableid=0, s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1 (FastEthernet0/0), routed via RIB

                    *Mar  1 00:14:10.167: IP: s=10.10.23.2 (FastEthernet0/1), d=10.10.12.1, len 100, rcvd 4

                    *Mar  1 00:14:10.167:

                    R1#   ICMP type=0, code=0

                     

                    is it from Traceroute?

                     

                    R1#traceroute 10.10.23.2

                     

                     

                    Type escape sequence to abort.

                    Tracing the route to 10.10.23.2

                     

                     

                      1 10.10.12.2 104 msec

                        10.10.13.2 52 msec

                        10.10.12.2 4 msec

                    R1#

                     

                    Please let know if I'm missing something here?

                     

                    Thanks,

                    -Vijay

                    • 7. Re: load balanced default routes
                      cadetalain

                      Hi,

                       

                      How did you came to this conclusion and this would be only an option for process-switched traffic because forwarded traffic is by default CEF switched and so it will only be load-balanced according to hash algorithm result from CEF calculation and you can test it with sh ip cef exact-route <src ip > <dst ip >

                       

                      Regards.

                       

                      Alain

                      • 8. Re: load balanced default routes
                        Vijay Swaminathan

                        The output of sh ip cef exact-route <src ip> <det ip> shows the following

                         

                        R1#sh ip cef exact-route 10.10.12.1 10.10.23.2

                        10.10.12.1      -> 10.10.23.2     : FastEthernet0/1 (next hop 10.10.13.2)

                        R1#

                         

                        which confirms that the packet does not go through the lowest interface

                         

                        -Vijay

                        • 9. Re: load balanced default routes
                          lp4nb

                          here's its load balanced, between the interfaces,

                          I didn't used CEF though,

                           

                          R1(config)#do ping 10.1.23.2 rep 2

                           

                          Type escape sequence to abort.

                          Sending 2, 100-byte ICMP Echos to 10.1.23.2, timeout is 2 seconds:

                          !!

                          Success rate is 100 percent (2/2), round-trip min/avg/max = 32/36/40 ms

                          R1(config)#

                          *Mar  1 00:12:00.747: IP: tableid=0, s=10.1.12.1 (local), d=10.1.23.2 (Serial0/1), routed via RIB

                          *Mar  1 00:12:00.751: IP: s=10.1.12.1 (local), d=10.1.23.2 (Serial0/1), len 100, sending

                          *Mar  1 00:12:00.751:     ICMP type=8, code=0

                          *Mar  1 00:12:00.775: IP: tableid=0, s=10.1.23.2 (Serial0/1), d=10.1.12.1 (Serial0/1), routed via RIB

                          *Mar  1 00:12:00.775: IP: s=10.1.23.2 (Serial0/1), d=10.1.12.1 (Serial0/1), len 100, rcvd 3

                          *Mar  1 00:12:00.779:     ICMP type=0, code=0

                          *Mar  1 00:12:00.779: IP: tableid=0, s=10.1.13.1 (local), d=10.1.23.2 (Serial0/0), routed via RIB

                          *Mar  1 00:12:00.783: IP: s=10.1.13.1 (local), d=10.1.23.2 (Serial0/0), len 100, sending

                          R1(config)#

                          *Mar  1 00:12:00.783:     ICMP type=8, code=0

                          *Mar  1 00:12:00.815: IP: tableid=0, s=10.1.23.2 (Serial0/0), d=10.1.13.1 (Serial0/0), routed via RIB

                          *Mar  1 00:12:00.819: IP: s=10.1.23.2 (Serial0/0), d=10.1.13.1 (Serial0/0), len 100, rcvd 3

                          *Mar  1 00:12:00.819:     ICMP type=0, code=0

                          R1(config)#

                          • 10. Re: load balanced default routes
                            Mike Gannon

                            Alain - he got that from me.

                             

                            Vijay - I posted what I saw from my GNS results. Once I cleared down the ARP and reconfigured the static routes the first ping always went out F0/0 in the first instance until per packet load balancing started taking place.

                            I used two directly connected routers with two FE links, and pinged loopback interfaces

                                 F0/0----------F0/0

                            R1                         R2

                                 F0/1----------F0/1

                             

                            Had you already carried out any pings before this one? and did you clear the ARP table? I will do the lab again and post results if you need.

                            I'll caveat my answer by saying this is what I saw, not what I have read in documentation.

                            • 11. Re: load balanced default routes
                              Flexin

                              This is where i got that from.

                               

                              It always goes to the first physical interface on the router for the very first packet (ie F0/0 rather than F0/1)

                               

                              as i can se from the output above this is not the case. So i go back to the original question.

                               

                              With two default routes to diffrent next hops out of diffrent interfaces. How does the router chose which link to use first?

                               

                              Alain are you saying that cef makes that descision? if so how ?

                              • 12. Re: load balanced default routes
                                cadetalain

                                Hi,

                                 

                                these are locally generated packets so process-switched so per-packet load-balanced.

                                 

                                Regards.

                                 

                                Alain

                                • 13. Re: load balanced default routes
                                  lp4nb

                                  hello Mike,

                                  i GUESS, First interface is the one that is listed with * in routing table descriptor block at start. But, again, its cisco.

                                  what listing you got, for show ip route x.x.x.x

                                  • 14. Re: load balanced default routes
                                    Vijay Swaminathan

                                    in my case, the forward traffic always took the fa0/1 and return traffic always took fa0/0 as per the debug messages..

                                     

                                    oh.. may be initially before the start of the test, i had the cef entries already populated. let me clear the cef entries and try again...

                                     

                                    -Vijay

                                    1 2 Previous Next