SlideShare a Scribd company logo
1 of 38
Download to read offline
Routing basics/CEF
May 4, 2016
Dmitry Figol
CCIE R&S #53592
dmitry@dmfigol.me
Intro to routing and switching
Routing
• Finding the optimal way towards destination
Switching
• Moving packet between interfaces
2
Packet forwarding
When the packet comes in, the router does the following:
0. Checks and removes L2 header, gets destination IP
1. Routing process
2. Switching process
3. L2 encapsulation
3
Routing process
• Find the longest match based on destination IP in routing
table (RIB)
• The goal is to find outgoing interface and Next Hop IP
address (if applicable)
4
Routing table - example
5
Routing table (cont.)
• Recursive Lookup
• Contains useless information for forwarding:
• For example, Administrative Distance and Metric
• Single lookup has linear complexity O(n)
• Stored in RAM
• Verification: show ip route [ip-address [mask]]
6
Routing table (cont.)
Metric (maximum is 232-1 = 4294967295):
• Used to choose the best route within a single routing protocol
(*not always true)
Administrative distance (0..255):
• Used to choose the best route between routing protocols
7
Routing table (cont.) - AD
8
Route Source Value
Connected 0
Static 1
EIGRP summary 5
eBGP 20
EIGRP internal 90
IGRP 100
OSPF 110
IS-IS 115
Route Source Value
RIP 120
EGP 140
ODR 160
EIGRP external 170
iBGP 200
NHRP 250
DHCP learned 254
Unknown* (Not installed) 255
Routing protocols
• Static
• Dynamic:
• IGP:
• Distance-vector(RIP, EIGRP)
• Link-state (OSPF, IS-IS)
• EGP:
• Path-vector (BGP)
9
Switching process
• Process-switching
• Fast-switching
• Cisco Express Forwarding (CEF)
10
L2 Encapsulation
Knowing outgoing interface and Next Hop address is not always
enough for “packet rewrite”
• Point-to-point links (PPP, HDLC) – no additional information
required
• Point-to-multipoint links (Ethernet, Frame-relay, ATM) – L2
Destination Address is required (from ARP cache, Frame-
Relay/ATM mappings)
11
Traffic types
Data plane – traffic through the device
Control plane – traffic to the device:
• Routing protocols hello/updates
• BPDU
• FHRP and others
Management plane – part of control plane:
• SSH/Telnet
• SNMP
12
Processors: CPU and ASIC
• Central processing unit (CPU) is the brains of the network device
• Handles control plane
• Can do anything
• Can’t do packet forwarding with high throughput*
*Note: DPDK project enables x86 multi-core processors to forward 200+ Gbps
13
Processors: CPU and ASIC
• Application specific integrated circuit (ASIC) is circuit with
transistors
• Very fast, but dumb
• Designed specifically to move packets
• Expensive
• Not possible to program new features
• Responsible for data plane
14
Memory: RAM, CAM and TCAM
Random Access Memory (RAM) is the most common type of memory
• Value is accessed by pointer (memory address)
• Cheap
15
Memory: RAM, CAM and TCAM
Content-addressable memory (CAM)
• Value is accessed by a key, not a pointer
• Very fast
• Expensive
• High power consumption
• O(1) constant time lookup
• Used in switches for MAC address table
16
Memory: RAM, CAM and TCAM
Ternary Content-addressable memory (TCAM)
• Value is accessed by a key, which consists of not only “0” and “1”,
but also “don’t care” bits.
• Very expensive
• High power consumption
• O(1) constant time lookup!
• Used for next-hop lookup (CEF table), ACL (security and QoS)
17
Process-switching
• Recursive lookup is performed by CPU in RIB
• There is special process responsible for process-switching “IP Input”
• The following traffic is process-switched:
• Control plane
• Locally generated (not all)
• No L2 adjacency information
• ACL logging
18
Fast-switching
• First packet for source-destination IP pair is process-switched
• IP pair and corresponding encapsulation information is added
to the cache
• Following packets are forwarding based on the entry in cache
• Deprecated
19
Cisco Express Forwarding (CEF)
The idea is to precompute and optimize information in RIB:
• Resolve recursive lookup and get rid of useless information
• Add pointer to pre-built L2 header in Adjacency table
The new table is called Forwarding Information Base (FIB) or CEF table:
• Contains prefix, NH, outgoing interface, pointer to L2 header
• Stored in DRAM [O(1) using 256-way mtrie data structure] and TCAM
[if exists, also O(1), but much faster]
The lookup is done during the interrupt (process scheduling is not
required)
20
CEF (cont.)
Verification:
show ip cef [ip-address [mask]] [detail] [internal]
Shows NH, outgoing interface, MPLS labels (if applicable)
Internal keyword shows pointer to Adjacency entry and hash buckets
Disable CEF:
(config)# no ip cef
21
CEF – Adjacency table
• CEF process takes information from all L3-to-L2 mappings and builds
L2 header
• Adjacency table contains NH, interface, associated L2 Header
• Stored in RAM
• Pitfall: CEF process does not allow adjacency to age out
(clear arp won’t delete ARP entry if it can be revalidated)
• Verification:
show adjacency [detail]
22
CEF – Adjacency types
• Cache
• Glean
• Receive
• Punt
• Null
• Discard
• Drop
23
CEF on hardware-based platforms
• CEF basically allows to forward traffic without CPU
• Depending on platform there can be zero, one or more ASICs.
• The same applies for TCAM
• All L3 switches have TCAM, only some routers have it
• That’s why generally speaking L3 switches forward traffic faster than routers
• TCAM stores not only FIB, but ACL and QoS rules, the allocation is
predefined though
• On some platforms you can change allocation profile
24
CEF on hardware-based platforms (cont.)
25
RIB
ARP Cache
Other L2
information
FIB
(CEF Table)
Adjacency
table
TCAM
RAM
ASIC
CEF – Load balancing
• Routing protocols can install several routes for the same prefix
• How will CEF decide where to send packet?
• CEF is doing load-balancing per-flow
• By default, it takes source-destination IP pair, feeds it to the
hashing algorithm, returns the number of the bucket
• Buckets are allocated automatically per NH, depending on the
traffic share count in RIB
26
CEF – Load balancing (cont.)
Verification:
show ip cef [ip [mask]] internal – shows NH-to-bucket distribution
show ip cef exact-route src-ip dst-ip – shows NH and interface for
source/destination IP pair
Change load balancing method (not recommended):
(config-if)# ip load-sharing per-packet
27
CEF polarization
• Hash algorithm is deterministic, meaning that for the same
source/destination IP pair the bucket (outgoing link) is the same.
• Result is that some links can be underutilized (especially if we have
chain of routers with ECMP).
• One possible solution is to include L4 ports in hashing (if
supported):
(config)# ip cef load-sharing algorithm include-ports [source
[destination]]
28
Static Routing
• The way to install an entry in RIB manually
• Usually overrides entries installed via dynamic routing protocols
• Advantage: gives full control over path selection in your network
• Main disadvantage: huge administrative burden
• Syntax:
(config)# ip route prefix mask [NH-IP | interface [NH-IP]] [distance]
[track track]
• Verification:
# show ip route [static]
29
Static Routing (cont.)
There are three different ways to configure where the traffic should
go for specific prefix:
• By specifying next-hop IP address
• By specifying outgoing interface
• By specifying both
30
Static Routing to next-hop
• Recursive lookup is required to find outgoing interface
• On multipoint interfaces resolution of next-hop IP address is
required (ARP cache, Frame Relay/ATM mapping)
• Static route is installed into RIB only if recursive lookup is
successful (outgoing interface was found)
• It will stay in RIB even if next-hop is covered only by valid default route
31
Static Routing to outgoing interface
• Recursive lookup is not required because we know outgoing
interface
• On point-to-point interface we can send the packet right away
• On multipoint interface first we need to find L2 address for
destination IP
• For every new destination IP addressin the packet we will install entry in ARP
cache
• It can still work if Proxy Arp is enabled (which is enabled by default in IOS)
• Static route is installed into RIB only if line protocol (for outgoing interface) is
up
• Use only for point-to-point interfaces!
32
Static Routing to outgoing interface and NH
• Recursive lookup is not required because we know outgoing
interface
• On point-to-point interface we can send the packet right away
• On multipoint interface first we need to find L2 address for next-
hop IP address
• Static route is installed into RIB only if line protocol of outgoing
interface is up
33
Floating static routes
• Floating static route is a route that has AD higher than default and
is not installed into RIB under normal operation, because there is
another preferred path
• Once primary path fails floating static route can be installed
• For example:
• Primary static default route with AD 1 and tracking (based on IP SLA) or BFD
• Secondary static default route with AD 2 or higher
• Once tracking object/BFD goes down, primary route is deleted from RIB and secondary
route is installed
34
Recursive lookup for static routes - exercise
• R1 has one interface up/up with IP in subnet 188.1.12.0/24.You configurethe following:
Question: Which static routes will be installed in RIB?
35
Recursive lookup for static routes - rule
Answer:
Rule:
If the best route for the next hop also covers the entire address space
of the static route under the question, it will NOT be installed.
36
Additional Resources
• Inside Cisco IOS Software Architecture (Russ White) book
• IP Routing FAQ
• Switching Paths
• Load Balancing with CEF
• Troubleshooting load balancing with CEF
• CAM vs TCAM
• CEF polarization
37
Questions?
38

