I know this is a repeated question here, but I cant find any previous threads discussing the headers. Is my understanding of this correct?
Here's the scenario. Two hosts on different networks connected to a router
Host A 10.1.1.1/24 (MAC: AAAA.AAAA.AAAA)
Host B 10.2.2.2/24 (MAC: BBBB.BBBB.BBBB)
Here's my understanding of when host A pings host B.
- Host A pings Host B
- Host A first looks at Host B IP, performs the calculation in relation to its own subnet mask, it realizes its on a different network.
- Host A knows to send it to its default gateway.
- Since ping must be encapsulated, Host A creates an IP header with the+ source of itself (10.1.1.1) and destination of Host B (10.2.2.2).
- Ping then floats down the TCP/IP model, and now must build a Ethernet frame header.
- It plugs in itself as the source mac (AAAA.AAAA.AAAA) but it does not know the gateway's MAC. So it broadcast out FFFF.FFFF.FFFF.
- The router replies with a unicast of it's gateway mac
- Host A plugs in the router's gateway mac into the Ethernet frame header. And off goes the packet.
- The router then strips the layer 2, and sends the packet to host B.