A wants to send a datagram to B. A knows B's IP address. However B's MAC address is not in A's ARP table. So A broadcasts an ARP query packet to all machines on the LAN. B recognizes it's IP, so it responds by sending A it's MAC address.
Is this how it works? In this scenario, could A be a router? Doesn't seem to make sense, since routers are the ones that give each host its IP address, right? So shouldn't A always know what the MAC address for each IP address is?
If A is a host connected to a router, then does it still do this, or does it do something different?