Boot virtual machine by using BOOTP server

A Bootstrap Protocol (BOOTP) server with Trivial File Transfer Protocol (TFTP) and HTTP services allows virtual machines to boot and install over the network by using an ISO image mounted on the BOOTP server.

BOOTP server setup and configuration

Perform the following steps to set up and configure the BOOTP server for network-based booting of virtual machine by using an ISO image mounted on the BOOTP server:
Note: If there is a failure in BOOTP server setup and configuration, validate the firewall configurations to allow the BOOTP communications.
BOOTP server setup for Ubuntu
  1. Install the BOOTP protocol on the virtual machine by using the following command:
    sudo apt-get install inetutils-inetd
    sudo apt-get install bootp

    The inetutils-inetd package provides inetd super-server that listens for incoming network connections and starts other daemons to handle the incoming requests

  2. Verify whether the inetutils-inetd package is installed by using the following command:
    dpkg -l | grep inetutils-inetd
  3. Verify whether the BOOTP daemon is installed by using the following command:
    dpkg -l | grep bootp
  4. Start the BOOTP daemon by using the following command:
    sudo /usr/sbin/bootpd -d2 /etc/bootptab 2> /var/log/bootp.log
  5. Verify whether the BOOTP server is running by using the following command:
    ps -ef | grep boot
  6. Create the BOOTP server database /etc/bootptab file by using the following command:
    sudo vi /etc/bootptab
  7. Enter the following text in the /etc/bootptab file. Replace HOST_IP_ADDRESS, SUBNET MASK, GATEWAY_IP_ADDRESS, DOMAIN_NAME, NAME_SERVER_IP_ADDRESS, and BOOT_SERVER_IP_ADDRESS with the values for your network.
    HOST_NAME:\
               bf=core.elf:\
               ip=HOST_IP_ADDRESS:\
               sm=SUBNET_MASK:\
               gw=GATEWAY_IP_ADDRESS:\
               dn=DOMAIN_NAME:\
               ns=NAME_SERVER_IP_ADDRESS:\
               sa=BOOT_SERVER_IP_ADDRESS:
  8. Repeat the step 7 for each controller.
  9. Install the tfptd-hpa and tftp-hpa packages on the virtual machine by using the following command:
    sudo apt-get install tftpd-hpa
    After the packages are installed, the TFTP server starts in a secure mode and uses the /var/lib/tftpboot directory as the root directory. Edit the tftpd-hpa file and update the /var/lib/tftpboot directory as the TFTP directory.
    vi /etc/default/tftpd-hpa
    Restart the TFTP server by using the following command:
    systemctl restart tftpd-hpa
  10. Install and configure the Apache HTTP Server version 2.0 by using the following command:
    sudo apt-get install apache2
    Edit the /etc/apache2/sites-available/ks-server.conf configuration file and update the /var/www/html/ directory as the root directory.
    cat /etc/apache2/sites-available/ks-server.conf
    # cat /etc/apache2/sites-available/ks-server.conf
    <VirtualHost virtual_host_IP]>
        ServerAdmin root@<FQDN of the BOOTP server>
        DocumentRoot /var/www/html/
        ServerName <FQDN of the BOOTP server>
        ErrorLog ${APACHE_LOG_DIR}/ks-server-error.log
        CustomLog ${APACHE_LOG_DIR}/ks-server-access.log common
        <Directory /var/www/html/>
            Options Indexes MultiViews
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    Restart the Apache HTTP Server version 2.0 by using the following command:
    sudo systemctl restart apache2
  11. Create a grub /var/lib/tftpboot/core.elf file that supports network booting by using the following command in a ppc64le machine:
    grub-mkimage --output=/var/lib/tftpboot/core.elf --format=powerpc-ieee1275 boot configfile echo elf http ieee1275_fb linux loadenv ls net normal ofnet reboot regexp serial sleep tftp time true date -p /

    Alternatively, download the core.elf file from core.elf.

  12. Create a /var/lib/tftpboot/grub.cfg configuration file by using the following command:
    sudo vi /var/lib/tftpboot/grub.cfg 

    The grub.cfg configuration file has the following fields:

    ip=$net_default_ip 
    for c in 1 2 3 4; do 
    nim_configfile=$prefix/grub-nim.cfg-$ip 
    configfile=$prefix/grub.cfg-$ip 
    source "$nim_configfile" 
    source "$configfile" 
    regexp --set=ip '^(.*)\..+$' "$ip" 
    done 
  13. Download the PowerVC ISO image by using the wget command. Create a folder <ISO_DIRECTORY> under the /var/www/html/ directory and mount the ISO image to the <ISO_DIRECTORY> folder by using the following command:
    mount -o loop <ISO_FILE_NAME> /var/www/html/ISO_DIRECTORY
  14. Create a grub file in grub.cfg-<VM_IP_ADDRESS> format with the IP address of the virtual machine that must be created by using the following command:
    sudo vi /var/lib/tftpboot/grub.cfg-[VM_IP_ADDRESS]
    The following file is a sample GRUB configuration file for a specific IP address:
    
    set default=0
    set timeout=20
    
    menuentry "PowerVC (PowerVM)" --class fedora --class gnu-linux --class gnu --class os {
     insmod http
     insmod tftp
     regexp -s 1:mac_pos1 -s 2:mac_pos2 -s 3:mac_pos3 -s 4:mac_pos4 -s 5:mac_pos5 -s 6:mac_pos6 '(..):(..):(..):(..):(..):(..)' ${net_default_mac}
     set bootif=${mac_pos1}:${mac_pos2}:${mac_pos3}:${mac_pos4}:${mac_pos5}:${mac_pos6}
     set root=http,<BOOTP_SERVER_IP>
     set serveraddress=<BOOTP_SERVER_IP>
    
     set ipaddr=VM_IP_ADDRESS
     set gateway=GATEWAY_ADDRESS
     set netmask=SUBNET_MASK
     set nameserver=NAME_SERVER_IP_ADDRESS
     set hostname=HOST_NAME
     set infname=INTERFACE_NAME
     set searchdomain=DOMAIN_NAME
     set fqdn=VM_FQDN
     linux //<ISO_DIRECTORY>/ppc/ppc64le/img2a ro inst.text inst.repo=http://<BOOTP_SERVER_IP>/<ISO_DIRECTORY> BOOTIF=${net_default_mac} biosdevname=0 net.ifnames=0 --append "ds=nocloud;seedfrom=/var/lib/cloud/seed/nocloud/ rd.dm=0 rd.luks=0 rd.nomodeset rd.neednet=1 plymouth.enable=0 media=network consoleblank=0 optype=Install mode=auto fsck.mode=skip powervcroot=http://<BOOTP_SERVER_IP>/<ISO_DIRECTORY> ip=${ipaddr}:${nameserver}:${gateway}:${netmask}:${hostname}:${infname}:${searchdomain}:${fqdn}"
     initrd //<ISO_DIRECTORY>/ppc/ppc64le/img3a
    }
  15. Check the TFTP server status by using the following command:
    sudo systemctl status tftpd-hpa
  16. Verify the TFTP server configuration by using the following command:
    cat /etc/default/tftpd-hpa
  17. Check the Apache server status by using the following command:
    sudo systemctl status apache2

