Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 791
Torpedo Avatar asked Feb 13 '23 22:02

Torpedo


2 Answers

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).

like image 148
Ansgar Wiechers Avatar answered Apr 08 '23 04:04

Ansgar Wiechers


My IP is 182.168.1.4 and when I trace route to that device I get.

shiva:ToDoList sparcs$ traceroute shiva
traceroute to shiva.home (192.168.1.4), 64 hops max, 52 byte packets
 1  shiva.home (192.168.1.4)  78.566 ms  0.060 ms  0.039 ms

There is no hop, or a router that is needed to get to another network as your device is local.

So, its telling you the exact route.

When tracerouting to my iPhone I get

shiva:ToDoList sparcs$ traceroute Sparcs
traceroute to 192.168.35.181 (192.168.1.181), 64 hops max, 52 byte packets
 1  192.168.35.181 (192.168.35.181)  5.129 ms  5.317 ms  5.976 ms

Its on the same segment.

Your questions :

Why is the information about the router not shown?

  1. Does router act as a switch here, or
    Not relevent, not needed in regards to trace route functional intent

  2. Does it not return the packet if the packet is being forwarded on the same interface?
    No

  3. The packet does not go through the router at all.
    True

  4. Once it gets the MAC address of the destination, does it directly send it to the destination?
    No

  5. My doubt here is the packet will still go through the router, right?
    No

  6. Will it just act as a pass through for these packets?
    No

Good read: http://www.cisco.com/en/US/products/sw/iosswrel/ps1831/products_tech_note09186a00800a6057.shtml

like image 22
Thinkhear Avatar answered Apr 08 '23 06:04

Thinkhear