Forwarding - jibingl/CCNA-CCNP GitHub Wiki

Forwarding of Layer 2

Layers Match Rules What's done at the layer?
Layer 2 Exact match Forwarding

Source MAC Check

On the local switch, MAC-address table is enumerated to look for the source MAC address.

                                                                      Yes, reset time stamp; send to dest's port
                                                                    /
Source MAC ------ Check MAC-Address Table ------ Has the source MAC?
                                                                    \
                                                                      No, add an record; flood out

Forwarding of Layer 3

Layers Match Rules What's done at the layer?
Layer 3 Most specific match Decrement TTP; recompute IP header checksum; change MACs; recompute ethernet FCS; Forwarding

Most Specific Match (Longest-prefix Match)

image

Bitwise Operation

On the source host, the Bitwise operation determines to where a network package should be forward.

                  ..-------.
     Source IP ----\\       \              .-------.                          Yes, send to destination
                    ||  XOR  . ------------|        \                        /
Destination IP ----//       /              |   AND   | --------- Result zero?    
                  ``-------`       .-------|        /                        \
                                   |       `-------`                           No, sned to default gateway
                        Source IP mask
Examples Same subnet Different subnet
----> From 192.168.1.100/24 to 192.168.1.200/24 From 192.168.1.100/24 to 192.168.14.100/24
Sour IP 11000000.10101000.00000001.01100100 11000000.10101000.00000001.01100100
Dest IP 11000000.10101000.00000001.11001000 11000000.10101000.00001110.01100100
XOR 00000000.00000000.00000000.10101100 00000000.00000000.00001111.00000000
Sour Mask 11111111.11111111.11111111.00000000 11111111.11111111.11111111.00000000
AND 00000000.00000000.00000000.00000000 00000000.00000000.00001111.00000000

Forwarding Types of Routers

Type Arch of control&data planes Control plane Data plane
Software-based Shared CPU CPU
Hardware-based Separate CPU ASIC
Hybrid Separate CPU NP (Network Processor)

ASICs with TCAM memory is used as hardware in routers

L3 Forwarding Methods

Process Switching vs Fast Switching

     .---------------------------------------------------.                .---------------------------------------------------.
     |       .----------CONTROL PLANE------------.       |                |       .----------CONTROL PLANE------------.       |
     |       |  .-------------. .-------------.  |       |                |       |  .-------------. .-------------.  |       |
     |       |  |Routing Table| |  ARP Table  |  |       |                |       |  |Routing Table| |  ARP Table  |  |       |
     |       |  '---^-^-------' '-------^-^---'  |       |                |       |  '---^---------' '---------^---'  |       |
     |       '------^-^-----------------^-^------'       |                |       '------^---------------------^------'       |
     |       .------^-^----DATA PLANE---^-^------.       |                |       .------^------DATA PLANE-----^------.       |
     |       |      | |                 | |      |       |                |       |      |                     |      |       |
     |       |    lookup---(ip_input)---lookup   |       |                |       |    lookup---(ip_input)---lookup   |       |
     |----.  |     / /                   \ \     |  .----|                |----.  |     /   ........v.........  \     |  .----|
 --->|G0/0|-->----' /                     \ '---->--|G0/1|--->        --->|G0/0|-->----'    : Fast-Switching :   '---->--|G0/1|--->
 --->|    |-->-----'                       '----->--|    |--->        --->|    |-->---------:      Cache     :-------->--|    |--->
     |----'  |                                   |  '----|                |----'  |         ''''''''''''''''''        |  '----|
     |       '-----------------------------------'       |                |       '-----------------------------------'       |
     '---------------------------------------------------'                '---------------------------------------------------'

CEF (Cisco Express Forwarding)

     .---------------------------------------------------.
     |       .----------CONTROL PLANE------------.       |
     |       |  .-------------. .-------------.  |       |
     |       |  |Routing Table| |   ARP Table |  |       |
     |       |  '-----v-------' '--------v----'  |       |
     |       '--------v------------------v-------'       |
     |       .--------v----DATA PLANE----v-------.       |
     |       |  .-----v------------------v----.  |       |
     |       |  |     v       CEF        v    |  |       |
     |----.  |  | ....v........ .........v... |  |  .----|
 --->|G0/0|-->--| :    FIB    : : Adjacency : |-->--|G0/1|--->
 --->|    |-->--| :           : :   Table   : |-->--|    |--->
     |----'  |  ' ''''''''''''' ''''''''''''' '  |  '----|
     |       '-----------------------------------'       |
     '---------------------------------------------------'
  • FIB: Contains L3 next-hop information
  • Adjacency Table: Contains L2 next-hop information

CEF

Example Network Topolgy

image

1. FIB(Forwarding Information Base)

Using show ip cef to display FIB table information

image

show ip cef 10.10.23.0 detail

image

2. Adjacency Table

Using show adjacency detail to display the Adjacency Table detailed information

image

AABBCC000200 AABBCC000100 0800 represents DES-MAC SRC-MAC type, in our case, it is R2's E0/0 MAC R1's E0/0 MAC IPv4.

Directed Broadcast

Enable the router connected to the destination subnets to not drop but forward a broadcast package into the destination subnet.

R1(config-if)# ip directed-broadcast

Example: ping a broadcast IP of a remote subnet

⚠️ **GitHub.com Fallback** ⚠️