More Related Content

What's hot

Vxlan deep dive session rev0.5 final
Vxlan deep dive session rev0.5   finalVxlan deep dive session rev0.5   final
Vxlan deep dive session rev0.5 finalKwonSun Bae
 
Juniper mpls best practice part 2
Juniper mpls best practice   part 2Juniper mpls best practice   part 2
Juniper mpls best practice part 2Febrian ‎
 
BGP Advance Technique by Steven & James
BGP Advance Technique by Steven & JamesBGP Advance Technique by Steven & James
BGP Advance Technique by Steven & JamesFebrian ‎
 
STP (spanning tree protocol)
STP (spanning tree protocol)STP (spanning tree protocol)
STP (spanning tree protocol)Netwax Lab
 
Vxlan control plane and routing
Vxlan control plane and routingVxlan control plane and routing
Vxlan control plane and routingWilfredzeng
 
Ccnp enterprise workbook v1.0 bgp zero to hero
Ccnp enterprise workbook v1.0 bgp zero to heroCcnp enterprise workbook v1.0 bgp zero to hero
Ccnp enterprise workbook v1.0 bgp zero to heroSagarR24
 
Fabric Path PPT by NETWORKERS HOME
Fabric Path PPT by NETWORKERS HOMEFabric Path PPT by NETWORKERS HOME
Fabric Path PPT by NETWORKERS HOMEnetworkershome
 
