Pages

Tuesday, August 5, 2014

Routing and Switching Notes

IP routing overview
=====================
Routing:
-find the outgoing interface

Switching
-move the packet between interfaces

-encapsulation
-build the L2 header

For a L3 router, we are rebuilding the L2 encapsulation on hop by hop basis, this allows us to receive packet in a frame-relay interface and forwarded in an Ethernet interface.

In Switching there is no change in L2 header, only table lookup happens based on the mac address.

The routing Process:
--------------------------------
Find the longest match
-show ip route 1.2.3.4
1.0.0.0/8
1.2.0.0/16
1.2.3.0/24

First of all, router will look at the destination address and do a lookup at routing or forwarding table  to figure out what is the most bits in common when we do AND between dest address and the routes in routing table.
Here it will be 1.2.3.0/24
Longest match can be /32 and shortest match can be default route ie 0.0.0.0

Recurse to the routing interface
-1.2.3.4 via 5.6.7.8
-5.6.7.8 via 9.0.1.2
-9.0.1.2 via 3.4.5.6
-3.4.5.6 directly connected, fastethernet0/0

So packet should go out of f0/0, now comes switching to switch packets between interfaces.

The Switching Process
=====================
Moves the packet between interfaces
-process, fast, cef, etc
-Where load balancing occurs

Configuration
-ip cef
-[no] ip route-cache

Verification
-show ip interface
-show ip cef [address] [detail]
-show ip cef exact-route [source] [destination]

Metric  vs. Distance
===============
What if there are multiple longest matches?
Same protocol
-choose lowest metric
Different protocols
-choose lowest administrative distance.

ADs :
Connected : 0
Static : 1
EIGRP summary : 5
EBGP 20
EIGRP : 90
Ospf : 110
RIP 120
EIGRP EX 170
iBGP 200

The Switching Process :
Cef  is the default one.
Cef is also used for load balancing between the interfaces based on l4 port address.

If everything is same between two routes in L3 then it is upto switch how it can process the packet.

With cef process table is always precalculated to start. Cef table is based on per port basis.
Fast switching process is driven by data plane. we don’t  have caching entry until packet is send to interface.

 Now once the routing and switching is over and actual frame need to be built, here comes encapsulation process

The Encapsulation Process
====================
Build the layer 2 header
Multipoint interfaces require layer3 to layer 2 resolution
-Ethernt : show arp
-Frame realy : show frame-relay map

Normally L3 header remains the same between the interfaces until we are doing some NAT, only L2 header changes.
Any time there is multipoint, router need to do L3 to L2 resolution.
But for point to point link like in ATM , fram-relay sub-interfaces, HDLC, PPP there is no need for L3 to L2 resolution since same mac address is used to reach every possible destination reachable out that link in case off frame-relay and ATM.
And PPP and HDLC don’t use L2 address since these are both point to point encapsulation. I assume that only person that can receive data is a person on another side.

Routing to a Next-Hop
====================
Recurse to the interface
If multipoint, resolve the layer2 address of next-hop
Example:
-ip route 10.0.0.0 255.0.0.0 1.2.3.4
-find interface for 1.2.3.4
-if multipoint, find layer 2 address of 1.2.3.4

Routing to a Multipoint Interface:
=========================
Recursion not required
Resolve layer 2 address for final destination
-ethernet proxy-arp
-NBMA Mappings

Example
-ip route 10.0.0.0 255.0.0.0 fastethernet0/0
-find layer2 address of 10.0.0.1

Here no need of l2 address of outgoing interface since it is already known but l2 address is needed for 10.0.0.1

Routing to a Point-to-point Interface
====================================
Recursion not required
Layer 2 resolution not required
Example:
-ip route 10.0.0.0 255.0.0.0 serial0/0.1

Other Default Routing
==================
Ip default-gateway
-only when ip routing is off
Basically on L2 switches which don’t support routing. We can use in the router as well when routing process is off.

Ip default-network
-network flagged as default in routing advertisement
-must be a classful network that is not directly connected.


No comments:

Post a Comment