The software described in this documentation is either no longer supported or is in extended support.
Oracle recommends that you upgrade to a current supported release.

4.5.1 Configuring Cobbler and DHCP to Support Network Booting

The procedure in this section assumes that you configure a DHCP server on the same system as the Spacewalk server.

To configure Cobbler and DHCP to support booting client systems across the network:

  1. Install the cobbler-loaders and dhcp packages:

    # yum install cobbler-loaders dhcp

  2. To configure Cobbler to manage the DHCP service, edit /etc/cobbler/settings and modify the manage_dhcp setting:

    manage_dhcp: 1
  3. Edit the DHCP server configuration template file /etc/cobbler/dhcp.template and change the subnet configuration for your local configuration.

    The following example demonstrates how to select either the pxelinux boot loader for BIOS-based PXE clients or the GRUB boot loader for UEFI-based PXE clients:

    # ******************************************************************
    # Cobbler managed dhcpd.conf file
    #
    # generated from cobbler dhcp.conf template ($date)
    # Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
    # in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
    # overwritten.
    #
    # ******************************************************************
    
    ddns-update-style interim;
    
    allow booting;
    allow bootp;
    
    ignore client-updates;
    set vendorclass = option vendor-class-identifier;
    option pxe-system-type code 93 = unsigned integer 16;
    set pxetype = option pxe-system-type;
    
    option domain-name "mydom.com";
    
    subnet 192.168.1..0 netmask 255.255.255.0 {
      option domain-name-servers 192.168.1.1;
      option broadcast-address 192.168.1.255;
      option routers 192.168.1.254;
      default-lease-time 14400;
      max-lease-time 28800;
      pool {
        range 192.168.1.101 192.168.1.200;
      }
    }
    
    #for dhcp_tag in $dhcp_tags.keys():
        ## group could be subnet if your dhcp tags line up with your subnets
        ## or really any valid dhcpd.conf construct ... if you only use the
        ## default dhcp tag in cobbler, the group block can be deleted for a
        ## flat configuration
    # group for Cobbler DHCP tag: $dhcp_tag
    group {
            #for mac in $dhcp_tags[$dhcp_tag].keys():
                #set iface = $dhcp_tags[$dhcp_tag][$mac]
        host $iface.name {
            hardware ethernet $mac;
            #if $iface.ip_address:
            fixed-address $iface.ip_address;
            #end if
            #if $iface.hostname:
            option host-name "$iface.hostname";
            #end if
            #if $iface.netmask:
            option subnet-mask $iface.netmask;
            #end if
            #if $iface.gateway:
            option routers $iface.gateway;
            #end if
            if substring(vendorclass, 0, 9)="PXEClient" {
              if pxetype=00:06 or pxetype=00:07 {
                  filename "/grub/grub.efi";
              } else {
                  filename "/pxelinux.0";
              }
            }
            ## Cobbler defaults to $next_server, but some users
            ## may like to use $iface.system.server for proxied setups
            next-server $next_server;
            ## next-server $iface.next_server;
        }
            #end for
    }
    #end for

    The example also configures a pool of generally available IP addresses in the range 192.168.1.101 through 192.168.1.200 on the 192.168.1/24 subnet. Systems in this pool do not boot using PXE.

    All comments or commented-out DHCP directives in /etc/cobbler/dhcp.template are preceded by a double hash (##) to prevent Cobbler from interpreting them.

    Spacewalk configures Cobbler to use TFTP to serve the boot-loader configuration files from the /var/lib/tftpboot directory. For more information about the format of these files, see Section 4.5.3, “About Boot-Loader Configuration Files”.

    If you want DHCP to support network booting of iPXE clients, see Section 4.5.4, “Configuring DHCP to Support iPXE Clients”.

  4. If SELinux is enabled in enforcing mode on your system, configure SELinux for Cobbler operation:

    1. Permit the httpd service to act as a proxy for Cobbler.

      # setsebool -P httpd_can_network_connect=1
    2. Set the public_content_t file type on the /var/lib/tftpboot and /var/www/cobbler/images directory hierarchies.

      # /usr/sbin/semanage fcontext -a -t public_content_t "/var/lib/tftpboot/.*"
      # /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"
      Note

      The semanage command is provided by the policycoreutils-python package.

  5. Restart the cobblerd service:

    # service cobblerd restart
  6. Start the httpd service and configure it to start after a reboot.

    # service httpd start
    # chkconfig httpd on
    Note

    If you make any changes to /etc/cobbler/dhcp.template, run the cobbler sync command.

    If you make any changes to /etc/cobbler/settings, restart the cobblerd service and then run the cobbler sync command.

  7. To support booting of UEFI-based PXE clients, copy /boot/efi/EFI/redhat/grub.efi to /var/lib/tftpboot/grub.

    # cp /boot/efi/EFI/redhat/grub.efi /var/lib/tftpboot/grub 
  8. Configure the firewall to allow access by DHCP requests.

    For example, for Oracle Linux 6:

    # iptables -I INPUT -i eth1 -p udp --dport 67:68 --sport 67:68 -j ACCEPT
    # service iptables save

    In this example, the server expects to receive requests on interface eth1.

    For example, for Oracle Linux 7:

    # firewall-cmd --permanent --zone=public --remove-interface=enp0s3
    # firewall-cmd --permanent --zone=internal --add-interface=enp0s3
    # firewall-cmd --permanent --zone=internal --add-port=67/udp
    # firewall-cmd --permanent --zone=internal --add-port=68/udp
    # firewall-cmd --reload

    In this example, the server expects to receive requests on interface enp0s3 in the internal zone.