Ccnp workbook network bulls
Ccnp workbook network bullsCcnp workbook network bulls
Ccnp workbook network bullsSwapnil Kapate
 
BGP (Border Gateway Protocol)
BGP (Border Gateway Protocol)BGP (Border Gateway Protocol)
BGP (Border Gateway Protocol)NetProtocol Xpert
 

What's hot (20)

Vxlan deep dive session rev0.5 final
Vxlan deep dive session rev0.5   finalVxlan deep dive session rev0.5   final
Vxlan deep dive session rev0.5 final
 
MPLS & BASIC LDP
MPLS & BASIC LDPMPLS & BASIC LDP
MPLS & BASIC LDP
 
Bgp
BgpBgp
Bgp
 
CCNP Route EIGRP Overview
CCNP Route  EIGRP OverviewCCNP Route  EIGRP Overview
CCNP Route EIGRP Overview
 
Juniper mpls best practice part 2
Juniper mpls best practice   part 2Juniper mpls best practice   part 2
Juniper mpls best practice part 2
 
BGP Advance Technique by Steven & James
BGP Advance Technique by Steven & JamesBGP Advance Technique by Steven & James
BGP Advance Technique by Steven & James
 
Dhcp
DhcpDhcp
Dhcp
 
STP (spanning tree protocol)
STP (spanning tree protocol)STP (spanning tree protocol)
STP (spanning tree protocol)
 
