How Router forward packets || Evolution || RIB Vs FIB ||

 RIB Vs FIB



Cisco

show ip route
show ip cef

Juniper

show route 10.0.0.0/24           ← RIB (full route info)
show route forwarding-table      ← FIB (active, optimized)

## Evolution

1.Process switching  

Routing table (to find next hop).
ARP table (to resolve next hop IP to MAC).
Interface lookup.

2.Fast switching

Creates a fast-switching cache entry for this destination.
The cache stores:
Destination IP
Next-hop IP
Outgoing interface
MAC header to use (from ARP)

3.Modern Cisco routers use CEF,

which pre-builds a complete forwarding table (FIB) and adjacency table in hardware or software — no caching needed per flow.


How Router Forwards packets


Protocol-DB > RIB > FIB > Forwarding table - nexthop interface, MAC 

CAM - MAC,VLAN,INTERFACE (Complete match)

TCAM - IP,ACL etc (Longest Match)



Topology

R1-----g0/0-------g0/0-----R2------g1/0---------g0/0------R3-------Lo (100.100.100.100)


Configuration

#R1

g0/0 - 192.168.12.1/24 ca01.3c3c.0008
#R2
g0/0 - 192.168.12.2/24  ca02.6d80.0008
g1/0 - 192.168.23.1/24  ca02.6d80.001c
#R3
g0/0 - 192.168.23.2/24  ca03.984c.0008
- enabled ospf
- advertised 100.100.100.100 from R3 using network command

R1#show ip route

C    192.168.12.0/24 is directly connected, GigabitEthernet0/0
     100.0.0.0/32 is subnetted, 1 subnets                                           ### Cisco dose formatting
O       100.100.100.100 [110/3] via 192.168.12.2, 00:00:02, GigabitEthernet0/0
O    192.168.23.0/24 [110/2] via 192.168.12.2, 00:40:32, GigabitEthernet0/0

R1#sho ip cef

Prefix               Next Hop             Interface
0.0.0.0/0            no route
0.0.0.0/8            drop
0.0.0.0/32           receive
100.100.100.100/32   192.168.12.2         GigabitEthernet0/0
127.0.0.0/8          drop
192.168.12.0/24      attached             GigabitEthernet0/0
192.168.12.0/32      receive              GigabitEthernet0/0
192.168.12.1/32      receive              GigabitEthernet0/0
192.168.12.2/32      attached             GigabitEthernet0/0
192.168.12.255/32    receive              GigabitEthernet0/0
192.168.23.0/24      192.168.12.2         GigabitEthernet0/0
224.0.0.0/4          drop
224.0.0.0/24         receive
240.0.0.0/4          drop
255.255.255.255/32   receive

R1#show adjacency detail

Protocol Interface                 Address
IP       GigabitEthernet0/0        192.168.12.2(10)
                                   0 packets, 0 bytes
                                   epoch 0
                                   sourced in sev-epoch 0
                                   Encap length 14
                                   CA026D800008CA013C3C00080800   ##dmac smac ethtype
                                   ARP

>>>>
CA026D800008
CA013C3C0008
0800
>>>>

R2#show  ip route

C    192.168.12.0/24 is directly connected, GigabitEthernet0/0
     100.0.0.0/32 is subnetted, 1 subnets
O       100.100.100.100 [110/2] via 192.168.23.2, 00:02:04, GigabitEthernet1/0
C    192.168.23.0/24 is directly connected, GigabitEthernet1/0

R2#sho ip cef

Prefix               Next Hop             Interface
0.0.0.0/0            no route
0.0.0.0/8            drop
0.0.0.0/32           receive
100.100.100.100/32   192.168.23.2         GigabitEthernet1/0
127.0.0.0/8          drop
192.168.12.0/24      attached             GigabitEthernet0/0
192.168.12.0/32      receive              GigabitEthernet0/0
192.168.12.1/32      attached             GigabitEthernet0/0
192.168.12.2/32      receive              GigabitEthernet0/0
192.168.12.255/32    receive              GigabitEthernet0/0
192.168.23.0/24      attached             GigabitEthernet1/0
192.168.23.0/32      receive              GigabitEthernet1/0
192.168.23.1/32      receive              GigabitEthernet1/0
192.168.23.2/32      attached             GigabitEthernet1/0
192.168.23.255/32    receive              GigabitEthernet1/0
224.0.0.0/4          drop
224.0.0.0/24         receive
240.0.0.0/4          drop
255.255.255.255/32   receive

R2#show adjacency detail

Protocol Interface                 Address
IP       GigabitEthernet0/0        192.168.12.1(6)
                                   0 packets, 0 bytes
                                   epoch 0
                                   sourced in sev-epoch 0
                                   Encap length 14
                                   CA013C3C0008CA026D8000080800
                                   ARP
IP       GigabitEthernet1/0        192.168.23.2(9)
                                   0 packets, 0 bytes
                                   epoch 0
                                   sourced in sev-epoch 0
                                   Encap length 14
                                   CA03984C0008CA026D80001C0800
                                   ARP






Comments

Popular posts from this blog

gNMI_with_grafana on containerlabs

EVPN Route type-1 & type-4 in action

Network Automation with ROBOT Framework