Are TCP packets destined to local IP (not localhost) re-routed through the adapter or sent on wire?

Posted on 2010-09-23
Last Modified: 2012-08-14
If I have a server and client running on the same machine, is it better to bind the server to localhost rather than the ethernet IP address? I realize I can bind to both or even all interfaces ( And I also realize UNIX sockets might be better for inter-process communication. My question is really to understand if TCP packets destined to the local server IP address are re-routed though the TCP/IP stack in the same way that packets destined to localhost ( are. Or does that traffic actually hit the physical layer?

My question is UNIX (Linux) specific.
Question by:Uncle_J
LVL 68

Accepted Solution

Qlemo earned 400 total points
ID: 33749252
The difference between localhost and the real IP is that latter might pass thru all IP layers, but not the physical. In no case the packet is sent out on any media.

Assisted Solution

ashwin42 earned 100 total points
ID: 33749378
The packets are routed through the TCP/IP stack the same way as the packets destined for the localhost.

However they dont reach the physical layer as the packet reaches the IP address layer before it reaches the physical layer
LVL 24

Expert Comment

ID: 33749831
>My question is really to understand if TCP packets destined to the local server IP address are re-routed though the TCP/IP stack in the same way that packets destined to localhost (

It is all software based not touching any hardware (Never reaching the NIC), a frame is never built, so the TCP packet is never encapsulated into a frame. The last layer that the PDU (Packet) functions at is layer 3.


Author Closing Comment

ID: 33749930
Both gave the same answer, but Qlemo was in first so most point go to him. I did some testing verified the answer is true. Thank you.

Author Comment

ID: 33749936
Thank you rfc1180... Saw your response after I already awarded the points. I have my answer.. thank you all.

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: rfc1180
The Maximum Segment size (MSS) is an important consideration when troubleshooting connectivity via the Internet/Intranet. As the packets are routed via the Internet/Intranet, the packets must traverse through multiple routers in the path between two…
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Sending a Secure fax is easy with eFax Corporate ( First, just open a new email message. In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now