EtherChannel Configuration
EtherChannel ConfigurationEtherChannel Configuration
EtherChannel Configuration
 
Dc fabric path
Dc fabric pathDc fabric path
Dc fabric path
 
Mpls L3_vpn
Mpls L3_vpnMpls L3_vpn
Mpls L3_vpn
 
Vxlan control plane and routing
Vxlan control plane and routingVxlan control plane and routing
Vxlan control plane and routing
 
EVPN Introduction
EVPN IntroductionEVPN Introduction
EVPN Introduction
 
Implementing cisco mpls
Implementing cisco mplsImplementing cisco mpls
Implementing cisco mpls
 
Ccnp enterprise workbook v1.0 bgp zero to hero
Ccnp enterprise workbook v1.0 bgp zero to heroCcnp enterprise workbook v1.0 bgp zero to hero
Ccnp enterprise workbook v1.0 bgp zero to hero
 
BGP Overview
BGP OverviewBGP Overview
BGP Overview
 
Fabric Path PPT by NETWORKERS HOME
Fabric Path PPT by NETWORKERS HOMEFabric Path PPT by NETWORKERS HOME
Fabric Path PPT by NETWORKERS HOME
 
Ccnp workbook network bulls
Ccnp workbook network bullsCcnp workbook network bulls
Ccnp workbook network bulls
 
Bgp protocol
Bgp protocolBgp protocol
Bgp protocol
 
BGP (Border Gateway Protocol)
BGP (Border Gateway Protocol)BGP (Border Gateway Protocol)
BGP (Border Gateway Protocol)
 

Similar to Routing basics/CEF

11 coms 525 tcpip - internet protocol - forward
11   coms 525 tcpip - internet protocol - forward11   coms 525 tcpip - internet protocol - forward
11 coms 525 tcpip - internet protocol - forwardPalanivel Kuppusamy
 
chapter 1 &2 RIPv1&2.ppt
chapter 1 &2 RIPv1&2.pptchapter 1 &2 RIPv1&2.ppt
chapter 1 &2 RIPv1&2.pptbirhanugebisa1
 
Multiprotocol label switching (mpls) - Networkshop44
Multiprotocol label switching (mpls)  - Networkshop44Multiprotocol label switching (mpls)  - Networkshop44
Multiprotocol label switching (mpls) - Networkshop44Jisc
 
Tcil_Concept of Routing_n_protocols.pptx
Tcil_Concept of Routing_n_protocols.pptxTcil_Concept of Routing_n_protocols.pptx
Tcil_Concept of Routing_n_protocols.pptxVINAYTANWAR18
 
Routing Protocol EIGRP
Routing Protocol EIGRPRouting Protocol EIGRP
Routing Protocol EIGRPDmitry Figol
 
Final Presentation on the Network layer
Final Presentation on the Network layerFinal Presentation on the Network layer
Final Presentation on the Network layerZee Haak
 
Packet Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing ConferencePacket Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing ConferenceCengage Learning
 
IP/MAC Address Translation
IP/MAC Address TranslationIP/MAC Address Translation
IP/MAC Address TranslationIsmail Mukiibi
 
Router configuration
Router configurationRouter configuration
Router configuration97148881557
 
Tutorial: Network State Awareness Troubleshooting
Tutorial: Network State Awareness TroubleshootingTutorial: Network State Awareness Troubleshooting
Tutorial: Network State Awareness TroubleshootingAPNIC
 
Rina p4 rina workshop
Rina p4   rina workshopRina p4   rina workshop
Rina p4 rina workshopEduard Grasa
 
MPLS Traffic Engineering
MPLS Traffic EngineeringMPLS Traffic Engineering
MPLS Traffic EngineeringAPNIC
 

Similar to Routing basics/CEF (20)

