Why does traceroute to a device on my network show just one ip address

Torpedo picture Torpedo · Feb 3, 2014 · Viewed 18k times · Source

I have a local network here. I am doing traceroute to another system on the same network. I was expecting two results. One is the hit to my router, and then to the other machine. But I see just one result as follows

1    13 ms   4 ms  12 ms   nj-PC [192.168.1.110]

Why is the information about the router not shown?

1) Does router act as a switch here, or

2) Does it not return the packet if the packet is being forwarded on the same interface? or

3) The packet does not go through the router at all. Once it gets the MAC address of the destination, does it directly send it to the destination? My doubt here is the packet will still go through the router, right? Will it just act as a pass through for these packets?

Answer

Ansgar Wiechers picture Ansgar Wiechers · Mar 16, 2014

Basically, what happens when you run traceroute nj-PC is this:

  1. The source host resolves nj-PC to an IP address. (won't go into the details of that here)
  2. The source host checks its local routing table for a route to that IP address.
    Example routing table:

    Destination   Gateway        Genmask         ...
    0.0.0.0       192.168.1.254  0.0.0.0         ...  # default route
    192.168.2.0   192.168.1.253  255.255.255.0   ...  # net route
    192.168.3.23  192.168.1.252  255.255.255.255 ...  # host route
    192.168.1.0   0.0.0.0        255.255.255.0   ...  # directly reachable
    
  3. If the destination is directly reachable (gateway 0.0.0.0 or On-link, depending on your operating system), the MAC address of the destination IP address is resolved via ARP and the packet is sent directly to the destination host (via Ethernet).

  4. If the destination is not directly reachable, the MAC address of the gateway IP address is resolved via ARP and the packet is passed to the the gateway (via Ethernet) who then forwards it according to its own routing tables.
  5. The default route catches all destination addresses that are not reachable either directly or via an explicit host or net route. As before, the MAC address of the (default) gateway is resolved via ARP and the packet is passed to the gateway via Ethernet for further delivery.

In your case both source and destination IP address are in the same subnet, so the destination is directly reachable and the packet is thus delivered directly without router involvement. That's why you see only a single hop in the traceroute output.

The router device may still act as a switch here, if it has a built-in switch and both devices are connected to that switch, but that's a different matter and unrelated to routing. Switching (Ethernet) takes place in the data link layer (layer 2 of the OSI model), whereas routing (IP) takes place in the network layer (layer 3).