FortiClient
FortiClient proactively defends against advanced attacks. Its tight integration with the Security Fabric enables policy-based automation to contain threats and control outbreaks. FortiClient is compatible with Fabric-Ready partners to further strengthen enterprises’ security posture.
MZBZ
Staff
Staff
Article Id 357532
Description This article provides instructions on how to set a static IP address manually on the Ubuntu VM. Starting from version 7.4.1, FortiClient EMS is also available as a VM image for different hypervisor platforms (Vmware, KVM, Hyperv, and ...). By default, the VM's ethernet interfaces are configured to get IP address details from DHCP. 
Scope Linux-based FortiClient EMS v7.4.
Solution

The VM image is a preinstalled EMS on an Ubuntu v22.04 LTS which utilizes Netplan for interface management (Canonical Netplan).

 

There are two methods for configuring the networking settings:

  1. Manually editing the .yaml files located in /etc/netplan:
    Example YAML files are available at Examples - Netplan documentation and netplan/examples at main · canonical/netplan · GitHub.
    In the following image 50-cloud-init.yaml is the default config file (DHCP enabled), and the 70-netplan-set.yaml is generated using the 'netplan set' command (explained below).
     

    Screenshot 2024-11-13 103709.png

     

  2. 'netplan set' command:

    netplan set [key=value] writes a given key/value pair or YAML subtree into a YAML file in /etc/netplan/ and validates its format.

    A single value as: '[network.]ethernets.eth0.addresses=[1.2.3.4/24, 5.6.7.8/24]' or a full subtree as: '[network.]ethernets.eth0={dhcp4: true, dhcp6: true}' can be specified.
    A complete list of key/value pairs is described here: Ubuntu Manpage: netplan - YAML network configuration abstraction for various backends.

     

Example commands to use netplan to configure the static IP address, default GW, and DNS:

Use the 'ip a command to find the interface name, enp0s3 in the following example. More about Linux systemd interface naming is available at systemd.net-naming-scheme.

 

sudo netplan set ethernets.enp3s0.addresses=[192.168.1.10/24]
sudo netplan set ethernets.enp3s0.gateway4=192.168.1.1
sudo netplan set ethernets.enp3s0.nameservers.addresses=[192.168.1.1,8.8.8.8,8.8.4.4]

sudo netplan set ethernets.enp3s0.nameservers.search=[test1.local,test2.local,test3.local] --> Use this command to include local domains to resolve anything ending with e.g. test1.local
sudo netplan try --timeout 200 <-----
 This will provide a 200-second timeout and will revert to the previous configuration if no confirmation is provided within the 200-second time-window.
sudo netplan apply
sudo netplan get
--> Shows the configuration details.

The gateway4 has been decrypted, however it works! It is easier to simply use gateway4. The new notation uses Default Routes. It is easier and faster to use gateway4 in the console window and update the YAML file later when SSH access is available over IP:


sudo netplan set ethernets.enp3s0.routes='[{"to":"default","via":"192.168.1.1"}]'

 

2024-11-13 08_25_26-Clipboard.png

 

  1. If the static IP address does NOT persist after reboot, the issue could be related to cloud-init overwriting /etc/netplan/50-cloud-init.yaml on boot time (and a new config YAML file not being generated). The ultimate solution is explained in the comments at the top of the 50-cloud-init.yaml file:


# This file is generated from information provided by the datasource. Changes to it will not persist across an instance reboot. To disable cloud-init's network configuration capabilities, write a file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
network: {config: disabled}

More information on how to configure network settings in Ubuntu is available in Configuring networks | Ubuntu

Example YAML configuration for Netplan: Examples - Netplan documentation

 

To configure the VM IP address by modifying Netplan configuration files, see Deploying EMS as a VM image | FortiClient 7.4.1 | Fortinet Document Library