Kickstart CentOS7 with Bonding

General support questions
Post Reply
beandip4088
Posts: 1
Joined: 2016/10/11 17:42:39

Kickstart CentOS7 with Bonding

Post by beandip4088 » 2016/10/11 20:05:34

I have been struggling with trying to get my CentOS 7 PXE image to boot with Bonding.
we have a DHCP server where i specify the hostname,, and address:

Code: Select all

host RemoteHost{ hardware ethernet 01:02:03:85:6d:5d; fixed-address 192.168.1.89; filename "pxelinux.0";}
and in the config file i specify this:

Code: Select all

systemctl disable NetworkManager
systemctl stop NetworkManager

systemctl enable network

Code: Select all

network --device=bond0 --noipv6 --bootproto dhcp --onboot=yes --bondslaves=eno49,eno50 --bondopts=mode=active-backup,primary=eno49,miimon=80,updelay=60000
The host boots and aquires the hostname, ip address, netmask, and gateway. for some reason, in my %post i cant get my NICs configured correctly and bonding to work. i have tried so many different methods with sed/awk to obtain the DHCP info and then write that out to my bond and 2 bonded slaves.
Here is one example (that isnt working):

Code: Select all

NICNAMES=$(/sbin/ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d'| cut -d: -f1)
for i in $NICNAMES
do
IPADDRESS=$(/sbin/ifconfig $i | grep inet | awk '{print $2}'| awk '{print $1;exit}')
NETMASK=$(/sbin/ifconfig $i | grep netmask | awk '{print $4}'| awk '{print $1;exit}')
   STATUS=$(ethtool $i | grep 'Link detected' | awk -F: '{print $2}')

      if [ $STATUS == 'yes' ]
         then
  COUNTER=$((COUNTER+1))
NIC[$COUNTER]="$i"
fi
done

cat << 'EOF' >/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=$IPADDRESS
NETMASK=$NETMASK
USERCTL=no
BONDING_MASTER=yes
BONDING_OPs="mode=active-backup miimon=80 updelay=60000 primary=${NIC[1]}"
EOF

Code: Select all

cat <<'EOF'> /etc/sysconfig/network-scripts/ifcfg-eno49
NAME=eno49
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
EOF

Code: Select all

cat <<'EOF'> /etc/sysconfig/network-scripts/ifcfg-eno50
NAME=eno50
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
EOF
any ideas on how to get the kickstart bonding to work?

larwood
Posts: 66
Joined: 2011/07/27 12:07:30
Location: Perth WA, Australia

Re: Kickstart CentOS7 with Bonding

Post by larwood » 2016/10/12 05:01:41

To kickstart the server we use:

Code: Select all

vmlinuz initrd=initrd.img linux ip=x.x.x.x netmask=x.x.x.x gateway=x.x.x.x nameserver=x.x.x.x ks=http://spacewalkserver.domain.local/ks/cfg/org/12/label/newserver bond=bond0:em1,em2,p1p1,p1p2:mode=802.3ad,lacp_rate=fast,miimon=100,xmit_hash_policy=layer2+3 vlan=bond0.123:bond0
The kickstart file contains:

Code: Select all

network --bootproto=static --device=bond0 --ip=x.x.x.x --netmask=x.x.x.x --gateway=x.x.x.x --vlanid=123 --nameserver=x.x.x.x --nameserver=x.x.x.x --hostname=newserver --noipv6
With this method you can kickstart on an LACP enabled connection and the network configuration files are generated automatically by Anaconda.

larwood
Posts: 66
Joined: 2011/07/27 12:07:30
Location: Perth WA, Australia

Re: Kickstart CentOS7 with Bonding

Post by larwood » 2018/01/12 05:36:01

I know this thread is over a year old now but thought I should post an update for CentOS 7.4.1708

To kickstart the server we use (y.y.y.y=gateway):

Code: Select all

vmlinuz initrd=initrd.img linux ip=x.x.x.x::y.y.y.y:24:newserverhostname:bond0.123:none nameserver=x.x.x.x bond=bond0:em1,em2:miimon=80,mode=active-backup,primary=em1,primary_reselect=0 vlan=bond0.123:bond0 inst.sshd inst.ks=http://spacewalkserver.domain.local/ks/cfg/org/12/label/newserverhostname
The kickstart file contains:

Code: Select all

network --bootproto=static --device=bond0 --ip=x.x.x.x --netmask=255.255.255.0 --gateway=y.y.y.y --vlanid=123 --hostname=newserverhostname --noipv6 --bondopts=miimon=80,mode=active-backup,primary=em1,primary_reselect=0 --bondslaves=em1,em2

Post Reply