11 coms 525 tcpip - internet protocol - forward
11   coms 525 tcpip - internet protocol - forward11   coms 525 tcpip - internet protocol - forward
11 coms 525 tcpip - internet protocol - forward
 
chapter 1 &2 RIPv1&2.ppt
chapter 1 &2 RIPv1&2.pptchapter 1 &2 RIPv1&2.ppt
chapter 1 &2 RIPv1&2.ppt
 
Multiprotocol label switching (mpls) - Networkshop44
Multiprotocol label switching (mpls)  - Networkshop44Multiprotocol label switching (mpls)  - Networkshop44
Multiprotocol label switching (mpls) - Networkshop44
 
Network Layer
Network LayerNetwork Layer
Network Layer
 
Tcil_Concept of Routing_n_protocols.pptx
Tcil_Concept of Routing_n_protocols.pptxTcil_Concept of Routing_n_protocols.pptx
Tcil_Concept of Routing_n_protocols.pptx
 
Routing Protocol EIGRP
Routing Protocol EIGRPRouting Protocol EIGRP
Routing Protocol EIGRP
 
Final Presentation on the Network layer
Final Presentation on the Network layerFinal Presentation on the Network layer
Final Presentation on the Network layer
 
Router configuration
Router configurationRouter configuration
Router configuration
 
infiniband.pdf
infiniband.pdfinfiniband.pdf
infiniband.pdf
 
Packet Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing ConferencePacket Analysis - Course Technology Computing Conference
Packet Analysis - Course Technology Computing Conference
 
IP/MAC Address Translation
IP/MAC Address TranslationIP/MAC Address Translation
IP/MAC Address Translation
 
Router configuration
Router configurationRouter configuration
Router configuration
 
Tutorial: Network State Awareness Troubleshooting
Tutorial: Network State Awareness TroubleshootingTutorial: Network State Awareness Troubleshooting
Tutorial: Network State Awareness Troubleshooting
 
ADDRESSING PADA TCP IP
ADDRESSING PADA TCP IPADDRESSING PADA TCP IP
ADDRESSING PADA TCP IP
 
Mpls101
Mpls101Mpls101
Mpls101
 
Rina p4 rina workshop
Rina p4   rina workshopRina p4   rina workshop
Rina p4 rina workshop
 
BGP
BGPBGP
BGP
 
IP Routing.pptx
IP Routing.pptxIP Routing.pptx
IP Routing.pptx
 
Chapter14ccna
Chapter14ccnaChapter14ccna
Chapter14ccna
 
MPLS Traffic Engineering
MPLS Traffic EngineeringMPLS Traffic Engineering
MPLS Traffic Engineering
 

Recently uploaded

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 

