Routing table example of a router
192.168.1.0/24 порт 1 192.168.0.1,
1. First, the router receives an IP packet with a destination address of 192.168.1.22, and hits the routing table entry.
2, the router broadcasts the ARP message on port 1, and obtains the 192.168.0.1 MAC-адрес
3. The router uses the source MAC address (the MAC address of port 1) and the destination MAC address (the MAC address of 192.168.0.1) to encapsulate the received IP packets into Ethernet frames and send them out from port 1.
4. The switch receives the Ethernet frame, checks the destination ma address of the frame, and selects the interface corresponding to its own mac address table.
Cross-segment forwarding (without NAT) does not change the original IP message, but only changes the source and destination address of the Layer 2 frame.
Switch forwarding is based on the mac address table, not the routing table.