Why do we have to connect through a default gateway in a LAN

arpbroadcastmac

I'm a beginner in networking and I'm looking for answers for these questions:

  1. Why do we have to connect through a default gateway when we are connected to a LAN and want to connect to another devices in the same network?
  2. Why is the destination MAC address in an ARP request all zeros? I thought it's a broadcast and it's supposed to be ff:ff:ff:ff:ff:ff.

Best Answer

Answer to first question:

In a LAN if the source and destination are part of the same subnet or broadcast domain then they do not need to pass through gateway. They can reach each other directly (typically in a bus topology). If any network device comes in between its a switch. A gateway comes into picture when you need to reach a host machine that is part of different LAN segment or both having different broadcast domain.

To determine whether two hosts are part of same network, two IP addresses are AND'd with a subnet mask if the result is the same then they are on the same network.

Answer to your second question:

The target mac address in the arp packet is by default set to zero and is ignored according to RFC 5227. The destination mac address in L2 header is correctly set to ff:ff:ff:ff:ff:ff for broadcast arp request.