Recently uploaded (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 

Routing basics/CEF

  • 1. Routing basics/CEF May 4, 2016 Dmitry Figol CCIE R&S #53592 dmitry@dmfigol.me
  • 2. Intro to routing and switching Routing • Finding the optimal way towards destination Switching • Moving packet between interfaces 2
  • 3. Packet forwarding When the packet comes in, the router does the following: 0. Checks and removes L2 header, gets destination IP 1. Routing process 2. Switching process 3. L2 encapsulation 3
  • 4. Routing process • Find the longest match based on destination IP in routing table (RIB) • The goal is to find outgoing interface and Next Hop IP address (if applicable) 4
  • 5. Routing table - example 5
  • 6. Routing table (cont.) • Recursive Lookup • Contains useless information for forwarding: • For example, Administrative Distance and Metric • Single lookup has linear complexity O(n) • Stored in RAM • Verification: show ip route [ip-address [mask]] 6
  • 7. Routing table (cont.) Metric (maximum is 232-1 = 4294967295): • Used to choose the best route within a single routing protocol (*not always true) Administrative distance (0..255): • Used to choose the best route between routing protocols 7
  • 8. Routing table (cont.) - AD 8 Route Source Value Connected 0 Static 1 EIGRP summary 5 eBGP 20 EIGRP internal 90 IGRP 100 OSPF 110 IS-IS 115 Route Source Value RIP 120 EGP 140 ODR 160 EIGRP external 170 iBGP 200 NHRP 250 DHCP learned 254 Unknown* (Not installed) 255
  • 9. Routing protocols • Static • Dynamic: • IGP: • Distance-vector(RIP, EIGRP) • Link-state (OSPF, IS-IS) • EGP: • Path-vector (BGP) 9
  • 10. Switching process • Process-switching • Fast-switching • Cisco Express Forwarding (CEF) 10
  • 11. L2 Encapsulation Knowing outgoing interface and Next Hop address is not always enough for “packet rewrite” • Point-to-point links (PPP, HDLC) – no additional information required • Point-to-multipoint links (Ethernet, Frame-relay, ATM) – L2 Destination Address is required (from ARP cache, Frame- Relay/ATM mappings) 11
  • 12. Traffic types Data plane – traffic through the device Control plane – traffic to the device: • Routing protocols hello/updates • BPDU • FHRP and others Management plane – part of control plane: • SSH/Telnet • SNMP 12
  • 13. Processors: CPU and ASIC • Central processing unit (CPU) is the brains of the network device • Handles control plane • Can do anything • Can’t do packet forwarding with high throughput* *Note: DPDK project enables x86 multi-core processors to forward 200+ Gbps 13
  • 14. Processors: CPU and ASIC • Application specific integrated circuit (ASIC) is circuit with transistors • Very fast, but dumb • Designed specifically to move packets • Expensive • Not possible to program new features • Responsible for data plane 14
  • 15. Memory: RAM, CAM and TCAM Random Access Memory (RAM) is the most common type of memory • Value is accessed by pointer (memory address) • Cheap 15
  • 16. Memory: RAM, CAM and TCAM Content-addressable memory (CAM) • Value is accessed by a key, not a pointer • Very fast • Expensive • High power consumption • O(1) constant time lookup • Used in switches for MAC address table 16
  • 17. Memory: RAM, CAM and TCAM Ternary Content-addressable memory (TCAM) • Value is accessed by a key, which consists of not only “0” and “1”, but also “don’t care” bits. • Very expensive • High power consumption • O(1) constant time lookup! • Used for next-hop lookup (CEF table), ACL (security and QoS) 17
  • 18. Process-switching • Recursive lookup is performed by CPU in RIB • There is special process responsible for process-switching “IP Input” • The following traffic is process-switched: • Control plane • Locally generated (not all) • No L2 adjacency information • ACL logging 18
  • 19. Fast-switching • First packet for source-destination IP pair is process-switched • IP pair and corresponding encapsulation information is added to the cache • Following packets are forwarding based on the entry in cache • Deprecated 19
  • 20. Cisco Express Forwarding (CEF) The idea is to precompute and optimize information in RIB: • Resolve recursive lookup and get rid of useless information • Add pointer to pre-built L2 header in Adjacency table The new table is called Forwarding Information Base (FIB) or CEF table: • Contains prefix, NH, outgoing interface, pointer to L2 header • Stored in DRAM [O(1) using 256-way mtrie data structure] and TCAM [if exists, also O(1), but much faster] The lookup is done during the interrupt (process scheduling is not required) 20
  • 21. CEF (cont.) Verification: show ip cef [ip-address [mask]] [detail] [internal] Shows NH, outgoing interface, MPLS labels (if applicable) Internal keyword shows pointer to Adjacency entry and hash buckets Disable CEF: (config)# no ip cef 21
  • 22. CEF – Adjacency table • CEF process takes information from all L3-to-L2 mappings and builds L2 header • Adjacency table contains NH, interface, associated L2 Header • Stored in RAM • Pitfall: CEF process does not allow adjacency to age out (clear arp won’t delete ARP entry if it can be revalidated) • Verification: show adjacency [detail] 22
  • 23. CEF – Adjacency types • Cache • Glean • Receive • Punt • Null • Discard • Drop 23
  • 24. CEF on hardware-based platforms • CEF basically allows to forward traffic without CPU • Depending on platform there can be zero, one or more ASICs. • The same applies for TCAM • All L3 switches have TCAM, only some routers have it • That’s why generally speaking L3 switches forward traffic faster than routers • TCAM stores not only FIB, but ACL and QoS rules, the allocation is predefined though • On some platforms you can change allocation profile 24
  • 25. CEF on hardware-based platforms (cont.) 25 RIB ARP Cache Other L2 information FIB (CEF Table) Adjacency table TCAM RAM ASIC
  • 26. CEF – Load balancing • Routing protocols can install several routes for the same prefix • How will CEF decide where to send packet? • CEF is doing load-balancing per-flow • By default, it takes source-destination IP pair, feeds it to the hashing algorithm, returns the number of the bucket • Buckets are allocated automatically per NH, depending on the traffic share count in RIB 26
  • 27. CEF – Load balancing (cont.) Verification: show ip cef [ip [mask]] internal – shows NH-to-bucket distribution show ip cef exact-route src-ip dst-ip – shows NH and interface for source/destination IP pair Change load balancing method (not recommended): (config-if)# ip load-sharing per-packet 27
  • 28. CEF polarization • Hash algorithm is deterministic, meaning that for the same source/destination IP pair the bucket (outgoing link) is the same. • Result is that some links can be underutilized (especially if we have chain of routers with ECMP). • One possible solution is to include L4 ports in hashing (if supported): (config)# ip cef load-sharing algorithm include-ports [source [destination]] 28
  • 29. Static Routing • The way to install an entry in RIB manually • Usually overrides entries installed via dynamic routing protocols • Advantage: gives full control over path selection in your network • Main disadvantage: huge administrative burden • Syntax: (config)# ip route prefix mask [NH-IP | interface [NH-IP]] [distance] [track track] • Verification: # show ip route [static] 29
  • 30. Static Routing (cont.) There are three different ways to configure where the traffic should go for specific prefix: • By specifying next-hop IP address • By specifying outgoing interface • By specifying both 30
  • 31. Static Routing to next-hop • Recursive lookup is required to find outgoing interface • On multipoint interfaces resolution of next-hop IP address is required (ARP cache, Frame Relay/ATM mapping) • Static route is installed into RIB only if recursive lookup is successful (outgoing interface was found) • It will stay in RIB even if next-hop is covered only by valid default route 31
  • 32. Static Routing to outgoing interface • Recursive lookup is not required because we know outgoing interface • On point-to-point interface we can send the packet right away • On multipoint interface first we need to find L2 address for destination IP • For every new destination IP addressin the packet we will install entry in ARP cache • It can still work if Proxy Arp is enabled (which is enabled by default in IOS) • Static route is installed into RIB only if line protocol (for outgoing interface) is up • Use only for point-to-point interfaces! 32
  • 33. Static Routing to outgoing interface and NH • Recursive lookup is not required because we know outgoing interface • On point-to-point interface we can send the packet right away • On multipoint interface first we need to find L2 address for next- hop IP address • Static route is installed into RIB only if line protocol of outgoing interface is up 33
  • 34. Floating static routes • Floating static route is a route that has AD higher than default and is not installed into RIB under normal operation, because there is another preferred path • Once primary path fails floating static route can be installed • For example: • Primary static default route with AD 1 and tracking (based on IP SLA) or BFD • Secondary static default route with AD 2 or higher • Once tracking object/BFD goes down, primary route is deleted from RIB and secondary route is installed 34
  • 35. Recursive lookup for static routes - exercise • R1 has one interface up/up with IP in subnet 188.1.12.0/24.You configurethe following: Question: Which static routes will be installed in RIB? 35
  • 36. Recursive lookup for static routes - rule Answer: Rule: If the best route for the next hop also covers the entire address space of the static route under the question, it will NOT be installed. 36
  • 37. Additional Resources • Inside Cisco IOS Software Architecture (Russ White) book • IP Routing FAQ • Switching Paths • Load Balancing with CEF • Troubleshooting load balancing with CEF • CAM vs TCAM • CEF polarization 37