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?

As far as I know, IPs are marked as local in the local routing table:

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

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.


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.

    rp_filter must be set to a non-zero value in order for
    accept_local to have an effect.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .