I was somehow unable to google this.

When i send TCP packet to my own LAN IP, for example,, does this packet goes to switch and back, or is this transfer entirely handled by OS? If it goes to switch, what is the resoning for doing so, as handling everything locally on-device intuitively seems like a better solution? Thanks!

  • Routers route packets between networks, not on the same network.
    – Ron Maupin
    Nov 7, 2022 at 19:59
  • @Ron, Is this question valid if we replace "router" with "switch" ?
    – user124
    Nov 7, 2022 at 20:07
  • Switches don't route.
    – Ricky
    Nov 7, 2022 at 20:08
  • Ok, but does the packet goes to switch or is handled by the OS without involving switch?
    – user124
    Nov 7, 2022 at 20:10
  • A switch will not send a frame back through the interface on which it was received.
    – Ron Maupin
    Nov 7, 2022 at 23:14

2 Answers 2


When i send TCP packet to my own IP, does this packet go to router and back, or is this transfer entirely handled by OS?

No. Any reasonable host recognizes its own address and treats it as loopback (very much the same as The packet doesn't even leave the host, so no routers nor switches are involved.


This is a case for loopback. Most network stacks recognize their own interface address and deal with the packet locally. If for some reason the packet is put on the wire, because switches do not echo packets back to the origin port, the system would never see it. A router would never hairpin the traffic because (a) the traffic wasn't sent to it, and (b) it's traffic destined for the interface from which it was received.

(btw, that's why many servers that share a NIC between the system and management controller cannot talk to its own BMC.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.