=====================================================
Clearing host configuration to make a clone template
=====================================================

Bonders can be be built from the `hard disk
template image <../provisioning-nodes/node-installation-methods/cloning-from-template-image.html>`__
of a `default bonder
<../provisioning-nodes/initial-bonding-configuration.html#default-bonder-configuration>`__.
However, if a bonder is cloned by simply copying the hard disk from one device to
another, the cloned device will be configured incorrectly. For example,
it will share SSH host keys and log file contents with the original
node.

.. warning::

    The template image must be taken from a `default bonder
    <../provisioning-nodes/initial-bonding-configuration.html#default-bonder-configuration>`__.
    Using a bonder that has been configured with a node key can
    cause serious issues that are complicated to fix.

To avoid these configuration issues, follow these steps to create a
template image:

#. Image a new bonder with the default configuration. See `Node
   installation methods <../provisioning-nodes/node-installation-methods/index.html>`__
   and `Initial Bonding
   configuration <../provisioning-nodes/initial-bonding-configuration.html>`__. Use
   the same hardware you plan to use for the clones—for example, if you
   plan to clone to Lanner FW-7535s, use a Lanner FW-7535 for the
   template image. If you clone to multiple hardware models, you should
   create multiple image templates.
#. Reboot the bonder.
#. Start a shell via the troubleshooting IP, serial port, or
   keyboard/monitor. See `Accessing a
   node <../accessing-a-node.html>`__.
#. Stop bonding with:
   ``service bonding stop``
#. Run this command:
   ``bonding-sysprep``
#. Confirm your action by typing Y, then pressing <enter>.
#. Run the following command to ensure the root Bash history file will
   not be written when you log out:
   ``unset HISTFILE``
#. Turn off the host by running:
   ``halt``

.. warning::

    If you restart the bonder before making the template image file, you
    must complete these steps again before shutting it down. A bonder that
    has been started after running ``bonding-sysprep`` is not suitable to
    be used as a template, because it will have configured a number of
    services when it started.

You can now use the host as a template to `clone new
bonders <../provisioning-nodes/node-installation-methods/cloning-from-template-image.html>`__.
The cloned bonders will include any custom hooks or other special configuration
applied to the template host. Since each partner has unique provisioning requirements,
we do not provide specific instructions on creating template image files.


.. note::

    Remember to update your templates when a new version of SD-WAN
    is released so that cloned bonders are not already out-of-date when they
    are imaged.
