[Linux-ha-dev] Re: IPaddr on *BSD
Andrew Beekhof
beekhof at gmail.com
Wed Aug 16 06:27:56 MDT 2006
On 8/16/06, Andrew Beekhof <beekhof at gmail.com> wrote:
> On 8/15/06, Alan Robertson <alanr at unix.sh> wrote:
> > Lars Ellenberg wrote:
> > > / 2006-08-15 18:28:03 +0100
> > > \ David Lee:
> > >>> So, with IPaddr, if you do ifconfig afterwards, the interface for the IP
> > >>> address shows up. With IPaddr2, ifconfig will claim that no such
> > >>> address is managed.
> > >> Many thanks, Alan. Appreciated.
> > >>
> > >> Was this difference (visibility of resulting IP/interfaces) a deliberate
> > >> design choice? Or was it a side-effect?
> > >>
> > >> My instant, gut reaction (admittedly never having used the "...2" variant)
> > >> is that this hiding of the IP/interface from the system's "ifconfig"
> > >> command feels unclean.
> > >
> > > some thoughts...
> > >
> > > it is not exactly "hidden", it is just "unlabeled" by default,
> > > resulting in the label being the same as the base interface name.
> > >
> > > side-effect is that users which use ioctl(SIOCGIFCONF) to get the
> > > interface list _might_ get confused about the duplicate entry for eth0,
> > > and skip it.
> > >
> > > ifconfig is one such user, and does skip it.
> > >
> > > to illustrate:
> > > # ip -o -f inet a s
> > > 1: lo inet 127.0.0.1/8 scope host lo
> > > 2: eth0 inet 10.9.9.55/24 brd 10.9.9.255 scope global eth0
> > > # ip a add 10.11.12.13 dev eth0
> > > # ip -o -f inet a s
> > > 1: lo inet 127.0.0.1/8 scope host lo
> > > 2: eth0 inet 10.9.9.55/24 brd 10.9.9.255 scope global eth0
> > > 2: eth0 inet 10.11.12.13/32 scope global eth0
> > > # strace -e ioctl -o /dev/stdout ifconfig | head
> > > ioctl(4, SIOCGIFCONF, {96, {{"lo", {AF_INET, inet_addr("127.0.0.1")}},
> > > {"eth0", {AF_INET, inet_addr("10.9.9.55")}},
> > > {"eth0", {AF_INET, inet_addr("10.11.12.13")}}}}) = 0
> > >
> > > so, it does see it there. but it had already seen something named eth0,
> > > so it skips the second entry. that could even be "fixed" in ifconfig...
> > >
> > > if you add the alias ip with ifconfig, it labels it like "eth:x"
> > > (x smal decimal number).
> > > using ip, you could do the same, or label it "phony".
> > > for compatibility with linux 2.0 net aliases,
> > > the label has to start with the interface name, though.
> > >
> > > # ip a add 10.11.12.14 dev eth0 label eth0:ha_web
> > > # ip -o -f inet a s
> > > 1: lo inet 127.0.0.1/8 scope host lo
> > > 2: eth0 inet 10.9.9.55/24 brd 10.9.9.255 scope global eth0
> > > 2: eth0 inet 10.11.12.13/32 scope global eth0
> > > 2: eth0 inet 10.11.12.14/32 scope global eth0:ha_web
> > > # strace -e ioctl -o /dev/stdout ifconfig | head
> > > ioctl(4, SIOCGIFCONF, {128, {{"lo", {AF_INET, inet_addr("127.0.0.1")}},
> > > {"eth0", {AF_INET, inet_addr("10.9.9.55")}},
> > > {"eth0", {AF_INET, inet_addr("10.11.12.13")}},
> > > {"eth0:ha_web", {AF_INET, inet_addr("10.11.12.14")}}}}) = 0
> > >
> > > now this second alias has a different label than the base interface,
> > > so ifconfig does not get confused, and at least displays this second
> > > alias.
> > >
> > > compatibility note: there are "old" users that do get confused about
> > > the new-style "unlabeled" aliases. there are other users that do get
> > > confused when the network aliases are labeled the "oldfashioned" way.
> > > both users should be fixed.
> > > if some cannot be fixed (closed source),
> > > define an explicit label the style you need.
> >
> > By the way, the real reason why it's faster isn't ip versus ifconfig,
> > it's that IPaddr tries to create a name which isn't already used, and it
> > has to search the name space to find one.
> >
> > IIRC, it does the unfortunate, but unsurprising O(n^2) kind of thing to
> > find free ones. That means creating 256 aliases with IPaddr really
> > shouldn't be done except by masochists ;-).
>
> I dont believe you can create 256 anyway. One place I tested recently
> only showed the first digit in the ifconfig output which completely
> screwed everything up.
i just checked and it was indeed linux. sles10 to be precise.
which probably explains why CTS barfs with more than 7 nodes.
More information about the Linux-HA-Dev
mailing list