Fortinet black logo
7.2.0

Step 3 (Optional): Cloud-init using config drive

Step 3 (Optional): Cloud-init using config drive

This section describes how to bootstrap a FortiNAC VM in KVM using config drive. This method can be used if deploying VMs and need to preconfigure the FortiNAC VM so that it boots with a predetermined configuration.

FortiNAC-OS supports version 2 of the config-drive capabilities. Cloud-Init config drive was initially created for OpenStack and other cloud environments and is a capability available on the FortiNAC even when booting within KVM. Config drive also allows the administrator to pass day zero configuration scripts to the FortiNAC VM on initial boot.

FortiNAC day zero configuration:

  • port1 IP Address

  • Subnet mask

  • Gateway

If not using this function, proceed to

Configure Network Settings.

Configure

  1. To pass a config drive to the FortiNAC VM, create the following directory structure:

    config-drive/openstack/latest/

  2. Create the FortiNAC configuration script user_data via text editor within this directory. The configuration script for a FortiNAC VM uses FortiNAC-OS CLI syntax.

    Script should contain the following content:

    #<HostName> Day0 Configuration

    config system interface

    edit port1

    set ip <port1 IP address>/<mask>

    set allowaccess https-adminui ssh

    next

    end

    config system route

    edit 1

    set device port1

    set gateway <Default Gateway for port1>

    next

    end

    Example

    Hostname = FNC

    port1 IP address and mask = 10.12.234.175/22

    Default gateway = 10.12.232.1

    cat config-drive/openstack/latest/user_data

    #FNC Day0 Configuration

    config system interface

    edit port1

    set ip 10.12.234.175/22

    set allowaccess https-adminui ssh

    next

    end

    config system route

    edit 1

    set device port1

    set gateway 10.12.232.1

    next

    end

  3. Launch KVM virt-manager and select the recently created VM.

  4. Select on "Show virtual hardware details" button.

  5. Select Add Hardware.

  6. Select Storage and select Manage to navigate to the cloud-init ISO.

  7. Select Finish.

  8. Restart the VM.

Validate

Open the console to verify that the VM is booting and utilizing the day zero configuration file that was provided.

To verify the results:

  1. Go to the Console.

  2. Login to the CLI.

  3. Review port1 configuration. Type

    get system interface physical

  4. Confirm SSH access to the port1 IP address works.

  5. Power off the VM.

  6. Under the VM settings, set the VM to boot from the main drive.

  7. Start the VM.

Step 3 (Optional): Cloud-init using config drive

This section describes how to bootstrap a FortiNAC VM in KVM using config drive. This method can be used if deploying VMs and need to preconfigure the FortiNAC VM so that it boots with a predetermined configuration.

FortiNAC-OS supports version 2 of the config-drive capabilities. Cloud-Init config drive was initially created for OpenStack and other cloud environments and is a capability available on the FortiNAC even when booting within KVM. Config drive also allows the administrator to pass day zero configuration scripts to the FortiNAC VM on initial boot.

FortiNAC day zero configuration:

  • port1 IP Address

  • Subnet mask

  • Gateway

If not using this function, proceed to

Configure Network Settings.

Configure

  1. To pass a config drive to the FortiNAC VM, create the following directory structure:

    config-drive/openstack/latest/

  2. Create the FortiNAC configuration script user_data via text editor within this directory. The configuration script for a FortiNAC VM uses FortiNAC-OS CLI syntax.

    Script should contain the following content:

    #<HostName> Day0 Configuration

    config system interface

    edit port1

    set ip <port1 IP address>/<mask>

    set allowaccess https-adminui ssh

    next

    end

    config system route

    edit 1

    set device port1

    set gateway <Default Gateway for port1>

    next

    end

    Example

    Hostname = FNC

    port1 IP address and mask = 10.12.234.175/22

    Default gateway = 10.12.232.1

    cat config-drive/openstack/latest/user_data

    #FNC Day0 Configuration

    config system interface

    edit port1

    set ip 10.12.234.175/22

    set allowaccess https-adminui ssh

    next

    end

    config system route

    edit 1

    set device port1

    set gateway 10.12.232.1

    next

    end

  3. Launch KVM virt-manager and select the recently created VM.

  4. Select on "Show virtual hardware details" button.

  5. Select Add Hardware.

  6. Select Storage and select Manage to navigate to the cloud-init ISO.

  7. Select Finish.

  8. Restart the VM.

Validate

Open the console to verify that the VM is booting and utilizing the day zero configuration file that was provided.

To verify the results:

  1. Go to the Console.

  2. Login to the CLI.

  3. Review port1 configuration. Type

    get system interface physical

  4. Confirm SSH access to the port1 IP address works.

  5. Power off the VM.

  6. Under the VM settings, set the VM to boot from the main drive.

  7. Start the VM.