Take the 2-minute tour ×

The loopback network interface "is a virtual network device implemented entirely in software," according to another question on Unix.SE.

But how is this implementation actually accomplished, and how do you manipulate it?


ip route show table local  

Sending to an IP marked as local will trigger the loopback device. But is this detection done purely by routing tables or also by some other kernel operations?

My ultimate goal is to manipulate the loop-device configuration, so that sending datagrams between two WLAN adapters on my laptop will result in real traffic / datagrams in the network and not in local loops. That is:

Interface 1 -> WLAN -> Interface 2 

and NOT:

Interface 1 -> LOOP -> Interface 2
share|improve this question
...What exactly is it you want to change about its behavior? –  bahamat Aug 27 '12 at 16:09
Under what operating system? –  Gilles Aug 27 '12 at 23:50
@Gilles, ip route show table local indicates it's Linux –  poige Aug 28 '12 at 2:19
cross-post –  don_crissti Aug 28 '12 at 20:53
See updated unix.stackexchange.com/a/46448/6622 –  poige Oct 19 '12 at 23:55

2 Answers 2

On a very basic level, it's a device that's implemented purely in software. Similar to the way that a VM is entirely software, so is the loopback (although using quite different mechanisms).

Ordinarily when an interface sends a packet it eventually is put to the wire and flushed. The loopback on the other hand, instead of being put to the wire the outgoing packet is moved to the incoming queue for that interface and then processed like any incoming packet.

While netfilter is evaluating a packet there are two times when a routing decision is made. Once for incoming packets (e.g., was this packet received on the right interface?) and once for outgoing packets (e.g., what interface should this packet be transmitted on?). This routing decision is when the kernel checks the packet against the local routing table.

share|improve this answer

Routing table → device → device driver (loopback)

UPD. (2012-10-20): Recently ran into sysctl's doc.: «…

accept_local - BOOLEAN
    Accept packets with local source addresses. In combination
    with suitable routing, this can be used to direct packets
    between two local interfaces over the wire and have them
    accepted properly.

    accept_local to have an effect.

…», so it answers to the 2nd part of your question, hopefully.

share|improve this answer

Your Answer


