I tracerouted some computers on my home network and all were only 1 hop away. I sort of expected 2 hops because I thought maybe packets need to go through the router or gateway.

Surely this can't always be the case, right? There's nothing to guarantee that two arbitrary computers using the same wi-fi are within range of each other -- they can both be just in range of the access point from different directions.

If they aren't in range of each other, how does it work? If computer A wants to connect to computer B, does A first try directly, and failing that, then tries with two hops through the access point?


Traceroute is layer 3 on the OSI networking model. Wifi is at layer two. There could be a very complex wifi network with bridges, additional AP, and so. You wouldn't see it at the IP layer.

So, if your question is are all clients on an SSID directly connecting to each other via RF communication, the answer is no.


Consider how, on an Ethernet LAN, your packets can cross several Ethernet cables and hubs and switches before reaching your "first-hop router". The same is true of Wi-Fi (another name for 802.11 wireless Ethernet). Your Wi-Fi packet may be relayed by more than one Wi-Fi AP, go across wireless WDS backhaul links between APs, or even wired Ethernet backhaul links before reaching the first-hop IP router.

Traceroute measures IP layer (Network layer, layer 3) hops. It has absolutely no idea how many Wi-Fi layer (Data Link layer, layer 2) hops it may have traversed to get to the first IP-layer router.


I think that the most important point to clarify is the difference between layer 3 (L3) and layer 2 (L2) packet forwarding.

In a layer 2 environment (it includes switches and APs) the forwarding decisions are based on the MAC address. This means that a layer 2 device does not care about the IP address.

On the other side on a layer 3 environment the forwarding decisions are made upon the IP address. A network device that operates based on the IP address is know as router.

The traceroute software (note that traceroute is not a protocol) is based on the fact that at every L3 hop the router decrements by 1 the TTL (Time to live) of an IP packet and when a packet has TTL equal to 0 a "ICMP Time Exceeded" packet is sent to the source IP address (your traceroute software). To find the path the software generates simple IP packets starting with TTL equal to 1 and then adding 1 for each new packet emitted until the last hop is discovered.

In a L2 environment since the devices do not care about the IP layer they do not decrement the TTL. The result is that you could, for example, traverse a huge number of L2 devices with a single L3 hop (namely the destination host).

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.