Wednesday, March 2, 2011

How switching works - L2 & L3 responsibilities

Topology :



Objective :

** Swtiching process and L2 Encapsulation does not necessary relate, and the problem at one stage does not necessary relate to other stage.
** So if L2 Encapsulation is broken does not necessary "Routing is broken"


Configuration of Part of Diagram : Color filled Box


R1#

interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto


interface FastEthernet1/0.13
 encapsulation dot1Q 13
 ip address 10.1.13.1 255.255.255.0



R3#
interface FastEthernet1/0
 no ip address
 duplex auto
 speed auto


interface FastEthernet1/0.13
 encapsulation dot1Q 13
 ip address 10.1.13.3 255.255.255.0


=>  Basic reachability is there and no Layer 2 issues now.

R1#ping 10.1.13.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.13.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/36/80 ms


R3#ping 10.1.13.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.13.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/34/80 ms


Little bit Debug will give more clarity :

R1#sh deb
ARP:
  ARP packet debugging is on
Generic IP:
  IP packet debugging is on


** So i enabled "IP Packet and Arp" process to track the status how exactly Routing and Layer
2 process happens and which is key to identify.


R1#ping 10.1.13.3 rep 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 10.1.13.3, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 88/88/88 ms


R1#
*Mar  1 00:56:15.123: IP: tableid=0, s=10.1.13.1 (local), d=10.1.13.3 (FastEthernet1/0.13), routed via FIB
*Mar  1 00:56:15.127: IP: s=10.1.13.1 (local), d=10.1.13.3 (FastEthernet1/0.13), len 100, sending
*Mar  1 00:56:15.203: IP: tableid=0, s=10.1.13.3 (FastEthernet1/0.13), d=10.1.13.1 (FastEthernet1/0.13), routed via RIB
*Mar  1 00:56:15.207: IP: s=10.1.13.3 (FastEthernet1/0.13), d=10.1.13.1 (FastEthernet1/0.13), len 100, rcvd 3



** Now i am pinging UNKNOWN ip address to track and identify the switching and Routing difference.


R1#ping 10.1.13.100 rep 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 10.1.13.100, timeout is 2 seconds:

*Mar  1 00:56:55.767: IP: tableid=0, s=10.1.13.1 (local), d=10.1.13.100 (FastEthernet1/0.13), routed via RIB
*Mar  1 00:56:55.767: IP: s=10.1.13.1 (local), d=10.1.13.100 (FastEthernet1/0.13), len 100, sending
*Mar  1 00:56:55.775: IP ARP: creating incomplete entry for IP address: 10.1.13.100 interface FastEthernet1/0.13*Mar  1 00:56:55.775: IP ARP: sent req src 10.1.13.1 cc00.08ec.0010,
                 dst 10.1.13.100 0000.0000.0000 FastEthernet1/0.13 <<- MAC address*Mar  1 00:56:55.779: IP: s=10.1.13.1 (local), d=10.1.13.100 (FastEthernet1/0.13), len 100, encapsulation failed.
Success rate is 0 percent (0/1)
R1#sh arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  10.1.13.3              22   cc01.08ec.0010  ARPA   FastEthernet1/0.13
Internet  10.1.13.1               -   cc00.08ec.0010  ARPA   FastEthernet1/0.13
Internet  10.1.13.100             0   Incomplete      ARPAR1#

------------// Cisco Express Forwaridng  //------------

** L3 Routing is bi-directional process in general ( R1 --> R3 --> R1 )
 That means completely separate process.
** L2 switching is different, because of STP working model (Paths will be syncronous) is different than L2 Routing. If R1 Routing lookup is enough to Route the packet to R3


Simple example :
Now i added Loopback on both the Routers.

R1(config)#int lo1
R1(config-if)#ip add 1.1.1.1 255.255.255.255



R3(config)#int lo3
R3(config-if)#ip add 3.3.3.3 255.255.255.255


R3#ping 1.1.1.1 rep 2
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:

*Mar  1 01:25:45.091: IP: s=3.3.3.3 (local), d=1.1.1.1, len 100, unroutable.
*Mar  1 01:25:47.091: IP: s=3.3.3.3 (local), d=1.1.1.1, len 100, unroutable.
Success rate is 0 percent (0/2)



R3#sh ip route 1.1.1.1
% Network not in table


** When it dropss packet by default it should genenrate ICMP message
Add Static Routing :

R3(config)#ip route 1.1.1.1 255.255.255.255 10.1.13.1
R1(config)#ip route 3.3.3.3 255.255.255.255 10.1.13.3


R1(config)#do ping 3.3.3.3 so 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/33/76 ms
R1(config)#


Routing Vs CEF ::

R1(config)#do sh ip route 3.3.3.3
Routing entry for 3.3.3.3/32
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 10.1.13.3
      Route metric is 0, traffic share count is 1


** Based on input details CEF can do Input balancing based on the entries.
** By default CEF can do load balancing between source and destination pair as well.
** Switching alway differentiate Locally generated traffic and Transit traffic.
** Local traffic is always process switched and transit should use Fast or CEF


R1(config)#do sh ip cef exact-route 1.1.1.1 3.3.3.3
1.1.1.1         -> 3.3.3.3        : FastEthernet1/0.13 (next hop 10.1.13.3)


R1(config)#do sh ip cef exact-route 1.1.1.2 3.3.3.3
1.1.1.2         -> 3.3.3.3        : FastEthernet1/0.13 (next hop 10.1.13.3)
R1(config)#do sh ip cef exact-route 1.1.1.3 3.3.3.3
1.1.1.3         -> 3.3.3.3        : FastEthernet1/0.13 (next hop 10.1.13.3)

Over Lapping Routes :

R1(config)#ip route 3.3.3.3 255.255.255.255 10.1.13.2
R1(config)#ip route 3.3.3.3 255.255.255.255 10.1.13.4


** In this case Static metric will come into picture.

R1(config)#do sh ip route
Gateway of last resort is not set
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback1
     3.0.0.0/32 is subnetted, 1 subnets
S       3.3.3.3 [1/0] via 10.1.13.3
                [1/0] via 10.1.13.2

     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.13.0 is directly connected, FastEthernet1/0.13


See the Output :::

R1(config)#do ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!.!.!
Success rate is 60 percent (3/5), round-trip min/avg/max = 52/74/92 ms


** Why packets dropped, because of Load balancing using Switching machanism.
** I just added to Secondary ip addresses again for CEF testing

R1(config)#int lo1
R1(config-if)#ip add 1.1.1.2 255.255.255.255 sec
R1(config-if)#ip add 1.1.1.3 255.255.255.255 sec
R1(config-if)#end


** packet drops will happend due to load blancing



Happy Labbing  ^_^

No comments:

Post a Comment