[CentOS] anaconda/kickstart: bonding device not created as expected

Fri Apr 21 19:19:45 UTC 2017
Frank Thommen <list.centos at drosera.ch>

Hi Tris,

On 04/19/2017 06:07 PM, Tris Hoar wrote:
> On 18/04/2017 15:54, Frank Thommen wrote:
>> Hi,
>>
>> I am currently struggling with the right way to configure a bonding
>> device via kickstart (via PXE).
>>
>> I am installing servers which have "eno" network interfaces.  Instead of
>> the expected bonding device with two active slaves (bonding mode is
>> balance-alb), I get a bonding device with only one active slave and an
>> independent, non-bonded network device.  Also the bonding device gets
>> its MAC address from the second instead of from the first device.
>>
>> [...]
>>
>> The used PXE configuration is
>>
>> LABEL CentOS-7
>>         kernel centos-7/vmlinuz
>>         append initrd=centos-7/initrd.img ip=dhcp nameserver=xx.xx.xx.xx
>> ksdevice=eno1 inst.repo=http://our.mirror.server/7/os/x86_64
>> inst.ks.sendmac inst.ks=http://our.kickstart.server/ks.cgi
>>
>>
>> and the network settings in the kickstart file are
>>
>> network --device bond0 --bondslaves=eno1,eno2
>> --bondopts=mode=balance-alb --bootproto=dhcp --hostname=myhost --activate
>>
>>
>> [...]
>>
>
> Hi Frank,
>
> This is from my satellite kickstart where I'm building the bond at the
> point of PXE booting, and using static (I'm working on doing this with
> DHCP and tagged VLANs but currently cant get to the hardware needed
> since messing up the BMC config :( )
>
> LABEL linux
>     KERNEL boot/RedHat-7.3-x86_64-vmlinuz
>         APPEND initrd=boot/RedHat-7.3-x86_64-initrd.img
> ks=http://example.com/host.ks ks.device=bootif network ks.sendmac
> bond=bond0:eno1,eno2:mode=802.3ad vlan=bond0.10:bond0
> ip=10.10.0.2::10.10.0.1:255.255.255.0:host.example.com:bond0.10:none
> nameserver=10.10.0.1
>
>
> Then in the KS we have
> network  --bootproto=static --device=link --gateway=10.10.0.1
> --hostname=host.example.com --ip=10.10.0.2
> --nameserver=10.10.0.1,10.11.0.1 --netmask=255.255.255.0
>
> It should be fairly simple to convert that to use DHCP as you just need
> to change the IP line in the kernel parameters and ensure you have
> --device=link in the kickstart.
>
> BTW cat /proc/net/bonding/bond0 shows more info on how the bond is
> actually setup and working.


Finally the issue was a simple and stupid syntax error in the ks config. 
  I had omitted the equal sign between "--device" and "bond0":

network --device=bond0 --bondslaves=eno1,eno2 
--bondopts=mode=balance-alb --bootproto=dhcp --hostname=myhost --activate

works much better :-).  Since the PXE config is global for all hosts 
(being configured with or without bonding device), I cannot use bonding 
definitions at that point.  However the idea of using --device=link is 
interesting and I might use it in an other context in the future.

Thanks a lot
frank