Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Configuring multiple IP addresses on VLAN interface using ifupdown

1,069 views
Skip to first unread message

Steffen Dettmer

unread,
Oct 17, 2013, 1:00:03 PM10/17/13
to
Hi,

I'd like to configure multiple IP addresses to a VLAN tagged interface. I tried

auto eth3.107
iface eth3.77 inet static
address 10.0.5.15
netmask 255.255.255.0
iface eth3.77 inet static
address 10.0.5.16
netmask 255.255.255.0

but I get an error message that ifup tries to configure the VLAN
interface twice, but the addresses are set.

When I remove the second "iface eth3.77 inet static" line, which
should be correct according to my understanding of "man interfaces",
where it is not forbidding to pass multiple "address" directives in a
stanza, I get an error about unexpected "address" line and the
addresses are not set.

First I thought "ifup" would be a shell script, but apparently
ifupdown uses source code generation to generate Perl code from some
"noweb" code and uses the generated Perl code to generate C code which
then is compiled using a generated Makefile -- all this is not easy to
read / understand, so I decided to write a mail here hoping someone
can enlighten me :)

Best regards,
Steffen


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOBoUnOtvn9B6_VTopTSPuA_...@mail.gmail.com

Bob Proulx

unread,
Oct 17, 2013, 5:40:02 PM10/17/13
to
Steffen Dettmer wrote:
> I'd like to configure multiple IP addresses to a VLAN tagged
> interface. I tried

I am not a vlan expert. But...

> auto eth3.107
> iface eth3.77 inet static
> address 10.0.5.15
> netmask 255.255.255.0
> iface eth3.77 inet static
> address 10.0.5.16
> netmask 255.255.255.0

Terrible indention! I think you mean this:

> auto eth3.107
> iface eth3.77 inet static
> address 10.0.5.15
> netmask 255.255.255.0
> iface eth3.77 inet static
> address 10.0.5.16
> netmask 255.255.255.0

At which time it appears more obvious that while you have an "auto"
line for eth3.107 you do not have one for eth3.77. Do you mean this?

auto eth3.77
iface eth3.77 inet static
address 10.0.5.15
netmask 255.255.255.0
iface eth3.77 inet static
address 10.0.5.16
netmask 255.255.255.0

Of course I know nothing about vlan configuration so I am likely wrong
here. I just know that visually it doesn't match. However all of the
docs I see just now suggest using a bridge. Perhaps something like this.

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 10.0.5.15
netmask 255.255.255.0
iface eth0 inet static
address 10.0.5.16
netmask 255.255.255.0
iface eth0.77 inet manual
auto br0.77
iface br0.77 inet manual
bridge_ports eth0.77
bridge_fd 0
bridge_maxwait 0

But again, I just did that blind from the online docs. I am not a
vlan expert. Feel free to tell me I am wrong and do not know
anything. :-)

> but I get an error message that ifup tries to configure the VLAN
> interface twice, but the addresses are set.
>
> When I remove the second "iface eth3.77 inet static" line, which
> should be correct according to my understanding of "man interfaces",
> where it is not forbidding to pass multiple "address" directives in a
> stanza, I get an error about unexpected "address" line and the
> addresses are not set.

Configuring multiple IP addresses on interfaces like that is new in
recent versions of ifupdown. Whether it works or not depends upon
the version of the program. Previously it was necessary to use
different tagged interfaces or to use up/down commands to add
additional ip addresses.

> First I thought "ifup" would be a shell script, but apparently
> ifupdown uses source code generation to generate Perl code from some
> "noweb" code and uses the generated Perl code to generate C code which
> then is compiled using a generated Makefile -- all this is not easy to
> read / understand, so I decided to write a mail here hoping someone
> can enlighten me :)

It depends upon the version of ifupdown. Previously it used a
literate programming technique with TeX embedded documentation and C
code using "notangle" and .nw files.

apt-cache show noweb
Description-en: A WEB-like literate-programming tool
noweb is designed to meet the needs of literate programmers while
remaining as simple as possible. Its primary advantages are
simplicity, extensibility, and language-independence.
.
The noweb manual is only 3 pages; an additional page explains how to
customize its LaTeX output. noweb works ``out of the box'' with any
programming language, and supports TeX, latex, and HTML back ends.
.
The primary sacrifice relative to WEB is that code is not
prettyprinted.
Homepage: http://www.eecs.harvard.edu/~nr/noweb/

Recent versions have been converted to plain C. The changelog for
version 0.7.44 says:
* Convert from noweb to plain C

Bob
signature.asc

Tom H

unread,
Oct 18, 2013, 3:50:02 AM10/18/13
to
On Thu, Oct 17, 2013 at 12:57 PM, Steffen Dettmer
<steffen...@gmail.com> wrote:
>
> I'd like to configure multiple IP addresses to a VLAN tagged interface. I tried
>
> auto eth3.107
> iface eth3.77 inet static
> address 10.0.5.15
> netmask 255.255.255.0
> iface eth3.77 inet static
> address 10.0.5.16
> netmask 255.255.255.0
>
> but I get an error message that ifup tries to configure the VLAN
> interface twice, but the addresses are set.
>
> When I remove the second "iface eth3.77 inet static" line, which
> should be correct according to my understanding of "man interfaces",
> where it is not forbidding to pass multiple "address" directives in a
> stanza, I get an error about unexpected "address" line and the
> addresses are not set.

I assume that you mean "auto eth3.77" not "auto eth3.107".

Otherwise

auto eth3.107

iface eth3.77 inet static
address 10.0.5.15
netmask 255.255.255.0

iface eth3.77 inet static
address 10.0.5.16
netmask 255.255.255.0

works for me in the form of

allow-auto eth0.9

iface eth0.9 inet static
address 192.168.1.119
netmask 255.255.255.0
gateway 192.168.1.1

iface eth0.9 inet static
address 192.168.1.199
netmask 255.255.255.0

You definitely need an "iface eth0.9 inet static" for each ip address
assignment.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=Sx4eYX_tKHm-E8GzPBUOEP...@mail.gmail.com

Tom H

unread,
Oct 18, 2013, 4:00:02 AM10/18/13
to
On Thu, Oct 17, 2013 at 5:39 PM, Bob Proulx <b...@proulx.com> wrote:
> Steffen Dettmer wrote:
>>
>> I'd like to configure multiple IP addresses to a VLAN tagged
>> interface. I tried
>>
You're bridging in strange/incorrect way. :(

