On at least two version of Linux (Ubuntu 9 and Debian 7) I've noticed that, even though I only have a single loopback address configured on lo (the standard 127.0.0.1 one), it happily accepts packets to ANY 127.x.x.x address. I found this quite surprising, since other Unix variants drop packets for unconfigured addresses.
- Why/how does it do this? This doesn't happen for any other address range, does it?
- How do I get it to do the more sensible (and secure!) thing and actually pay attention to the addresses that are configured?
Edit: I've read RFC 5735, and it's a rather sloppy interpretation of that to go from "addresses within the entire 127.0.0.0/8 block do not legitimately appear on the network anywhere" to "this machine must accept packets for all of these IPs". After all, you don't see hosts accepting packets for all of 172.16.0.0/12, just because they have one of those addresses configured.
My intention was not to ask about the spec for the addresses, but about Linux's implementation of the logic for accepting packets. "Why" and "how" here means what in the actual Linux kernel causes the normal "is this packet for me" logic to be bypassed?