Creating bond interfaces

Hi,

We've a bunch of physical servers prepared to be installed. These are
servers with two ethernet interfaces that we want to have in a bond in
802.3ad mode.

The way it works now, we configure the switch, we create the host in
foreman with only one regular interface which will be the one used for pxe
boot and provisioning. Then, in the finish template,we have a dirty cat <
EOF style file dump where we configure the bond taking the ip information
from the regular interface configured in foreman:

cat << EOF > /etc/network/interfaces

The loopback network interface

auto lo
iface lo inet loopback

The base interface definitions

auto eth0
iface eth0 inet manual
bond-master bond0

auto eth1
iface eth1 inet manual
bond-master bond0

Bonding interface definition

auto bond0
iface bond0 inet static
bond-slaves none
bond-miimon 100
bond-mode 4
bond-updelay 2000
bond-downdelay 2000
bond-lacp-rate 1
bond-xmit-hash-policy 1
address <%= @host.ip %>
netmask <%= @host.subnet.mask %>
gateway <%= @host.subnet.gateway %>

dns-nameservers <%= @host.subnet.dns_primary %> <%=
@host.subnet.dns_secondary %>
dns-search <%= @host.params['dns-search'] %>
EOF

This is working fine but we'd rather use the built in bond functionality in
foreman since otherwise the information in the foreman db is incomplete.
So, what's the right way to do it? The "default" interface should still be
the one that's used for pxe, and that needs to be configured with the
actual mac address and a valid ip, then the secondary, needs also to be
assigned its mac? And what about the ip? We'll never been using as such, it
will be a part of the bond. And finally, when creating the bond interface,
which mac should be used? And IP? Can we use the same IP as in te primary
interface?

Thank you.

X

Hello

I'll try to help even though I did not test anything similar to your setup
myself. First, we currently don't have provisioning template for deb-based
system, so you'll end up with custom preseed post script anyway. Something
very similar to what you have already.

> So, what's the right way to do it? The "default" interface should still be
> the one that's used for pxe, and that needs to be configured with the
> actual mac address and a valid ip, then the secondary, needs also to be
> assigned its mac?

Depending on you current Foreman version, speaking about nightly:

If it's managed physical interface on baremetal which is also managed, then
yes, you must configure its MAC. If it's too painful to type the MAC address
manually you may want to use foreman_discovery [1] which can prepopulate
interfaces for you.

> And what about the ip? We'll never been using as such, it
> will be a part of the bond.

IP is required only for provision interface so you can leave it blank.
(definitely does not apply to 1.7)

> And finally, when creating the bond interface,
> which mac should be used? And IP? Can we use the same IP as in te primary
> interface?

AFAIK, MAC of bond should be set to one of bonded interfaces. This is not used
in configuration so I think it will work even if you set arbitrary valid MAC.
I'm not sure if there's some hard rule, that OS will give it MAC of first
bonded interface.

I'm afraid you can't use the same IP though. There's validation for
uniqueness. Since you're already reconfiguring eth0 in post script, I suppose
you could do the same here. I wonder whether this is common setup and we
should think about better way, like configuring bond before actual
installation (not sure about installers support though).

[1] GitHub - theforeman/foreman_discovery: A plugin to enable Metal-as-a-Service discovery functionality in foreman

Hope this helps

··· -- Marek

On Thursday 29 of January 2015 15:19:09 Xavier Naveira wrote:

Hi,

We’ve a bunch of physical servers prepared to be installed. These are
servers with two ethernet interfaces that we want to have in a bond in
802.3ad mode.

The way it works now, we configure the switch, we create the host in
foreman with only one regular interface which will be the one used for pxe
boot and provisioning. Then, in the finish template,we have a dirty cat <
EOF style file dump where we configure the bond taking the ip information
from the regular interface configured in foreman:

cat << EOF > /etc/network/interfaces

The loopback network interface

auto lo
iface lo inet loopback

The base interface definitions

auto eth0
iface eth0 inet manual
bond-master bond0

auto eth1
iface eth1 inet manual
bond-master bond0

Bonding interface definition

auto bond0
iface bond0 inet static
bond-slaves none
bond-miimon 100
bond-mode 4
bond-updelay 2000
bond-downdelay 2000
bond-lacp-rate 1
bond-xmit-hash-policy 1
address <%= @host.ip %>
netmask <%= @host.subnet.mask %>
gateway <%= @host.subnet.gateway %>

dns-nameservers <%= @host.subnet.dns_primary %> <%=
@host.subnet.dns_secondary %>
dns-search <%= @host.params[‘dns-search’] %>
EOF

This is working fine but we’d rather use the built in bond functionality in
foreman since otherwise the information in the foreman db is incomplete.
So, what’s the right way to do it? The “default” interface should still be
the one that’s used for pxe, and that needs to be configured with the
actual mac address and a valid ip, then the secondary, needs also to be
assigned its mac? And what about the ip? We’ll never been using as such, it
will be a part of the bond. And finally, when creating the bond interface,
which mac should be used? And IP? Can we use the same IP as in te primary
interface?

Thank you.

X

Hopefully it's ok for me to Necro this old post, but I have just begun the
process of figuring out how to pre-configure bond and virtual interfaces.
I'd really like to do this through the GUI. We currently are doing this
configuration through a provisioning template, but ever since the boss saw
foreman's new and improved Interfaces interface, he's wanted us to move
this configuration here.

··· > I'm afraid you can't use the same IP though. There's validation for > uniqueness. Since you're already reconfiguring eth0 in post script, I > suppose > you could do the same here. I wonder whether this is common setup and we > should think about better way, like configuring bond before actual > installation (not sure about installers support though). > >