It's br0.77 that should have an ip address assigned and the physical
devices should have "inet manual" only.


>> but I get an error message that ifup tries to configure the VLAN
>> interface twice, but the addresses are set.
>>
>> When I remove the second "iface eth3.77 inet static" line, which
>> should be correct according to my understanding of "man interfaces",
>> where it is not forbidding to pass multiple "address" directives in a
>> stanza, I get an error about unexpected "address" line and the
>> addresses are not set.
>
> Configuring multiple IP addresses on interfaces like that is new in
> recent versions of ifupdown. Whether it works or not depends upon
> the version of the program. Previously it was necessary to use
> different tagged interfaces or to use up/down commands to add
> additional ip addresses.

Oops! I should've said that too in my earlier email!


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SyP7+mV=Yw_cSo+8KiCf=Muz8_4pVzuvt...@mail.gmail.com

Steffen Dettmer

unread,
Oct 18, 2013, 5:40:02 AM10/18/13
to
On Fri, Oct 18, 2013 at 9:40 AM, Tom H <tomh...@gmail.com> wrote:
> On Thu, Oct 17, 2013 at 12:57 PM, Steffen Dettmer
> <steffen...@gmail.com> wrote:
>> but I get an error message that ifup tries to configure the VLAN
>> interface twice, but the addresses are set.
> I assume that you mean "auto eth3.77" not "auto eth3.107".

Yes, of course, sorry for the typo. I C&P wrongly (I did too many
tests :)).

> works for me in the form of
>
> allow-auto eth0.9
>
> iface eth0.9 inet static
> address 192.168.1.119
> netmask 255.255.255.0
> gateway 192.168.1.1
>
> iface eth0.9 inet static
> address 192.168.1.199
> netmask 255.255.255.0

