Configure multiple network cards with static IP's during host provisioning on VMWare

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.1.5
  • RHEL 6 / 7

Issue

  • Satellite 6 offers the possibility to provision a host with multiple network cards, however an issue is faced when using vmware in conjuction with Satellite 6 and you want to provision multiple network interfaces.

What happens is that after the provisioning of a virtual machine is complete, multiple network cards are added, but only the primary interface (which is used for PXE / DHCP during installation) is configured correctly.

Resolution

  • Until this feature will be fixed in a future release of Satellite the following workaround will solve the problem.
    Especially on RHEL 7 we need to turn off "consistent network device naming" to be able to add multiple network cards during host creation in Satellite with an explicit identifier eth[1-n] configured. Furthermore we need to change a small grep command in the "kickstart_networking_setup" provisioning template where we can now grep for the network card identifier name instead of the MAC address (which is not known before the virtual machine is created).

  • Clone provisioning template "Satellite Kickstart Default" to "CUSTOM_Kickstart_Default"

  • Disable "consistent network device naming" in "CUSTOM_Kickstart_Default" by adding the "net.ifnames=0" option:
Old:

[...]
<% if @host.operatingsystem.name == 'Fedora' and os_major <= 16 -%>
# Bootloader exception for Fedora 16:
bootloader --append="nofb quiet splash=quiet <%=ks_console%>" <%= grub_pass %>
part biosboot --fstype=biosboot --size=1
<% else -%>
bootloader --location=mbr --append="nofb quiet splash=quiet" <%= grub_pass %>
<% end -%>
New:

[...]
<% if @host.operatingsystem.name == 'Fedora' and os_major <= 16 -%>
# Bootloader exception for Fedora 16:
bootloader --append="nofb quiet splash=quiet <%=ks_console%>" <%= grub_pass %>
part biosboot --fstype=biosboot --size=1
<% else -%>
bootloader --location=mbr --append="nofb quiet splash=quiet net.ifnames=0" <%= grub_pass %>
<% end -%>
  • Create PXE template "CUSTOM_PXE_Default" with the following content where we will be able to configure static IP addresses instead of using DHCP for every interface:
default linux
label linux
kernel <%= @kernel %>
<% if @host.operatingsystem.name == 'Fedora' and @host.operatingsystem.major.to_i > 16 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>&static=yes ks.device=bootif network ks.sendmac
<% elsif @host.operatingsystem.name != 'Fedora' and @host.operatingsystem.major.to_i >= 7 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>&static=yes network ks.sendmac net.ifnames=0
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>&static=yes ksdevice=bootif network kssendmac
<% end -%>
IPAPPEND 2

This is documented in here. Only the "net.ifnames=0" option to disable "consistent network device naming" was added.

  • Clone template "kickstart_networking_setup" to "CUSTOM_kickstart_networking_setup" and edit it as follows:
Old:

[...]
# <%= bond.identifier %> interface
[...]
# <%= interface.identifier %> interface
[...]
# <%= interface.identifier %> interface
real=`ip -o link | grep <%= interface.mac -%> | awk '{print $2;}' | sed s/:$//`
New:

[...]
<%= bond.identifier %> interface
[...]
<%= interface.identifier %> interface
[...]
<%= interface.identifier %> interface
real=`ip -o link | grep <%= interface.identifier -%> | awk '{print $2;}' | sed s/:$//`
[...]
  • Change code snippet for network card configuration in "CUSTOM_Kickstart_Default":
Old:

[...]
<%= snippet 'kickstart_networking_setup' %>
New:

[...]
<%= snippet 'CUSTOM_kickstart_networking_setup' %>"

Now you only need to assign the new templates to the operating systems of your choice.

Root Cause

  • This occurs because RHEL 7 uses "consistent network device naming" by default where network card identifier is no longer eth[0-n] but starts with eno[...] (if you want to find out more about "consistent network device naming" please follow this link.)

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments