Q1. How does a host decide whether to send traffic directly or through a gateway?

A host performs a routing-table lookup for the destination IP address. In the common single-interface case, the connected route created from the host’s own IP address and subnet mask tells it whether the destination is on the local subnet. If the destination is local, the host sends the frame directly to the destination MAC address. If the destination is remote, the host sends the frame to the gateway MAC address while keeping the final destination IP address unchanged.

Q2. What does “same network” actually mean?

“Same network” means “same subnet after applying the subnet mask,” not necessarily the same physical place. For example, 192.168.1.10/24 and 192.168.1.20/24 are in the same subnet, but 192.168.1.10/24 and 192.168.2.20/24 are not.

Q3. Why is the subnet mask necessary?

An IP address alone does not fully tell whether another IP address is local or remote. The subnet mask defines which part of the address represents the network portion, so the host can derive an on-link network and decide whether to use direct L2 delivery or a gateway route.

For example, 10.1.1.10/24 and 10.1.2.20/24 are in different networks, but 10.1.1.10/16 and 10.1.2.20/16 both belong to the 10.1.0.0/16 network.

Q4. What is a gateway?

A gateway is the local L3 device, or the IP address of that device, that receives packets destined for other networks and routes them onward. The gateway must be reachable from the host’s own local network, because the host needs to send an Ethernet frame to the gateway’s MAC address first.

Q5. What does ARP ask, and who answers?

ARP maps an IPv4 address to a MAC address inside the same L2 broadcast domain. A host broadcasts a question like “Who has this IP address?”, and only the device that owns that IP address replies with its MAC address.

For a same-subnet destination, ARP asks for the destination host’s MAC address. For a different-subnet destination, ARP asks for the gateway’s MAC address, not the final destination’s MAC address.

Q6. How does an L3 switch fit into this model?

An L3 switch can act as the gateway for multiple subnets or VLANs. It reads the destination IP address, checks its routing table, and forwards the packet toward the correct network. Its core role is routing between IP networks, not choosing among multiple backend servers.

Q7. How is an L3 switch different from an L4 switch or load balancer?

An L3 switch chooses the next network path mainly through IP routing. An L4 switch or L4 load balancer uses IP addresses, TCP/UDP ports, and connection information to distribute traffic to backend servers behind a virtual IP address. A load balancer is the broader role: it may operate at L4 or L7.

Q8. What is the durable mental model?

The host chooses a next hop from its routing table. Local subnet means “send directly to the destination MAC address.” Remote subnet means “send to the gateway MAC address.” ARP finds the MAC address for the next local hop, while L3 routing decides where the IP packet should go beyond the local network.