Can anyone tell me, how a router deals with IP and MAC adresses when routing?
Lets imagine, there is a router with 2 interfaces: 192.168.1.14 and 192.168.2.14 with MAC addresses A and B respectively. There are two computers C and D with ip addresses 192.168.1.10 and 192.168.2.10, connected to the router's appropriate interfaces. What happens, when computer C ping computer D?
How I understand it, computer C takes routers mac address B as a destitanation MAC and computer's D IP for destination IP. Router, in its turn, replaces source IP address (192.168.1.10) with its interface address (192.168.2.14) and sends the packet to computer D with source MAC address of computer C.
When computer D returns ping, the packet is sent to the router's 192.168.2.14 interface, as the packet was received with this IP address in the source field. How does router know, how to send this packet to computer C? By inspecting destination MAC address field?