Red Hat Training

A Red Hat training course is available for Red Hat Satellite

6.3. Provisioning Hosts with Static IP Addresses

Red Hat Satellite 6 expects all systems to be configured for DHCP, because it reserves a DHCP record for a given MAC address. You can also provision hosts with static IP addresses, using either custom provisioning templates, host parameters, or based on subnet information.

6.3.1. Using Custom Templates to Assign Static IP Addresses

You can create a custom provisioning template that provides static IP support for all provisioned hosts. You can copy the PXE configuration template and associate it with a different operating system, for example "RHEL 7.1 static". This means that when you kickstart a system with this template it receives a static IP. This method is currently required because Satellite 6.0 and 6.1 do not support a choice of dynamic or static IP configuration in the existing "Create New Host" work flow.
This method requires that you edit your PXE template to enable static networking. As described in the following example, edit the PXE template and add &static=yes to the end of each instance of foreman_url('provision').

Procedure 6.5. To Edit a PXE Template:

  1. Navigate to HostsAll Hosts and click the name of the host whose template you want to edit.
  2. Click the Templates tab to display the list of available template types.
  3. Click Edit for the PXELinux Template type. The template displays in the template editor.
  4. Make the required changes and then click Submit. See Example 6.1, “Editing the PXE Template to Assign Static IP Addresses” for an example of how to update a PXE template.

Example 6.1. Editing the PXE Template to Assign Static IP Addresses

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
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>&static=yes ksdevice=bootif network kssendmac
<% end -%>
IPAPPEND 2

6.3.2. Using Host Parameters to Assign Static IP Addresses

You can use host parameters to set up static IP addresses on a per-host basis. When you create a new host, navigate to HostsNew host and enter the required parameters on the Parameters tab.
Example 6.2, “Using Host Parameters to Assign Static IP Addresses” demonstrates using an if statement in conjunction with host parameters to set a static IP address.

Example 6.2. Using Host Parameters to Assign Static IP Addresses

<% if @host.params['my_param_deploy_static'] == "true" -%>
   network --bootproto <%= "static --ip=#{@host.ip} --netmask=#{@host.subnet.mask} --gateway=#{@host.subnet.gateway} --nameserver=#{[@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{|n| n.blank?}.join(',')}" %> --hostname <%= @host %>
<% else -%>
   network --bootproto 'dhcp' --hostname <%= @host %>
<% end -%>
See the Red Hat Satellite 6 User Guide for more information.

6.3.3. Using Subnets to Set Static IP Addresses

You can configure Red Hat Satellite to provision hosts with a static IP address based on the host's subnet. When you set up subnets, you can specify either DHCP or static boot modes. The Red Hat Enterprise Linux installation program (Anaconda) uses this value to determine whether to assign a static IP address or an address from the DHCP pool. Specify "Static" to ensure that all hosts provisioned in this subnet receive static IP addresses.

Procedure 6.6. To Specify Static Boot Mode by Default:

  1. Navigate to InfrastructureSubnets and click the name of the subnet that you want to configure. To create a new subnet, follow the steps in Procedure 2.4, “To Select the Default Subnet:”.
  2. On the Subnet tab, select Static from the Boot mode drop-down list, and then click Submit.
Whenever you create a new host and assign it to this subnet, it uses a static IP address by default.