What's new on the 127.0.0/24 block in 7?
Andy Dills
andy at xecu.net
Wed Mar 5 05:53:11 UTC 2008
Just to provide a little information in case there is still confusion...
On Tue, 4 Mar 2008, Chris H. wrote:
> Quoting Greg Black <freebsd at mail.gbch.net>:
>
> > On 2008-03-04, Chris H. wrote:
> >
> > > Yes, adding an entry in /etc/rc.conf that provides 254 IP's now
> > > reveals:
> > > lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
> > > inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64
> > > scopeid 0x3 inet 127.0.0.1 netmask 0xffffff00
> > >
> > > as opposed to: 0xffffffff.
> >
> > If you think the above shows evidence of providing 254 IP addresses,
> > it's really time either to catch up on some sleep or learn how these
> > things work.
>
> Quite so. That was my point; adding netmask 255.255.255.0
> (0xffffff00) gave me 254 addresses. While the netmask
> 0xffffffff provides 1.
At the risk of being pedantic, I'm afraid that isn't true. If adding
netmask 255.255.255.0 provided 255 addresses, adding the (default in every
version of FreeBSD I'm aware of) netmask of 255.0.0.0 would provide
255x255x255 addresses. That said, there is no way to ifconfig multiple
addresses with a single address entry.
The netmask of an IP bound to an interface determines the scope of the
logical network that can be reached through the given interface, not a
range of addresses bound to the interface. So, 127.0.0.1 with a mask of
255.255.255.0 means 127.0.0.0-255 would be reachable via lo0, whereas
127.0.0.1 with a mask of 255.0.0.0 means 127.0-255.0-255.0-255 would
be reachable via lo0.
In neither case would 127.0.0.2 be bound to lo0 implicitly, you would need
to explicitly ifconfig them as aliases for them to be bound to lo0.
No worries regardless, netmasks are a common source of misunderstanding
and confusion. In a routing context, the subnet mask does indeed affect
every address within the subnet, however when binding addresses to an
interface, the subnet mask merely controls which addresses are reachable
locally on layer 2.
Andy
---
Andy Dills
Xecunet, Inc.
www.xecu.net
301-682-9972
---
More information about the freebsd-stable
mailing list