I have two separate servers running on the same port on a Linux system, one binded to the loopback interface, and the other to the public Ethernet interface. If I connect a client on that system to the public socket, is the system smart enough to keep the traffic internal to itself?


No the data never leaves the box when it's addressing an IP address that's assigned to a local interface.

You can convince yourself of this fact by using traceroute to confirm.


Here's my wireless NIC on my Fedora 19 system.

$ ip -4 addr show wlp3s0 | grep inet
    inet brd scope global wlp3s0

It's assigned the IP address If we traceroute this IP:

$ traceroute
traceroute to (, 30 hops max, 60 byte packets
 1  greeneggs.bubba.net (  0.041 ms  0.013 ms  0.013 ms

Notice we never leave the box. It's a single hop so we're staying local to the system.

  • 1
    Follow-up question: what if I want to send the packet externally? – Gilles Dec 23 '13 at 1:08
  • actually this does not test whether the packet physically appears on the wire. you'll need to run a packet sniffer on the hub or from a different host on the same subnet and see if it shows up. – Michael Martinez Apr 18 '14 at 19:02
  • @MichaelMartinez - yes it does. If the packet egressed from the system we would've seen the IP of the router/switch when we performed the traceroute given how traceroutes work. – slm Apr 18 '14 at 23:52
  • won't a traceroute stop once it gets a reply from the target? in this case it won't record the ip of the router. it stops when it gets a response from eth0. but this still doesn't tell us whether the packet physically appeared on the wire. – Michael Martinez Apr 21 '14 at 17:38
  • @MichaelMartinez - traceroute induces ever node b/w the originator and the target to send a timeout reply packet. – slm Apr 21 '14 at 17:42

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.