I used literally this (1:1 copied), but I get the same message I
had during my tests, about already existing interfaces.
Unfortunately they are not stored in any /var/log/* file, so I
hopefully retype correctly:

[....] Configuring network interfaces...Set name-type for VLAN subsystem. Should
be visible in /proc/net/vlan/config
ERROR: trying to add VLAN #9 to IF -:eth0- error: File exists
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config:
ERROR: trying to add VLAN #9 to IF -:eth0- error: File exists
done.

Beside this looks as vconfig messages are unexpected (they
distrub the screen layout), the big "ERROR" messages look really bad.

Regards,
Steffen


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOBoUnPK77nqaLV139Qn9MZU...@mail.gmail.com

Steffen Dettmer

unread,
Oct 18, 2013, 5:50:01 AM10/18/13
to
Hi!

On Thu, Oct 17, 2013 at 11:39 PM, Bob Proulx <b...@proulx.com> wrote:
> Steffen Dettmer wrote:
> However all of the docs I see just now suggest using a bridge.

There are docs recommending to take the burden of kernel software
briding to add an alias IP?!

> Configuring multiple IP addresses on interfaces like that is new in
> recent versions of ifupdown.

Wow, this is surprising! I considered it an old basic classic standard feature.

> Whether it works or not depends upon the version of the program.

Amazing.

> Previously it was necessary to use different tagged interfaces
> or to use up/down commands to add additional ip addresses.

Ahh, you mean I could try the old "eth0:0" approach? But I guess it
won't be compatible with VLANs.

>> First I thought "ifup" would be a shell script, but apparently
>> ifupdown uses source code generation to generate Perl code from some
>> "noweb" code and uses the generated Perl code to generate C code which
>> then is compiled using a generated Makefile -- all this is not easy to
>> read / understand, so I decided to write a mail here hoping someone
>> can enlighten me :)
>
> It depends upon the version of ifupdown. Previously it used a
> literate programming technique with TeX embedded documentation and C
> code using "notangle" and .nw files.

yeah, I see you also took a look :)

> apt-cache show noweb

Wikipedia tells:
noweb is a literate programming tool, created in 1989–1999 by Norman Ramsey.

But it seems to be maintained.

> Recent versions have been converted to plain C. The changelog for
> version 0.7.44 says:
> * Convert from noweb to plain C

Good to know :) But I think it is not yet released in stable.

Regards,
Steffen


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOBoUnNJ9wxydqnAVtK3OyXp...@mail.gmail.com

Steffen Dettmer

unread,
Oct 18, 2013, 6:00:02 AM10/18/13
to
On Fri, Oct 18, 2013 at 9:53 AM, Tom H <tomh...@gmail.com> wrote:
>> auto eth0
>> iface eth0 inet static
>> address 10.0.5.16
>> netmask 255.255.255.0
>> iface eth0.77 inet manual
>> auto br0.77
>> iface br0.77 inet manual
>> bridge_ports eth0.77
>> bridge_fd 0
>> bridge_maxwait 0
>>
> You're bridging in strange/incorrect way. :(
>
> It's br0.77 that should have an ip address assigned and the physical
> devices should have "inet manual" only.

The "physical" interface eth0.77 has no IP in the example above,
but is it possible to bridge VLAN devices?
I had assumed someone has to bridge e.g. eth0 and use the VLAN
tags only on top of br0.

Steffen


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOBoUnPzOR=8UEPA2He-=Ou8RRT2ssO-t0y...@mail.gmail.com

Tom H

unread,
Oct 18, 2013, 7:20:02 AM10/18/13
to
On Fri, Oct 18, 2013 at 5:33 AM, Steffen Dettmer
<steffen...@gmail.com> wrote:
> On Fri, Oct 18, 2013 at 9:40 AM, Tom H <tomh...@gmail.com> wrote:
>>
>> works for me in the form of
>>
>> allow-auto eth0.9
>>
>> iface eth0.9 inet static
>> address 192.168.1.119
>> netmask 255.255.255.0
>> gateway 192.168.1.1
>>
>> iface eth0.9 inet static
>> address 192.168.1.199
>> netmask 255.255.255.0
>
> I used literally this (1:1 copied), but I get the same message I
> had during my tests, about already existing interfaces.
> Unfortunately they are not stored in any /var/log/* file, so I
> hopefully retype correctly:
>
> [....] Configuring network interfaces...Set name-type for VLAN subsystem. Should
> be visible in /proc/net/vlan/config
> ERROR: trying to add VLAN #9 to IF -:eth0- error: File exists
> Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config:
> ERROR: trying to add VLAN #9 to IF -:eth0- error: File exists
> done.
>
> Beside this looks as vconfig messages are unexpected (they
> distrub the screen layout), the big "ERROR" messages look really bad.

So Bob must be right about your ifupdown version not using iproute
and, as he suggested, you're going to have to use the equivalent of:

allow-auto eth0.9
iface eth0.9 inet static
address 192.168.1.119
netmask 255.255.255.0
gateway 192.168.1.1
post-up ip address add 192.168.1.199/24 dev eth0.9


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=Syi2C1fai4sqRDcVg6KQs4...@mail.gmail.com

Steffen Dettmer

unread,
Oct 18, 2013, 8:10:01 AM10/18/13
to
Hi,

thanks again for your fast help.

On Fri, Oct 18, 2013 at 1:18 PM, Tom H <tomh...@gmail.com> wrote:
> So Bob must be right about your ifupdown version not using iproute

I'm using Wheezy with ifup version 0.7.8, I think this is the
latest officially released (aka "the best") one?

> and, as he suggested, you're going to have to use the equivalent of:
>
> allow-auto eth0.9
> iface eth0.9 inet static
> address 192.168.1.119
> netmask 255.255.255.0
> gateway 192.168.1.1
> post-up ip address add 192.168.1.199/24 dev eth0.9

I took this 1:1 resulting in the following /etc/network/interfaces file:

------------------------------------------------------------------->8=======
auto lo
iface lo inet loopback

allow-auto eth0.9
iface eth0.9 inet static
address 192.168.1.119
netmask 255.255.255.0
gateway 192.168.1.1
post-up ip address add 192.168.1.199/24 dev eth0.9
=======8<-------------------------------------------------------------------

Now I get "ERROR: trying to add VLAN #9 to IF -:eth0- error: File exists"
"only" once, but still.

Is the example above correct? Does it work for you? Could your
machine be boot so quickly that it might not be visible without
adding --noclear to /etc/inittab for tty1 getty?

Regards,
Steffen


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOBoUnMZyXhLcLgxbL-x1eWAWnDOeBrMO9760sHy=Reg2...@mail.gmail.com

Chris Davies

unread,
Oct 18, 2013, 8:30:02 AM10/18/13
to
Tom H <tomh...@gmail.com> wrote:
> iface eth3.77 inet static
> address 10.0.5.15

> iface eth3.77 inet static
> address 10.0.5.16

The Debian documentation at
http://www.debian.org/doc/manuals/debian-reference/ch05.en.html states
categorically, « Do not define duplicates of the "iface" stanza for a
network interface in "/etc/network/interfaces" ».

Is that only in relation to mapping, or a general warning?

Chris


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/o2j7jax...@news.roaima.co.uk

Tom H

unread,
Oct 18, 2013, 8:30:02 AM10/18/13
to
On Fri, Oct 18, 2013 at 9:49 AM, Steffen Dettmer
<steffen...@gmail.com> wrote:
> On Fri, Oct 18, 2013 at 9:53 AM, Tom H <tomh...@gmail.com> wrote:
>>>
>>> auto eth0
>>> iface eth0 inet static
>>> address 10.0.5.16
>>> netmask 255.255.255.0
>>> iface eth0.77 inet manual
>>> auto br0.77
>>> iface br0.77 inet manual
>>> bridge_ports eth0.77
>>> bridge_fd 0
>>> bridge_maxwait 0
>>
>> You're bridging in strange/incorrect way. :(
>>
>> It's br0.77 that should have an ip address assigned and the physical
>> devices should have "inet manual" only.
>
> The "physical" interface eth0.77 has no IP in the example above,
> but is it possible to bridge VLAN devices?
> I had assumed someone has to bridge e.g. eth0 and use the VLAN
> tags only on top of br0.

You can assign a VLAN to a bridge (or whatever the proper expression is!).

I don't know how it's done with "/etc/network/interfaces" but I do
know how to do so with RHEL ifcfg files so I can extrapolate
_something_ theoretical.

But the use-case that I have for that is different and I'm not too
sure how to transpose to yours, if it's at all possible.

The use-case is for connecting VMs on one host to different VLANs
(note: _different_ VLANs). So VM0's tap0 is added to br0.I, VM1's tap1
is added to br0.J, ethX (or bondX if you have bonds) is assigned to
VLANs x and y and added to br0.I and br0.J respectively, and these
bridges are assigned ip addresses.

So trying to mimick ifcfg files from memory (and keeping in mind that
in ifcfg files I'd have the equivalent of "allow-auto eth0",
"allow-auto eth0.I", "allow-auto eth0.J" too but it doesn't seem to be
needed in "/etc/network/interfaces"):

iface eth0 inet manual

iface eth0.I inet manual

iface eth0.J inet manual

allow-auto br0.I
iface br0.I inet static
bridge_ports eth0.I tap0
address ...
netmask ...
gateway ...
<other_bridge_stuff>

allow-auto br0.J
iface br0.J inet static
bridge_ports eth0.J tap1
address ...
netmask ...
gateway ...
<other_bridge_stuff>

So, in your case, assuming that you want a bridge:

iface eth0 inet manual

iface eth0.I inet manual

allow-auto br0.I
iface br0.I inet static
bridge_ports eth0.I
address ...
netmask ...
gateway ...
<other_bridge_stuff>
post-up ip address add ... dev br0.I


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SySJ485=upcPDqtLtjWc0_9bZ-PnnPVbLvctru4=+N...@mail.gmail.com

Miles Fidelman

unread,
Oct 18, 2013, 8:40:02 AM10/18/13
to
Steffen Dettmer wrote:
> Hi,
>
> I'd like to configure multiple IP addresses to a VLAN tagged interface. I tried
>
> auto eth3.107
> iface eth3.77 inet static
> address 10.0.5.15
> netmask 255.255.255.0
> iface eth3.77 inet static
> address 10.0.5.16
> netmask 255.255.255.0
>
> but I get an error message that ifup tries to configure the VLAN
> interface twice, but the addresses are set.
>
for what it's worth, my (working, for years) /etc/network/interfaces
file looks like this:

auto lo eth0 eth0:1 eth0:2 eth0:3 eth0:4 eth0:5 eth0:6 eth0:7 eth0:8
eth0:9 eth0
:10 eth0:11 eth0:12 eth0:13 eth0:14 eth0:15

iface eth0 inet static
address 207.154.13.48
netmask 255.255.255.224
network 207.154.13.32
broadcast 207.154.13.63
gateway 207.154.13.33
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 209.59.0.18 209.59.0.2
dns-search neighborhoods.net

iface eth0:1 inet static
address 207.154.13.49
netmask 255.255.255.224
broadcast 207.154.13.63

iface eth0:2 inet static
address 207.154.13.50
netmask 255.255.255.224
broadcast 207.154.13.63

<etc>

--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/52612AF7...@meetinghouse.net

Steffen Dettmer

unread,
Oct 18, 2013, 8:50:02 AM10/18/13
to
Hi,

just in case someone still reading my boring DHCP client attempts, to
complete the topic here my findings about behavior at shutdown. Even
with simply /etc/network/interfaces configuration:

allow-hotplug eth3.77
iface eth3.77 inet dhcp

and manually starting "ifup eth3.77" after boot, on shutdown there are
error messages from dhclient. According to syslog dhclient is not
killed but aborts with:

dhclient: receive_packet failed on eth3.77: Network is down

and very soon afterwards:

dhclient: Bind socket to interface: No such device

which leads to error messages to the console as well. I tried to
analyze with strace, but of course output is quite complex. dhclient
-v -r -pf [...] is called to release a lease, if any. Although pidfile
is specified, dhclient does not write to it. A bit later the pid from
the pid file is killed, this is not synchronized with waiting for the
started dhclient to finish nor for the killed dhclient to terminate.

I think this forms a race condition that on some systems may not lead
to an error.

Am I simply too picky when not wanting error messages on Console?

Interestingly ifdown kills pid from pidfile without further checking,
which IMHO also is wrong. For hotplug-interfaces it could be a very
old PID in the file and the number could have been reused by another
process (isn't it a bit unexpected to find such things in base
services like ifup that are supposed to be rock-solid?).

Steffen
Archive: http://lists.debian.org/CAOBoUnP1nR8UJ+GDs6KKKbN_...@mail.gmail.com

Tom H

unread,
Oct 18, 2013, 9:30:03 AM10/18/13
to
On Fri, Oct 18, 2013 at 12:05 PM, Steffen Dettmer
<steffen...@gmail.com> wrote:
> On Fri, Oct 18, 2013 at 1:18 PM, Tom H <tomh...@gmail.com> wrote:


> thanks again for your fast help.

You're welcome.


>> So Bob must be right about your ifupdown version not using iproute
>
> I'm using Wheezy with ifup version 0.7.8, I think this is the
> latest officially released (aka "the best") one?

Strange. I was under the impression that Debian 7's ifupdown is using
iproute but you had a vconfig error in an earlier email - and the
"trying to add" error below also looks like an ioctl error rather than
a netlink one.


>> and, as he suggested, you're going to have to use the equivalent of:
>>
>> allow-auto eth0.9
>> iface eth0.9 inet static
>> address 192.168.1.119
>> netmask 255.255.255.0
>> gateway 192.168.1.1
>> post-up ip address add 192.168.1.199/24 dev eth0.9
>
> I took this 1:1 resulting in the following /etc/network/interfaces file:
>
> ------------------------------------------------------------------->8=======
> auto lo
> iface lo inet loopback
>
> allow-auto eth0.9
> iface eth0.9 inet static
> address 192.168.1.119
> netmask 255.255.255.0
> gateway 192.168.1.1
> post-up ip address add 192.168.1.199/24 dev eth0.9
> =======8<-------------------------------------------------------------------
>
> Now I get "ERROR: trying to add VLAN #9 to IF -:eth0- error: File exists"
> "only" once, but still.

Does anyone know whether adding an ip address with ip to an interface
configured with ifconfig isn't possible? Probably not.

So the post-up should be "post-up ifconfig eth0.9:0 192.168.1.199
netmask 255.255.255.0 up", although I can't remember ever coming
across such an interface (or know whether it's possible to do
something like this with net-tools!).

Maybe you could try to do what you want using net-tools manually to
remove any ifupdown bug from the mix.

You'd need to take down your network and only have "lo" defined in
"/etc/network/interfaces" (or reboot with just "lo" defined). Then

ifconfig eth0 0.0.0.0 netmask 255.255.255.255 up
vconfig set_name_type DEV_PLUS_VID_NO_PAD
vconfig add eth0 9
ifconfig eth0.9 192.168.1.119 netmask 255.255.255.0 up
ifconfig eth0.9:0 192.168.1.199 netmask 255.255.255.0 up

to bring them up

and

ifconfig eth0.9:0 down
ifconfig eth0.9 down
vconfig rem eth0.9
ifconfig eth0 down

to take them down.

You could try to do the same with iproute but your system seems to be
a net-tools one, weirdly.


> Is the example above correct? Does it work for you? Could your
> machine be boot so quickly that it might not be visible without
> adding --noclear to /etc/inittab for tty1 getty?

I tested once. I just took down the network so that only "lo" was
defined and then brought it up with what I'd posted.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=Sya38OgE_dpsTDB3ZmBfxC...@mail.gmail.com

Tom H

unread,
Oct 18, 2013, 9:40:02 AM10/18/13
to
On Fri, Oct 18, 2013 at 12:35 PM, Miles Fidelman
<mfid...@meetinghouse.net> wrote:
eth0:1 is an alias.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SzJEQjYo3LjR51x=GZebX46kSGJEtJ...@mail.gmail.com

Tom H

unread,
Oct 18, 2013, 9:40:02 AM10/18/13
to
On Fri, Oct 18, 2013 at 11:36 AM, Chris Davies <ch...@roaima.co.uk> wrote:
> Tom H <tomh...@gmail.com> wrote:
>> iface eth3.77 inet static
>> address 10.0.5.15
>
>> iface eth3.77 inet static
>> address 10.0.5.16
>
> The Debian documentation at
> http://www.debian.org/doc/manuals/debian-reference/ch05.en.html states
> categorically, « Do not define duplicates of the "iface" stanza for a
> network interface in "/etc/network/interfaces" ».

Someone pointed this out the last time that ifupdown's new use of
iproute was discussed on this list and Bob P. pointed out that the
documentation hadn't yet caught up with that.

I'm pretty sure that the last time (six months ago?) Bob linked to a
Debian wiki page (or I googled my way to one) that used multiple iface
declarations for the same nic (I've also used multiple declarations).


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdoSyBykPBPNKEVcAtvzuqx...@mail.gmail.com

Miles Fidelman

unread,
Oct 18, 2013, 10:40:01 AM10/18/13
to
ummm... no, eth0:1 is a virtual interface riding on top of a physical
one (eth0 being the physical interface).

--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/526145F1...@meetinghouse.net

Tom H

unread,
Oct 18, 2013, 10:50:01 AM10/18/13
to
On Fri, Oct 18, 2013 at 2:30 PM, Miles Fidelman
<mfid...@meetinghouse.net> wrote:
> Tom H wrote:
>> On Fri, Oct 18, 2013 at 12:35 PM, Miles Fidelman
>> <mfid...@meetinghouse.net> wrote:
>>
>> eth0:1 is an alias.
>>
> ummm... no, eth0:1 is a virtual interface riding on top of a physical one
> (eth0 being the physical interface).

The OP's asking about eth0.1 NOT eth0:1.

They're both virtual. The first is an interface whose broadcast domain
is defined and limited by the "1" and the second is an alias that
allows you to assign extra ip addresses to an interface. The alias
concept and notation is the result of the old ioctl networking
infrastucture. In the new netlink networking infrastructure, you can
assign more than one address to ethX (but you can still label the
extra address/addresses with :I).


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SzRo22hCJZrrzzFsduKfUi...@mail.gmail.com

Steffen Dettmer

unread,
Oct 18, 2013, 12:10:02 PM10/18/13
to
Hi!

On Fri, Oct 18, 2013 at 3:24 PM, Tom H <tomh...@gmail.com> wrote:
>> I'm using Wheezy with ifup version 0.7.8, I think this is the
>> latest officially released (aka "the best") one?
>
> Strange. I was under the impression that Debian 7's ifupdown is using
> iproute but you had a vconfig error in an earlier email - and the
> "trying to add" error below also looks like an ioctl error rather than
> a netlink one.

Ahh, that is a good point, yes, of course, there are old-style
errors instead of this "NETLINK: file already exists"! I saw the
message but completed missed that.

I'm looking at "strace -e execve -f -o out ifup eth1.77", and one
one box I see:

(no stat "vconfig")
ip link add link eth1 name eth1.77 type vlan id 77

and on the other I see:

stat64("/sbin/vconfig", {st_mode=S_IFREG|0755, st_size=8032, ...}) = 0
vconfig set_name_type DEV_PLUS_VID_NO_PAD
vconfig add eth3 78

I think I manually installed package "vlan" on only this second
box at a previous test. This package is not on the first box
(altough documentation seems to suggest it would be needed).

If first strace would include stat(...vconfig...) I would assume
ifup tries vconfig and fall-backs to ip (but I think it should be
other way around), but may be there is a different way to detect
usage of vconfig...

> Does anyone know whether adding an ip address with ip to an interface
> configured with ifconfig isn't possible? Probably not.

On Shell and without VLAN, I'm used to create first IP with
"ifconfig ethX ip netmask ... up" and then use "ip addr add
...." (mostly because I always forget the ip link set up syntax :))
and this works, so simply setting IPs normally is no issue
(except that they are normally not visible in ifconfig of course).

> So the post-up should be "post-up ifconfig eth0.9:0 192.168.1.199
> netmask 255.255.255.0 up", although I can't remember ever coming
> across such an interface (or know whether it's possible to do
> something like this with net-tools!).

The following commands procedure no error:

ifconfig eth3.78:0 192.168.1.199 up
ip addr add 192.168.1.200 dev eth3.78
ip addr add 192.168.1.201 dev eth3.78:0 # funny :)

resulting in

9: eth3.78@eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UP
link/ether 08:00:27:46:0a:34 brd ff:ff:ff:ff:ff:ff
inet 10.0.5.15/24 brd 10.0.5.255 scope global eth3.78
inet 192.168.1.199/24 brd 192.168.1.255 scope global eth3.78:0
inet 192.168.1.199/32 scope global eth3.78
inet 192.168.1.200/32 scope global eth3.78

So seems to be nicely compatible.

> Maybe you could try to do what you want using net-tools manually to
> remove any ifupdown bug from the mix.

Yes, this could be an option, but probably taking a day to
implement and another for testing (I'm always optimistic, you see :)).

>> Is the example above correct? Does it work for you? Could your
>> machine be boot so quickly that it might not be visible without
>> adding --noclear to /etc/inittab for tty1 getty?
>
> I tested once. I just took down the network so that only "lo" was
> defined and then brought it up with what I'd posted.

Do you have package vlan installed? Maybe I should retest after
removing package "vlan"...

Steffen


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOBoUnNJoHDmb1tC5UbSwhRQ...@mail.gmail.com

Steffen Dettmer

unread,
Oct 18, 2013, 12:20:01 PM10/18/13
to
On Fri, Oct 18, 2013 at 3:24 PM, Tom H <tomh...@gmail.com> wrote:
>> ------------------------------------------------------------------->8=======
>> auto lo
>> iface lo inet loopback
>>
>> allow-auto eth0.9
>> iface eth0.9 inet static
>> address 192.168.1.119
>> netmask 255.255.255.0
>> gateway 192.168.1.1
>> post-up ip address add 192.168.1.199/24 dev eth0.9
>> =======8<-------------------------------------------------------------------
>> Is the example above correct? Does it work for you? Could your
>> machine be boot so quickly that it might not be visible without
>> adding --noclear to /etc/inittab for tty1 getty?
>
> I tested once. I just took down the network so that only "lo" was
> defined and then brought it up with what I'd posted.

I retested after "dpkg -P vlan", booted a couple of times and got
no single error. Seems this mean to use VLAN someone should better
not install package vlan... :-)

Good spot about the non-NETLINK errors!! Thanks so much, I completely
missed that!

So maybe there is just some issue about some vconfig
backward-compatiblity in ifup?

Have a great weekend, Tom and all the list!

Steffen


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOBoUnNKOkDh=bnb1jPuwv1XUWwdV_3vUU=FYecNGdnR7PN-=g...@mail.gmail.com

Bob Proulx

unread,
Oct 18, 2013, 4:10:01 PM10/18/13
to
Tom H wrote:
> Bob Proulx wrote:
> > Of course I know nothing about vlan configuration so I am likely wrong
> > here. I just know that visually it doesn't match. However all of the
> > docs I see just now suggest using a bridge. Perhaps something like this.
> >
> > auto eth0
> > allow-hotplug eth0
> > iface eth0 inet static
> > address 10.0.5.15
> > netmask 255.255.255.0
> > iface eth0 inet static
> > address 10.0.5.16
> > netmask 255.255.255.0
> > iface eth0.77 inet manual
> > auto br0.77
> > iface br0.77 inet manual
> > bridge_ports eth0.77
> > bridge_fd 0
> > bridge_maxwait 0
> >
> > But again, I just did that blind from the online docs. I am not a
> > vlan expert. Feel free to tell me I am wrong and do not know
> > anything. :-)
>
> You're bridging in strange/incorrect way. :(
>
> It's br0.77 that should have an ip address assigned and the physical
> devices should have "inet manual" only.

I don't doubt you. I suggested that due to the reference here. In
that it writes that both are possible and lists them as alternatives.

https://wiki.debian.org/LXC/VlanNetworking

Perhaps someone could update that documentation with the lastest known
best practices?

Bob
signature.asc

Bob Proulx

unread,
Oct 18, 2013, 4:40:02 PM10/18/13
to
Miles Fidelman wrote:
> for what it's worth, my (working, for years) /etc/network/interfaces
> file looks like this:

In addition to what Tom said, you have redundant network and broadcast
statements. If you specify the netmask then the network and broadcast
will be calculated from the netmask.

Better to reduce the configuration to the source input and let the
program calculate the dependent parts rather than doing so manually
and possibly making a mistake. Let the machine calculate it for you.

> iface eth0 inet static
> address 207.154.13.48
> netmask 255.255.255.224
> network 207.154.13.32
> broadcast 207.154.13.63
> ...

Since the netmask is specified the network and broadcast would
normally be calculated from it. Unless overridden. This is
sufficient.

address 207.154.13.48
netmask 255.255.255.224

> iface eth0:1 inet static
> address 207.154.13.49
> netmask 255.255.255.224
> broadcast 207.154.13.63

Same thing here. With netmask the broadcast statement is redundant.

> iface eth0:2 inet static
> address 207.154.13.50
> netmask 255.255.255.224
> broadcast 207.154.13.63

And here.

At one time in the long past the ifupdown examples included all
possible option statements. Which is typical of examples to show all
of the possibilities and then users can hack it as they need. But
this ended up with a lot of people thinking that all of those
statements were required and desired.

A year or so ago there was an effort to clean up those redundant
statements from the documentation. The ifupdown examples no longer
include them. They have been removed from the fine Debian Reference.
They have been removed from most wiki pages that have been found. So
I am hinting here to clean them up too. :-)

Bob
signature.asc

Bob Proulx

unread,
Oct 18, 2013, 5:10:01 PM10/18/13
to
Tom H wrote:
> Chris Davies wrote:
> > Tom H wrote:
> >> iface eth3.77 inet static
> >> address 10.0.5.15
> >
> >> iface eth3.77 inet static
> >> address 10.0.5.16
> >
> > The Debian documentation at
> > http://www.debian.org/doc/manuals/debian-reference/ch05.en.html states
> > categorically, « Do not define duplicates of the "iface" stanza for a
> > network interface in "/etc/network/interfaces" ».
>
> Someone pointed this out the last time that ifupdown's new use of
> iproute was discussed on this list and Bob P. pointed out that the
> documentation hadn't yet caught up with that.
>
> I'm pretty sure that the last time (six months ago?) Bob linked to a
> Debian wiki page (or I googled my way to one) that used multiple iface
> declarations for the same nic (I've also used multiple declarations).

Yes. This one.

https://wiki.debian.org/NetworkConfiguration#Multiple_IP_addresses_on_One_Interface

And note that in revision 61 2013-07-26 the ifupdown maintainer
updated the wiki page to the present form showing support for the new
style. I consider that to be an authoritative statement of support.

I just verified that the new style works in Stable Wheezy 7.

Previously the wiki page recommended using up/down commands to create
aliases manually. That was mostly due to a time when there was bugs
in the ifupdown program that didn't handle ethX:Y style interfaces
correctly. I personally prefer the up/down style but I know that
others don't like it. Each to their own.

Bob
signature.asc

Bob Proulx

unread,
Oct 18, 2013, 5:10:01 PM10/18/13
to
Steffen Dettmer wrote:
> Bob Proulx wrote:
> > However all of the docs I see just now suggest using a bridge.
>
> There are docs recommending to take the burden of kernel software
> briding to add an alias IP?!

But you were asking about VLANS not IP aliases!

Not wanting to distract from the discussion between you and Tom I am
going to refrain from saying more about that here and now.

> > Configuring multiple IP addresses on interfaces like that is new in
> > recent versions of ifupdown.
>
> Wow, this is surprising! I considered it an old basic classic
> standard feature.

Not like that. Not using the same iface sections repeated again.
That is a new feature. Previously that required either aliases or
explicit up/down commands.

Oldstable Squeeze 6 had ifupdown 0.6.10. Stable Wheezy 7 has 0.7.8.
Testing Jessie and Ustable Sid currently have 0.7.44.

The changelog says:

ifupdown (0.7~alpha4) experimental; urgency=low
* Allow multiple interface definitions to ease work with multiple IP per
interface.

So it looks like that feature went into Wheezy 7 and is available
since. I tested this on Wheezy 7 and it works for me there.

> > Whether it works or not depends upon the version of the program.
>
> Amazing.

Why? Isn't that the way of things? Time moves forward and creeping
features do too. Seems very typical and normal to me. :-)

Bob
signature.asc

Tom H

unread,
Oct 19, 2013, 12:10:02 PM10/19/13
to
Well "debugged"! You're right - and I agree that it should be the
other way around.


>> Does anyone know whether adding an ip address with ip to an interface
>> configured with ifconfig isn't possible? Probably not.
>
> On Shell and without VLAN, I'm used to create first IP with
> "ifconfig ethX ip netmask ... up" and then use "ip addr add
> ...." (mostly because I always forget the ip link set up syntax :))
> and this works, so simply setting IPs normally is no issue
> (except that they are normally not visible in ifconfig of course).
>
>> So the post-up should be "post-up ifconfig eth0.9:0 192.168.1.199
>> netmask 255.255.255.0 up", although I can't remember ever coming
>> across such an interface (or know whether it's possible to do
>> something like this with net-tools!).
>
> The following commands procedure no error:
>
> ifconfig eth3.78:0 192.168.1.199 up
> ip addr add 192.168.1.200 dev eth3.78
> ip addr add 192.168.1.201 dev eth3.78:0 # funny :)
>
> resulting in
>
> 9: eth3.78@eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> noqueue state UP
> link/ether 08:00:27:46:0a:34 brd ff:ff:ff:ff:ff:ff
> inet 10.0.5.15/24 brd 10.0.5.255 scope global eth3.78
> inet 192.168.1.199/24 brd 192.168.1.255 scope global eth3.78:0
> inet 192.168.1.199/32 scope global eth3.78
> inet 192.168.1.200/32 scope global eth3.78
>
> So seems to be nicely compatible.

Thanks. And ip understands the ifconfig alias as a label. This rings a
bell; I should've remembered this and know that they were compatible.
Sorry.

So the "post-up ..." failure was due to something else...


>> Maybe you could try to do what you want using net-tools manually to
>> remove any ifupdown bug from the mix.
>
> Yes, this could be an option, but probably taking a day to
> implement and another for testing (I'm always optimistic, you see :)).

OK. :)


>>> Is the example above correct? Does it work for you? Could your
>>> machine be boot so quickly that it might not be visible without
>>> adding --noclear to /etc/inittab for tty1 getty?
>>
>> I tested once. I just took down the network so that only "lo" was
>> defined and then brought it up with what I'd posted.
>
> Do you have package vlan installed? Maybe I should retest after
> removing package "vlan"...

No, vlan isn't installed. So the vlan settings are being applied using ip.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SzQZxG9LkFOe7noDS23C=z6=ZD=coKHn4uat...@mail.gmail.com

Tom H

unread,
Oct 19, 2013, 12:40:02 PM10/19/13
to
On Fri, Oct 18, 2013 at 4:11 PM, Steffen Dettmer
<steffen...@gmail.com> wrote:
> On Fri, Oct 18, 2013 at 3:24 PM, Tom H <tomh...@gmail.com> wrote:


>>> allow-auto eth0.9
>>> iface eth0.9 inet static
>>> address 192.168.1.119
>>> netmask 255.255.255.0
>>> gateway 192.168.1.1
>>> post-up ip address add 192.168.1.199/24 dev eth0.9
>>>
>>> Is the example above correct? Does it work for you? Could your
>>> machine be boot so quickly that it might not be visible without
>>> adding --noclear to /etc/inittab for tty1 getty?
>>
>> I tested once. I just took down the network so that only "lo" was
>> defined and then brought it up with what I'd posted.
>
> I retested after "dpkg -P vlan", booted a couple of times and got
> no single error. Seems this mean to use VLAN someone should better
> not install package vlan... :-)

It's theoretically deprecated like net-tools...


> Good spot about the non-NETLINK errors!! Thanks so much, I completely
> missed that!
>
> So maybe there is just some issue about some vconfig
> backward-compatiblity in ifup?
>
> Have a great weekend, Tom and all the list!

Thanks. You too.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SwtTru0YeJk3b_1OZiv_mH...@mail.gmail.com

Bonno Bloksma

unread,
Oct 21, 2013, 3:40:02 AM10/21/13
to
Hi Steffen,

>> allow-auto eth0.9
>> iface eth0.9 inet static
>> address 192.168.1.119
>> netmask 255.255.255.0
>> gateway 192.168.1.1
>> post-up ip address add 192.168.1.199/24 dev eth0.9

What I use is:
-=-=-=-=-=-
auto eth0
iface eth0 inet static
address 172.16.17.1
netmask 255.255.255.0

auto vlan100
iface vlan100 inet static
vlan-raw-device eth0
address 192.168.178.10
netmask 255.255.255.0
gateway 192.168.178.1
-=-=-=-=-=-
As you can see vlan 100 is my internet connection from my ADSL router to my Linux router. Eth0 is my Local LAN
This works for me as documented in the https://wiki.debian.org/NetworkConfiguration

Bonno Bloksma


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/89D1798A7351D040B4E7...@HGLEXCH-01.tio.nl

Tom H

unread,
Oct 21, 2013, 9:30:02 AM10/21/13
to
On Mon, Oct 21, 2013 at 7:29 AM, Bonno Bloksma <b.bl...@tio.nl> wrote:
>>>
>>> allow-auto eth0.9
>>> iface eth0.9 inet static
>>> address 192.168.1.119
>>> netmask 255.255.255.0
>>> gateway 192.168.1.1
>>> post-up ip address add 192.168.1.199/24 dev eth0.9
>
> What I use is:
> -=-=-=-=-=-
> auto eth0
> iface eth0 inet static
> address 172.16.17.1
> netmask 255.255.255.0
>
> auto vlan100
> iface vlan100 inet static
> vlan-raw-device eth0
> address 192.168.178.10
> netmask 255.255.255.0
> gateway 192.168.178.1
> -=-=-=-=-=-

This is just one address: Steffen was looking for a multiple-address method.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=Symew5T4+5+Ssrn5NxFSfjrxknZtZ6ajJC=Ku_X7...@mail.gmail.com

Chris Davies

unread,
Oct 21, 2013, 11:30:02 AM10/21/13
to
Bob Proulx <b...@proulx.com> wrote:
> Tom H wrote:
>> I'm pretty sure that the last time (six months ago?) Bob linked to a
>> Debian wiki page [...] that used multiple iface declarations for the
>> same nic (I've also used multiple declarations).

> https://wiki.debian.org/NetworkConfiguration#Multiple_IP_addresses_on_One_Interface

Thank you both
Chris


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/u3sfjax...@news.roaima.co.uk

Bonno Bloksma

unread,
Oct 22, 2013, 8:30:02 AM10/22/13
to
Hi,

>>>> allow-auto eth0.9
>>>> iface eth0.9 inet static
>>>> address 192.168.1.119
>>>> netmask 255.255.255.0
>>>> gateway 192.168.1.1
>>>> post-up ip address add 192.168.1.199/24 dev eth0.9
>>
>> What I use is:
>> -=-=-=-=-=-
>> auto eth0
>> iface eth0 inet static
>> address 172.16.17.1
>> netmask 255.255.255.0
>>
>> auto vlan100
>> iface vlan100 inet static
>> vlan-raw-device eth0
>> address 192.168.178.10
>> netmask 255.255.255.0
>> gateway 192.168.178.1
>> -=-=-=-=-=-
>
> This is just one address: Steffen was looking for a multiple-address method.

For that I use the "post-up ip address add ..." lines too.
On an external gateway I have multiple lines like that to get all the ip-numbers up for which that interface handles the incoming data.

However, if he wants A LOT of extra addresses that might change too, maybe some script that runs after the interface is up would be better. That way the script could use a database in whatever form to handle that.
Then he could use just a post-up /etc/network/lots-of-addresses.sh start and a pre-down /etc/network/lots-of-addresses.sh stop line in the interfaces file.

If each address is to have its own vlan then it is still doable but a bit more complex. I have never done it that way, I have had only a few different vlans that I was able to declare in the interfaces file.

Bonno Bloksma

Bonno Bloksma

unread,
Oct 22, 2013, 8:50:03 AM10/22/13
to
Hi Chris,

> Bob Proulx <b...@proulx.com> wrote:
>> Tom H wrote:
>>> I'm pretty sure that the last time (six months ago?) Bob linked to a
>>> Debian wiki page [...] that used multiple iface declarations for the
>>> same nic (I've also used multiple declarations).
>
>>
>> https://wiki.debian.org/NetworkConfiguration#Multiple_IP_addresses_on_One_Interface
>
>
> Thank you both
> Chris

Chris, that way is the "old and hard way" to declare them in my opinion. It is very inflexible.
The ip addr add ... is very flexible and can be handled independent of the physical status of the interface but still react with the interface when it comes up or goes down. See my other mail with this subject.

I routinely add or remove ip addresses from an interface without having to bring the physical interface up or down.

Here an example of one of my gateway machines
/etc/network/interfaces
=======================
[....]
auto eth0
iface eth0 inet static
address 217.114.99.195
netmask 255.255.255.224
broadcast 217.114.99.223
gateway 217.114.99.193
pre-up /usr/local/bin/firewall.sh
# portal16
up ip addr add 217.114.99.206/27 broadcast 217.114.99.223 dev eth0
# www, wwww2, etc.
up ip addr add 217.114.99.208/27 broadcast 217.114.99.223 dev eth0
# up ip addr add 217.114.99.209/27 broadcast 217.114.99.223 dev eth0
up ip addr add 217.114.99.212/27 broadcast 217.114.99.223 dev eth0
down ip addr del 217.114.99.206/27 broadcast 217.114.99.223 dev eth
0
down ip addr del 217.114.99.208/27 broadcast 217.114.99.223 dev eth
0
# down ip addr del 217.114.99.209/27 broadcast 217.114.99.223 dev eth
0
down ip addr del 217.114.99.212/27 broadcast 217.114.99.223 dev eth
0


ip addr show eth0
=================
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:50:56:b7:00:18 brd ff:ff:ff:ff:ff:ff
inet 217.114.99.195/27 brd 217.114.99.223 scope global eth0
inet 217.114.99.206/27 brd 217.114.99.223 scope global secondary eth0
inet 217.114.99.208/27 brd 217.114.99.223 scope global secondary eth0
inet 217.114.99.212/27 brd 217.114.99.223 scope global secondary eth0
inet6 fe80::250:56ff:feb7:18/64 scope link
valid_lft forever preferred_lft forever

If I need to take an ip address down all I have to do is enter the ip addr del line and it is gone. If I want it back I just need to enter the ip addr add line.
When one uses the way you quote above then one needs to add (sub)interfaces for each address which is more work and when using interface based firewalls can get a lot more complex.

Bonno Bloksma


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/89D1798A7351D040B4E7...@HGLEXCH-01.tio.nl

Tom H

unread,
Oct 23, 2013, 6:20:03 AM10/23/13
to
On Tue, Oct 22, 2013 at 12:28 PM, Bonno Bloksma <b.bl...@tio.nl> wrote:
>>>>>
>>>>> allow-auto eth0.9
>>>>> iface eth0.9 inet static
>>>>> address 192.168.1.119
>>>>> netmask 255.255.255.0
>>>>> gateway 192.168.1.1
>>>>> post-up ip address add 192.168.1.199/24 dev eth0.9
>>>
>>> What I use is:
>>> -=-=-=-=-=-
>>> auto eth0
>>> iface eth0 inet static
>>> address 172.16.17.1
>>> netmask 255.255.255.0
>>>
>>> auto vlan100
>>> iface vlan100 inet static
>>> vlan-raw-device eth0
>>> address 192.168.178.10
>>> netmask 255.255.255.0
>>> gateway 192.168.178.1
>>> -=-=-=-=-=-
>>
>> This is just one address: Steffen was looking for a multiple-address method.
>
> For that I use the "post-up ip address add ..." lines too.
>
> On an external gateway I have multiple lines like that to get all the ip-numbers
> up for which that interface handles the incoming data.
>
> If each address is to have its own vlan then it is still doable but a bit more
> complex.

And that didn't work for the OP using e-n-i...


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SyZZM05T2Q5A0_zKgYJnRN...@mail.gmail.com

Chris Davies

unread,
Oct 24, 2013, 5:30:02 AM10/24/13
to
Bonno Bloksma <b.bl...@tio.nl> wrote:
> I routinely add or remove ip addresses from an interface without having
> to bring the physical interface up or down.

Me too. (Well, not routinely, but quite comfortably. It's very convenient
when needing to talk to a new device that's got a default initial address
on a completely different subnet.)


> iface eth0 inet static
> [...]
> up ip addr add 217.114.99.206/27 broadcast 217.114.99.223 dev eth0

I have very similar lines in my interfaces file :-)

Regards,
Chris


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/144njax...@news.roaima.co.uk

Bob Proulx

unread,
Oct 24, 2013, 9:00:01 PM10/24/13
to
Chris Davies wrote:
> Bonno Bloksma wrote:
> > I routinely add or remove ip addresses from an interface without having
> > to bring the physical interface up or down.
>
> Me too. (Well, not routinely, but quite comfortably. It's very convenient
> when needing to talk to a new device that's got a default initial address
> on a completely different subnet.)

I hate to post a "me too" but I decided I would call this out as one
of the reasons like the up/down hooks for adding additional IP
addresses over the new-style multiple iface sections style.

Because almost certainly when I am adding a new IP address I will be
doing some tweaking and debugging and I would like to be able to add
just that IP on the fly with no strings attached. In this case I mean
no system state held by ifupdown as to the interface status. Even if
other people think it is ugly I think it is beautiful and elegant.

"Me too." There, I said it. :-)

Bob
signature.asc
0 new messages