Table of Contents
In this article I will share the steps to configure VLAN with bond for PXE based network installation. This article was written while using RHEL 7, so it is safe to say that it also fully covers CentOS 7. Although for SuSE and OpenSuSE they use autoyast.xml so this article is not applicable there.
What are Kickstart Installations?
Kickstart installations offer a means to automate the installation process, either partially or fully. Kickstart files contain answers to all questions normally asked by the installation program, such as what time zone you want the system to use, how the drives should be partitioned, or which packages should be installed. Providing a prepared Kickstart file when the installation begins therefore allows you to perform the installation automatically, without need for any intervention from the user. This is especially useful when deploying Red Hat Enterprise Linux on a large number of systems at once.
Kickstart files can be kept on a single server system and read by individual computers during the installation. This installation method can support the use of a single Kickstart file to install Red Hat Enterprise Linux on multiple machines, making it ideal for network and system administrators.
I will share two methods to configure VLAN with Bond. One would be with kickstart and the other is manual but can also be automated for PXE installation.
Method 1: Configure VLAN with Bond using Kickstart
I hope that you already have a working PXE server using which you plan to perform network installation on your setup.
There are various parameters supported for network. The GUI based kickstart configurator has very limited options so I prefer manually defining the values using CLI. The configurator will not be able to give you a enough syntax to configure VLAN with Bond.
Below syntax is to be used to configure VLAN with Bond in RHEL 7:
# Network Information network --bootproto=static --device=<Parent_Device> --ip=<VLAN_Interface_IP> --netmask=<VLAN_Interface_NetMask> --onboot=on --noipv6 --activate --vlanid=<VLAN_ID> --interfacename=<VLAN_Interface_Name>
--device Provide the device name to which you wish to tag the VLAN Interface. The traffic for VLAN interface will communicate through this device --ip Provide the VLAN interface IP --netmask Provide the VLAN NetMask --onboot To keep the VLAN interface enabled post reboot --no-ipv6 Disable IPv6 --activate Activate the interface immediately after setting the configuration --vlanid Provide the VLAN ID. The configuration file will be created based on the ID provided.
I have a Bond device
bond0 for which I wish to create a VLAN tagged interface with below details
VLAN IP: 184.108.40.206 VLAN NetMask: 255.255.255.192 VLAN ID: 565
So our example syntax to configure vlan with bond would look like:
network --bootproto=static --device=bond0 --ip=220.127.116.11 --netmask=255.255.255.192 --onboot=on --noipv6 --activate --vlanid=565 --interfacename=vlan565
It is important that you validate your
kickstart.conf before you trigger the network installation or else the installation may break which can be done using
ksvalidator. This tool is part of
pykickstart rpm. You can install the rpm using yum (if not available)
# yum install pykickstart -y
You may see below warning since we have defined the device name twice but this can be ignored as it won't impact your installation.
# ksvalidator kickstart.conf A network device with the name bond0 has already been defined.
You can ignore this warning and continue with PXE installation.
Method 2: Configure VLAN with Bond using %post
We can also use
%post section to configure VLAN with Bond for PXE installation. I have written a script which collects all the values to configure VLAN with Bond and creates a network configuration file.
So to configure VLAN with Bond you can also write some scripts to automate and create a VLAN configuration file similar to below (you can omit any optional values which do not suit your environment)
# cat /tmp/ifcfg-vlan565 VLAN="yes" TYPE="Vlan" DEVICE="vlan565" PHYSDEV="bond0" VLAN_ID="565" BOOTPROTO="none" IPADDR="18.104.22.168" NETMASK="255.255.255.192" IPV6INIT="no" NAME="vlan565" ONBOOT="yes" NM_CONTROLLED="no" NOZEROCONF="yes"
Next use the
%post section of kickstart file to copy this file inside
/etc/sysconfig/network-scripts. So with this your network installation will not get impacted and your vlan configuration file will also be available for
%post --interpreter=/bin/bash --log=/var/log/kickstart_post.log echo "Copying vlan configuration file" cp -rvf /tmp/ifcfg-vlan565 /etc/sysconfig/network-scripts/ %end
Once the target node is installed you can check
/var/log/kickstart_post.log to get the status of the
Lastly I hope the steps from the article to configure VLAN with Bond using kickstart on CentOS/RHEL 7 Linux was helpful. So, let me know your suggestions and feedback using the comment section.