Packet communication between different network segments host A communicates with host C, A Ping C, figure: A-switch-router M-router N-switch-C, AC different subnets (1) if two machines are not in the same subnet, A must communicate with Objective C. A must send an ARP packet to the "Default Gateway", and the IP address of the "Default Gateway" is already set in system. The IP address actually corresponds to the E0 IP address of the router M. Therefore, when A broadcasted an ARP request to the IP address of the "Default Gateway", the MAC address of the E0 port of the router M is returned to, in this case, the target MAC address of the packet is replaced with the E0 port MAC address of M. After www.2cto.com (2) MAC is replaced, it is transmitted to the physical layer of the switch, then to the data link layer of the switch, and then to the physical layer through the data link layer. (3) pass through the bit to the physical layer of the router M, and then transmit it to the data link layer. The destination IP address is compared with the router M's three-layer IP route table. If the match is correct, it is handed over to the upper layer for processing, otherwise, the data packet content will be cached, and relevant table items will be found in the route table based on the target address to obtain the MAC address of NEXTHOP and the outbound interface, the two addresses are used as the new destination and source MAC addresses to encapsulate pre-cached data packets and then forward the packets. This process is called frame rewriting (REWRITE ). After www.2cto.com (4) repeats MAC replacement, find the table items matching the destination IP address in Vron N. If N contains the MAC table items corresponding to C, data is transmitted to the network layer of the C, otherwise N sends the MAC of the ARP Broadcast Request C. (5) When C receives A packet, it performs A reverse MAC replacement process from A to C. In the reverse process, the MAC for ARP request next hop is omitted in each step, because the MAC table has been created.