This configuration enables you to use BOOTP for IP address assignment and GRUB, TFTP, and HTTP to boot a virtual machine by using a network-mounted ISO image.

Deploy the virtual machine

Perform the following steps to deploy the virtual machine for controllers:
  1. Create the initial image in PowerVC.
  2. Deploy a blank virtual machine with the required capacity.
  3. Perform the following steps on NovaLink or HMC to open the console page:
    NovaLink
    1. List the logical partitions (LPARs) on the system busing the following command:
      pvmctl lpar list 

      Note the ID (lpar_id) that is displayed for the required LPAR.

    2. Open a virtual terminal session for the required LPAR by using the following command:
      mkvterm --id <lpar_id> 
    HMC
    1. Login to HMC.
    2. Open a virtual terminal session by using the following command:
      vtmenu
    3. Select the server in the displayed screen.
    4. Select the LPAR for the selected server in the displayed screen.
  4. Restart the virtual machine.
  5. Select SMS Menu in the virtual terminal session.
  6. Select Setup Remote IPL (Initial Program Load).
  7. Select the adapter device for which remote IPL needs to be setup.
  8. Select IPV4 - Address Format > BOOTP > IP Parameters.
  9. Configure the following IP parameters:
    • Client IP address (VM_IP_ADDRESS)
    • Server IP address (BOOTP_SERVER_IP)
    • Gateway IP address (GATEWAY_IP_ADDRESS)
    • Subnet Mask (SUBNET_MASK)
  10. Press Escape to return to the previous screen, select Ping Test, and continue if the ping test succeeds.
  11. Navigate back to the main menu on the SMS terminal and select Select Boot Options.
  12. Select Select Install/Boot device > Network > BOOTP.
  13. Select the same device that was selected in step 7.
  14. Select Normal Mode Boot > Yes to boot the virtual machine.
  15. Repeat from step 1 for all the controllers.
Note: Since the network configurations are already handled by the BOOTP server method, you can directly establish a secure shell (SSH) connection to the virtual machine.

After BOOTP, GRUB, and HTTP server setup, the virtual machine successfully boots by using the specified ISO image and static IP configuration. This feature is useful for automated and repeatable deployment or testing environments.