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  ^_^

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  ^_^