6 Replies Latest reply: May 11, 2019 5:55 AM by Steven Davidson RSS

    Which physical interface would be used to send/receive packets intended for a loopback interface?

    Darshan

      Hi Folks,

       

      Let us say, I have configured the router with a loopback addresses -

       

      router#show ip int br

      Interface                            IP-Address        OK?    Method     Status              Protocol

      GigabitEthernet0/0          10.132.92.202    YES    NVRAM       up                    up    

      GigabitEthernet0/1          10.132.92.206    YES    NVRAM       up                    up    

      GigabitEthernet0/2          unassigned        YES    NVRAM       down                down  

      Loopback0                      10.239.14.11      YES    NVRAM       up                    up     

      Loopback1                      10.239.241.21    YES    NVRAM      up                    up  

      Loopback2                      10.239.241.22    YES    NVRAM      up                    up


      I want to understand what happens -

      1. When I send a packet FROM another router (router2) targeted to the IP address 10.239.241.21 (Loopback1)? Which physical interface of this device will be used to receive the packets intended for loopback1 interface?
      2. When I want to send a packet TO another router (router2) with source IP address as 10.239.241.21 (Loopback1)? Which physical interface of this device will be used to send out the packets?

       

      Thanks and regards,

      Darshan L.

        • 1. Re: Which physical interface would be used to send/receive packets intended for a loopback interface?
          Steven Davidson

          The physical ingress/egress interface entirely depends on the forwarding tables of the routers routing the packets.  Unless you're using source-based routing for locally generated packets and you've configured matching logic to apply SBR treatment to the loopback interface in question it does not matter that packets are sourced from the loopback for outbound packets.  You could simply type:

           

          show ip cef x.x.x.x

           

          (where x.x.x.x is the destination IP) to figure out the outgoing interface(s).

          • 2. Re: Which physical interface would be used to send/receive packets intended for a loopback interface?
            Martin

            Use show ip route x.x.x.x or show ip cef x.x.x.x (more precise) to figure out which way .

            • 3. Re: Which physical interface would be used to send/receive packets intended for a loopback interface?
              Darshan

              Steven Davidson wrote:

               

              The physical ingress/egress interface entirely depends on the forwarding tables of the routers routing the packets.

               

              By this do you mean, it depends on the route table?

               

              If that is the case, when i run "show ip cef "

              CSR1000V-6101#show ip cef 10.0.0.2

              10.0.0.0/24

                attached to Loopback0


              And

               

              CSR1000V-6101#show ip route 10.0.0.2

              Routing entry for 10.0.0.0/24

                Known via "connected", distance 0, metric 0 (connected, via interface)

                Routing Descriptor Blocks:

                * directly connected, via Loopback0

                    Route metric is 0, traffic share count is 1


              From these outputs I dont see which physical interfaces are used at all.

               

              Please note, output of "show ip int br" as below-

               

              CSR1000V-6101#show ip int br

              Interface                        IP-Address           OK?      Method      Status                Protocol

              GigabitEthernet1           10.104.99.67         YES      NVRAM       up                    up

              GigabitEthernet1.2        unassigned           YES      unset           up                    up

              GigabitEthernet2           192.168.1.2          YES      NVRAM       up                    up

              Loopback0                    10.0.0.1                YES      NVRAM       up                    up

               

              Thanks and regards,

              Darshan L.

              • 4. Re: Which physical interface would be used to send/receive packets intended for a loopback interface?
                Martin

                here are 2 examples:  R1 is 2 hops away to sw2 (via R5).  it does not matter if u ping with source of loopback or interface E0/0, router looks at routing table (RIB) to figure out exit interface or next hop ip.

                 

                Rack1R1#trace 150.1.8.8  source loopback0

                Tracing the route to 150.1.8.8

                VRF info: (vrf in name/id, vrf out name/id)

                  1 155.1.0.5 23 msec 18 msec 18 msec

                  2 155.1.58.8 18 msec *  19 msec

                 

                Rack1R1#tr 150.1.8.8  source Ethernet 0/0

                Tracing the route to 150.1.8.8

                VRF info: (vrf in name/id, vrf out name/id)

                  1 155.1.0.5 26 msec 19 msec 18 msec

                  2 155.1.58.8 15 msec *  15 msec

                 

                - note above: source varies but next hop IPs are same, aka same way to get there

                 

                Rack1R1#sh ip ro 150.1.8.8    

                Routing entry for 150.1.8.8/32

                  Known via "ospf 1", distance 110, metric 75, type inter area

                  Last update from 155.1.0.5 on Serial1/0, 00:11:07 ago

                  Routing Descriptor Blocks:

                  * 155.1.0.5, from 150.1.5.5, 00:11:07 ago, via Serial1/0

                Route metric is 75, traffic share count is 1

                 

                same info if u use cef  table

                 

                Rack1R1#sh ip cef  150.1.8.8  

                150.1.8.8/32

                  nexthop 155.1.0.5 Serial1/0

                 

                Router builds routing table using protocol(s). it shows next hop IP and outgoing interface. Once routing table is set, CEF builds Forwarding table (FIB) to speed forwarding up.

                --------------------

                 

                example 2 : route is not in table but it can use default gateway to reach destination.

                 

                Rack1R1#sh ip route 192.168.5.5

                % Network not in table

                 

                route is not in RIB; but this is when ip cef is handy;

                 

                Rack1R1#sh ip cef  192.168.5.5

                0.0.0.0/0

                  nexthop 155.1.0.5 Serial1/0

                 

                Rack1R1#p 192.168.5.5

                Type escape sequence to abort.

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

                !!!!!

                 

                This works because of ip route 0.0.0.0 0.0.0.0 155.1.0.5 and destination R5 has route back to R1 S1/0.

                • 5. Re: Which physical interface would be used to send/receive packets intended for a loopback interface?
                  Martin

                  FROM another router (router2) targeted to the IP address 10.239.241.21 (Loopback1)

                  - use reverse lookup to see incoming interface for FROM IP (should be the same as outgoing physical interface Router1 - not loopback1) 

                   

                  TO another router (router2) with source IP address as 10.239.241.21 (Loopback1)

                  - if destination TO is in RIB, use it; if destination TO is not in RIB, use default gateway.  if default gateway is not set, packets are drooped.


                  in either case, u can use show ip route x.x.x and/or show ip cef x.x.x where x.x.x.x is destination address.

                  • 6. Re: Which physical interface would be used to send/receive packets intended for a loopback interface?
                    Steven Davidson

                    The problem that you have, here, is that 10.0.0.1 is on 10.0.0.0/24 and you're giving the other loopback, on the other router, 10.0.0.2 which is also in 10.0.0.0/24.  So, regardless of how you might learn of 10.0.0.0/24 from other routing sources (or even a static route) it will always have a higher administrative distance than your connected/attached route and, therefore, suppressed.  Why are you assigning the loopback IP addresses in this way?  What's the objective?  Typically loopback interfaces are assigned /32 addressing.  Try either switching to /32s for your loopbacks are at the very least put them on different networks.