[Xorp-users] XORP config - why 127.127.0.1

Bruce M Simpson bms@spc.org
Mon, 13 Mar 2006 21:52:07 +0000


On Mon, Mar 13, 2006 at 10:07:11AM +0000, Dave Price wrote:
> Can some explain the logic behind why this particular address
> is chosen.  I'm  quite used to the fact that 127.0.0.1
> refers to localhost of course, but I'd not picked
> up on signficance of 127.127.0.1

I wrote this, so I'll own up.

The discard interface, as implemented in most router operating systems,
is a special case of the loopback interface (Cisco IOS, FreeBSD).

Therefore I picked a specific address within 127.0.0.0/8 for those cases
where all traffic for a given destination should be discarded, when working
with next-hop resolution which doesn't treat discard next-hops as a special
case, i.e. code which only understands routes to specific IPv4 destinations,
such as the Windows FIB (which has no concept of a discard interface, or
indeed unnumbered IP interfaces for that matter).

The discard interface itself can be implemented in several ways at FIB level.
Both Cisco IOS and FreeBSD have discard interfaces which are fully fledged
IPv4 interfaces visible to the entire TCP/IP stack, and can broadly be
treated as 'like loopback, but goes nowhere'.

However, Linux (and older BSD derived implementations), rather than having
a separate and distinct 'discard interface', instead have a special flag
for a kernel FIB entry which says 'packets for this destination are to be
discarded' (RTF_BLACKHOLE).

The concept of the discard interface in XORP exists to deal with this
implementation difference. At XORP RIB level, it acts as an
interface to which packets may be forwarded much as any other directly
connected interface route where Layer 2 next-hop resolution is dealt
with by a lower layer (e.g. ARP, NDP, ATM-ARP) and the RIB/FIB need
merely transmit the packet on the interface.

The FEA takes care of mapping a XORP discard interface to a FIB flag or a
platform's real discard interface, if that helps (on FreeBSD, using the
fast-forwarding i.e. RTF_BLACKHOLE FIB path is actually faster, I
committed a patch from an OCCAID member well over a year ago to blackhole
more quickly).

Because many FIBs deal purely in terms of IPv4 next-hops, sometimes it's
necessary to just stuff something in there to keep it happy. You'll see this
if you dip down deep into the murky depths of the rtsock code in the FEA.

And 127.127.0.1 seemed less confusing (NTP is the only other application
I know of which overloads the meaning of 127/8 address space in this way).

This is probably more confusing than the original statement, but there you go!

Regards,
BMS