Wednesday, 28 December 2016

HOW ROUTER PROCESS

HOW ROUTER PROCESS:

Three ways by which cisco router process packets they are:

  • Process switching
  • Fast switching
  • Cisco Express Forwarding

Process switching requires the CPU to be personally involved with every forwarding decision.




Fast switching still uses the CPU, but after a packet has been forwarded, information about
how toreach the destination is stored in a fast-switching cache.  This way, when another
 packet going to the same destination is seen, the next hop information can be re-used from
the cache, so the processor doesn’t have to look up and assemble all the information again.
 If the information is not cached, (for example a first packet for a given destination network)
the CPU will have a similar workload, for that packet, as if fast switching was not in use.



Cisco Express Forwarding (CEF), is the evolution of optimizing the router to make it be
 able to  forward more packets faster.  CEF cheats a little, by building a Forwarding
 Information Base (FIB), and an adjacency table.  The FIB is accessed very quickly based
on how they built it  (it is Cisco proprietary), and contains pre-computed reverse lookups,
 next hop information for  routes including the interface and L2 information to use.
 (All the stuff a router would have to  consider when forwarding a packet).

ref:  Keith Barker - CCIE RS/Security, CISSP




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

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
R       2.2.2.2 [120/1] via 10.1.1.2, 00:00:05, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, FastEthernet0/0

R1#sh ip cef
Prefix              Next Hop             Interface
0.0.0.0/0           drop                 Null0 (default route handler entry)
0.0.0.0/8           drop
0.0.0.0/32          receive
1.1.1.1/32          receive
2.2.2.2/32          10.1.1.2             FastEthernet0/0
10.1.1.0/24         attached             FastEthernet0/0
10.1.1.0/32         receive
10.1.1.1/32         receive
10.1.1.2/32         10.1.1.2             FastEthernet0/0
10.1.1.255/32       receive
127.0.0.0/8         drop
224.0.0.0/4         drop
224.0.0.0/24        receive
240.0.0.0/4         drop
255.255.255.255/32  receive

Notice that the CEF output includes a few entries which don't appear in show ip route, such
as the default route to null0.
The CEF form of the command can be especially convenient within MPLS networks, as it
includes label information:

R1#sh ip route 2.2.2.2
Routing entry for 2.2.2.2/32
  Known via "rip", distance 120, metric 1
  Redistributing via rip
  Last update from 10.1.1.2 on FastEthernet0/0, 00:00:15 ago
  Routing Descriptor Blocks:
  * 10.1.1.2, from 10.1.1.2, 00:00:15 ago, via FastEthernet0/0
      Route metric is 1, traffic share count is 1


R1#sh ip cef 2.2.2.2
2.2.2.2/32, version 9, epoch 0, cached adjacency 10.1.1.2
0 packets, 0 bytes
  via 10.1.1.2, FastEthernet0/0, 0 dependencies
    next hop 10.1.1.2, FastEthernet0/0
    valid cached adjacency

We can filter the routes we want to see by specifying a network and mask and then
appending the  longer-prefixes keyword. For example, if we only wanted to see routes
within 10.0.0.0/24:

R1#sh ip cef 2.2.2.2 255.255.255.255 longer-prefixes
Prefix              Next Hop             Interface
2.2.2.2/32          10.1.1.2             FastEthernet0/0

Suppose you want to see all routes which point out a given interface. Instead of trying to
 glean this  information from show ip route, you can specify an interface with show ip cef:

R1#sh ip cef fa0/0
Prefix              Next Hop             Interface
2.2.2.2/32          10.1.1.2             FastEthernet0/0
10.1.1.0/24         attached             FastEthernet0/0
10.1.1.2/32         10.1.1.2             FastEthernet0/0

We can also view routes of a specific CEF adjacency type:

R1#sh ip cef adjacency drop
Prefix              Next Hop             Interface
0.0.0.0/8           drop
127.0.0.0/8         drop
224.0.0.0/4         drop
240.0.0.0/4         drop
R1#sh ip cef adjacency gle
R1#sh ip cef adjacency glean
Prefix              Next Hop             Interface
10.1.1.0/24         attached             FastEthernet0/0

Finally, show ip cef can also be used to predict the route of an explicit source and destination
 address  pair. This can be handy when equal-cost load balancing or source-based policy
routing is in place.

Router# show ip cef exact-route 10.0.9.5 192.168.0.1
10.0.9.5        -> 192.168.0.1    : FastEthernet0/1 (next hop 10.0.9.18)
Router# show ip cef exact-route 10.0.9.6 192.168.0.1
10.0.9.6        -> 192.168.0.1    : FastEthernet0/0 (next hop 10.0.9.14)



Default CEF entries

It's interesting that even with an empty routing table, a modern Cisco router has several
active CEF entries. Fire up an unconfigured router and issue the command show ip cef to
view the default entries. The following output was observed on a 3725 running IOS 12.4(9)T1:

Router# show ip cef
Prefix              Next Hop             Interface
0.0.0.0/0           drop                 Null0 (default route handler entry)
0.0.0.0/32          receive
224.0.0.0/4         drop
224.0.0.0/24        receive
255.255.255.255/32  receive
I'm going to take a shot at identifying the purpose of each entry, in reverse order:

255.255.255.255/32 - This is the local broadcast address for a subnet
224.0.0.0/24 - The multicast block reserved for local network control traffic
224.0.0.0/4 - All other multicast traffic (originally Class D space) should be dropped when
multicast  routing is disabled
0.0.0.0/32 - Not sure, but assumed to be a reserved link-local address
0.0.0.0/0 - Default entry matching all other addresses
Thoughts?

source: packetlife.net by Jeremy Strech

These steps outline a more specific procedure for verifying that packets are being
 forwarded using CEF.

  • Enable CEF with the ip cef command.
  • Issue the clear ip cache command to clear the fast-switched cache entries.
  • Start your traffic stream.
  • Issue the show ip cache command.
  •  Confirm that no entries are displayed in the fast-switched cache since the packets are  CEF-switched.
  •  Issue the show interface stats command and confirm  incremental hits  for route cache inbound.

Note: The route cache counter includes both fast-switched and CEF-switched packets.
  • Disable CEF with the no ip route-cache cef command on the inbound interface.
  • Issue the show interface stats command and confirm incremental hits for route cache.
  • Issue the show ip cache command and confirm that you see entries since Cisco IOS has fallen back to fast switching.
  •  Issue the no ip route-cache command on the outbound  interface to disable fast switching.
  •  Packets on the matching inbound interface are process switched.

Note: It is not recommended to configure process switching in a heavy traffic network.

  • The input interface determines the Cisco IOS switching path that a packet takes. 

Consider these rules of thumb when you enable or disable switching methods on a particular interface.



In other words, you need CEF to be enabled on the incoming interface for packets to be 
CEF switched. Since CEF makes  the forwarding decision on input, use the no ip route-cache
 cef command on the ingress interface to disable CEF. In contrast, since Cisco IOS builds
 a fast-switching cache entry after switching a packet,  a packet that comes in on a process-switched interface and goes out through a fast-switched  interface is fast switched, use the no ip route-cache  command on the egress interface to disable fast switching. These traffic types are not CEF switched:


  • Packets for which there is no entry in the switching cache
  • Packets destined for the router
  • Broadcast traffic
  • IP packets with options
  • Packets that require protocol translation
  • Encrypted traffic


Lab Work:

Please visit to the following link for lab work on YouTube:


references:
http://www.cisco.com/en/US/docs/ios-xml/ios/ipswitch_cef/configuration/12-4t/isw-cef-enable-disable.html
http://www.erg.abdn.ac.uk/~gorry/eg3561/inet-pages/router-opn.html
http://www.cisco.com/en/US/products/sw/iosswrel/ps1828/products_tech_note09186a00801e1e46.shtml

No comments:

Post a Comment