Second-level forwarding: When a, B or C, D communicate with each other, they go is two-layer forwarding.
The first step:
A--> B. Because the source IP of the message and the destination IP are in the same network segment, it will be forwarded two layers, query the PCT table, determine the port. Because the PCT table is empty at this time:
Mac |
Vlan |
Interface (physical port) |
As a result, the switch broadcasts a message sent by A to B, sends it to all the member ports in the VLAN, and B of course receives it normally. At the same time, the switch adds the Mac, VLAN, and port information for a corresponding to the PCT table entry, when the PCT table entry becomes the following form.
Mac |
Vlan |
Interface (physical port) |
Mac_a |
Vlan_1 |
1 |
Step Two:
B-->a. The process, like the first send to B, is broadcast as a broadcast message to all ports within the VLAN, while the switch learns information about B and adds it to the PCT table.
Mac |
Vlan |
Interface (physical port) |
Mac_a |
Vlan_1 |
1 |
Mac_b |
Vlan_1 |
2 |
Step Three:
When A and B communicate again, the PCT table is queried directly, the corresponding interface is found, and the message is forwarded out. The three steps above are the entire process of two-tier forwarding.
Three-layer forwarding: When a, B and C, D, they are going to go three layer forwarding. This is illustrated by a different diagram below.
Note: SW L2 switch, R router, PC General terminal, all links Support 802.1Q label message.
Other conditions:
PC1 The Boot configuration IP is 192.168.0.4/24, the default gateway 192.168.0.1;
PC2 The Boot configuration IP is 192.168.1.6/24, the default gateway 192.168.1.1;
Switch SW1 port S1 is access, port S2 is trunk, all join vlan10;
Switch SW2 port W1 is access, Port W2 is trunk, all join Vlan20;
Router R Port 1 is a three-tier routing interface, adding Vlan10,ip to 192.168.0.1/24;
Router R Port 2 is a three-tier routing interface, adding Vlan20,ip to 192.168.1.1/24;
The first step:
Pc1--> Whether the same network segment (No!) --three-layer forwarding --Anza by Table (No!) --only send the message to its default gateway (192.168.0.1)- --Check the ARP table entry (No!). )-- send ARP broadcast Messages
ARP Request (PC1)
Dm |
Sm |
Ethernet Frame Type |
Mapping Protocol types |
SI |
DI |
Data |
All f (broadcast address) |
PC1 MAC |
0x0806 (ARP) |
0x0800 (IP) |
PC1 IP |
R1 IP |
Data |
Step Two:
Sw1--> received ARP message from S1 (access), message plus VLAN10 tag: 1, update Sm+vlan (PC1) to PCT table (MAC table)--in VLAN10 broadcast, including S2 (trunk)
ARP Request (SW1)
DM |
SM |
Frame Tpye |
VID |
Ethernet frame type |
Map protocol type |
SI |
DI |
Data |
|
PC1 MAC |
VLAN |
" (ARP) |
0x0800 (IP) |
PC1 IP |
R1 IP |
Data |
(the switch only acts as a pass-through, a VLAN , and does not change any of the message fields)
Step Three:
R--> Routing Interface R1 received SW1 message: 1, update the direct-connect route PC1 to the FIB table (forwarding), 2, update pc1 mac and IP to ARP table, 3, update Sm+vlan (PC1) to the PCT table, and the destination IP is Port R1, Respond to ARP requests from R1 (Switch-only transmission, all do not update the switch's MAC to the table key)
ARP Response (routed interface R1)
Dm |
Sm |
Frame Tpye |
VID |
Ethernet Frame Type |
Mapping Protocol types |
SI |
DI |
Data |
PC1 MAC |
R1 MAC |
0X8100 (802.1q) |
VLAN 10 |
0x0806 (ARP) |
0x0800 (IP) |
R1 IP |
PC1 IP |
Data |
Fourth Step:
Sw1--> received ARP messages from S2 (trunk), S2 belong to Vlan10:1, update Sm+vlan (R1) to pct table --and PCT table, Dm+vlan (PC1) hit S1 interface -- > Remove VLAN tags from the s1 port
ARP Response (SW1)
Dm |
Sm |
Ethernet Frame Type |
Mapping Protocol types |
SI |
DI |
Data |
PC1 MAC |
R1 MAC |
0x0806 (ARP) |
0x0800 (IP) |
R1 IP |
PC1 IP |
Data |
Fifth Step:
pc1-->1, update R1 mac and IP to ARP table, 2, update R1 Mac to Mac and package ping message (ICMP echo request message, ICMP is IP packet), send
ICMP echo request (PC1)
Dm |
Sm |
Protocol type |
Protocol |
ICMP type |
SI |
DI |
Data |
R1 MAC |
PC1 MAC |
0x0800 (IP) |
1 (ICMP) |
8 (Ping request) |
PC1 IP |
PC2 IP |
Data |
Sixth step:
Sw1--> received the message from S1, plus VLAN10 label --check PCT table, Dm+vlan (R1) hit S2 interface --from S2
ICMP echo request (SW1)
Dm |
Sm |
Frame Tpye |
VID |
Protocol type |
Protocol |
ICMP type |
SI |
DI |
Data |
R1 MAC |
PC1 MAC |
0X8100 (802.1q) |
VLAN 10 |
0x0800 (IP) |
1 (ICMP) |
8 (Ping request) |
PC1 IP |
PC2 IP |
Data |
Seventh Step:
R--> Routing Interface R1 received message,DM and Port MAC is equal (equal)--> three-layer forwarding -- > fib Table Entry --Maximum destination IP match, host (no!) ), network segment (192.168.1.0, Match!) ), hit out interface r2--> routing interface R2 and 1.0 network segment Direct connection, according to the destination IP (PC2) Check arp table, ARP miss! --encapsulates the ARP request message, plus the VLAN20 (R2) tag, in VLAN20 broadcast
ARP Request (routed interface R2)
Dm |
Sm |
Frame Tpye |
VID |
Ethernet Frame Type |
Mapping Protocol types |
SI |
DI |
Data |
All f (broadcast address) |
R2 MAC |
0X8100 (802.1q) |
VLAN 20 |
0x0806 (ARP) |
0x0800 (IP) |
R2 IP |
PC2 IP |
Data |
Eighth Step:
sw2--> receives an ARP message from W2 (trunk), W2 belongs to Vlan20:1, updates Sm+vlan (R2) to the PCT table --and in VLAN20 broadcast --Removes the VLAN tag, Issued from W1 (access)
ARP Request (SW2)
Dm |
Sm |
Ethernet Frame Type |
Mapping Protocol types |
SI |
DI |
Data |
All f (broadcast address) |
R2 MAC |
0x0806 (ARP) |
0x0800 (IP) |
R2 IP |
PC2 IP |
Data |
Nineth Step:
Pc2--> received SW2 message: 1, update R2 mac and IP to ARP table, 2, update R2 Mac to Mac table ---Destination IP is self, respond to ARP request, send message
ARP Response (PC1)
Dm |
Sm |
Ethernet Frame Type |
Mapping Protocol types |
SI |
DI |
Data |
R2 MAC |
PC2 MAC |
0x0806 (ARP) |
0x0800 (IP) |
PC2 IP |
R2 IP |
Data |
Tenth step:
Sw2:--> received ARP messages from W1 (access), plus VLAN20 Tags: 1, update Sm+vlan (PC2) to pct table --and PCT table, Dm+vlan (R2) hit W2 interface -- > Issued from W2
ARP Response (SW2)
Dm |
Sm |
Frame Tpye |
VID |
Ethernet Frame Type |
Mapping Protocol types |
SI |
DI |
Data |
R2 MAC |
PC2 MAC |
0X8100 (802.1q) |
VLAN 20 |
0x0806 (ARP) |
0x0800 (IP) |
PC2 IP |
R2 IP |
Data |
11th Step:
R--> Routing Interface R2 received SW2 message: 1, update the direct-connect Route PC2 to the Fib table, 2, update pc2 mac and IP to ARP table, 3, update Sm+vlan (PC2) to the PCT table, and construct the ICMP message, Plus VLAN20 label, send from R2 port
ICMP echo request (R)
Dm |
Sm |
Frame Tpye |
VID |
Protocol type |
Protocol |
ICMP type |
SI |
DI |
Data |
PC2 MAC |
R2 MAC |
0X8100 (802.1q) |
VLAN 20 |
0x0800 (IP) |
1 (ICMP) |
8 (Ping request) |
PC1 IP |
PC2 IP |
Data |
12th Step:
Sw2--> receives ICMP messages from W2 (trunk), W2 belongs to vlan20--> pct table, Dm+vlan (PC2) hits W1 interface --Removes VLAN tags, emits from w1 port
ICMP echo request (SW2)
Dm |
Sm |
Protocol type |
Protocol |
ICMP type |
SI |
DI |
Data |
PC2 MAC |
R2 MAC |
0x0800 (IP) |
1 (ICMP) |
8 (Ping request) |
PC1 IP |
PC2 IP |
Data |
13th Step:
Pc2--> received ICMP echo request: 1, update route PC1 to route table --Destination IP is itself, send ICMP echo response message --Anza by table, hit R2 next hop -- Check ARP table, get R2 mac address --encapsulation ICMP message, send
ICMP echo response (PC2)
Dm |
Sm |
Protocol type |
Protocol |
ICMP type |
SI |
DI |
Data |
R2 MAC |
PC2 MAC |
0x0800 (IP) |
1 (ICMP) |
0 (Ping Reply) |
PC2 IP |
PC1 IP |
Data |
Attention:
At this point, the PCT tables of SW1 and SW2, the FIB table of router R, the ARP table, and the PCT table are all complete, forwarding the ICMP echo reply message directly.
When the PC1 receives an ICMP message, it updates the PC2 route to the routing table.
14th Step:
Pc1--> receives an ICMP echo response: 1, updates the route PC2 to the routing table , reads the message data, and displays it to the screen after processing.
Host display Results
Three-layer forwarding mechanism: rely on IP forwarding, do not change the message destination IP and source IP, change the source Mac and the destination Mac.
(Table item Query step: 1, check fib table, find the next hop, hit out the interface.) 2, check the ARP table, hit the next hop Mac; otherwise ARP Miss,arp broadcast. 3, check the PCT table, hit the physical interface. )
Two-tier forwarding mechanism : relying on Mac (+vlan) forwarding, only focus on the destination Mac.
(Table item Query step: Check the PCT table, hit the physical out of the interface; otherwise broadcast the message within the Ethernet (VLAN). )
Router Update: FIB table,ARP table,MAC table
Host Update: ARP table,MAC table
Switch Update: MAC Table
I can't find them . The ARP table entry sends the ARP request message, who sends the ARP request to the source MAC in the message .
Two or three-layer forwarding