Pascal Hambourg wrote:
> Bob Proulx a écrit :
> >       up   ip addr add 192.168.1.43/24 dev eth0 label eth0:0
> 
> You don't even need to define a label, unless you want to display the
> additional addresses with ifconfig (not needed with ip addr ls).

Right.  But so many people use ifconfig that it is nice to add the
label so that if they use ifconfig they will get it listed.  Just to
make it play better with ifconfig use too.  Otherwise it is invisible
to ifconfig.

> > Personally I find that way simpler and looks nicer.  Then there is
> > never a problem with interfaces and virtual interfaces getting out of
> > sync with each other.  There is only ever one real interface and the
> > rest are simply slaved off of it.  But others don't like it and like
> > the implementation of many virtual interfaces.
> 
> IP aliases/labels are not virtual interfaces. And all the trouble comes
> from treating them as interfaces, which they are not.

Sorry I wasn't clear.  When I said "virtual interfaces" I meant
whatever it is that ifupdown calls the thing after the "iface"
statement.  I wasn't talking about the 'ip' aliases/labels.  Looking
through the ifupdown "man interfaces" doc I see that ifupdown calls
them "logical interfaces".  I should have used that term instead.
Sorry.

  man interfaces
       Stanzas defining logical interfaces start with a line
       consisting of the word "iface" followed by the name of the
       logical interface.

The problem with ifupdown logical interfaces getting out of sync was a
bug in some of the previous versions.  For example:

  auto eth0
  allow-hotplug eth0
  iface eth0 inet static
      address 192.168.1.42
      netmask 255.255.255.0
      gateway 192.168.1.1

  auto eth0:0
  allow-hotplug eth0:0
  iface eth0:0 inet static
      address 192.168.1.43
      netmask 255.255.255.0

Then this:

  # ifdown -a
  # ifup eth0:0

At one time that failed to work because ifupdown failed to understand
that eth0:0 required interaction with eth0.  And other operations that
required other dependencies to be handled first.  And similarly when
all of the interfaces are up but then the main interface is brought
down.  For example "ifup -a", "ifdown eth0" would bring down eth0 and
also eth0:0 too by virtue of it being on the same interface.  Then
"ifup eth0:0" would complain that the interface was already up when it
was not.  Things like that.  Supposedly all of those problems are
fixed now in the current ifupdown 0.7.44 in Wheezy.

The safer IMNHO way was to add "up" and "down" commands to run 'ip' to
add and delete those extra IP addresses whenever the main ifupdown
"logical interface" was brought up or down.  That meant that there was
only one stanza per physical interface and it handled everything.  And
then there was no possibility for the internal state of ifupdown to
become out of sync with other internal or external state.  IMNHO it
was simpler.  But other people say that doing it with up/down commands
is ugly and so now ifupdown has been enhanced to know about dependent
"logical interfaces".  And if that works for you then great!  There is
more than one way to do things.

Bob

Attachment: signature.asc
Description: Digital signature

Reply via email to