0

If the destination IPv4 host is within the local network, the frame will use the MAC address of this device and is used as the destination MAC address. For packets destined for external networks, which device’s MAC address would be used for the destination MAC address?

  • 1
    Usually (if not always) the gateway of the route. The most typical case would be your "default gateway" (usually your home router or a router of the ISP). – Tom Yan Nov 2 '19 at 4:11
  • Thank you so much, much appreciated for the quick reply. :) have a great day and an awesome months and years ahead. – user1108363 Nov 2 '19 at 4:15
0

If the destination IPv4 host is within the local network, the frame will use the MAC address of this device and is used as the destination MAC address. For packets destined for external networks, which device’s MAC address would be used for the destination MAC address?

The gateway's.

Routing table entries do not have an explicit indication whether the destination is local or not; it's implied from the absence or presence of the "gateway IP address" field. (The "local subnet mask" works the same way, it simply expands to a route entry without a gateway.)

So if the best matching route has a gateway set, then the destination is considered remote, and the source will use the gateway's MAC address as the destination MAC. (For this reason, the gateway itself must be local.)

Since the only job of the gateway IP address is to get resolved to a MAC address, this even allows unusual configurations like a route with IPv4 destination but IPv6 gateway.

(All of this only applies to broadcast-capable interfaces such as Ethernet or FireWire or 'tap'. Point-to-point interfaces such as PPP or 'tun' do not have MAC-layer addressing, so behavior in both cases is identical: the packet is simply sent to "the other end".)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.