Manual Network Settings in Cloud Instance Reset Periodically

Contents

Problem Description

When Charon emulators are run on a cloud instance, often one or more NICs must be configured manually for emulator use.

After configuring the network interface settings in a Linux cloud instance either manually (via nmcli or ip commands) or via the Charon-SSP Manager, the configuration is periodically reset to the default DHCP configuration.

Possible Causes of the Problem

All Clouds Supported by nm-cloud-setup

Problem Cause

In some operating systems like RHEL 8.4, NetworkManager includes two extra services called nm-cloud-setup.service and nm-cloud-setup.timer.

  • If enabled, nm-cloud-setup configures the network at boot time by fetching the configuration from the well-known meta data server of the cloud provider.
  • If enabled, nm-cloud-setup.timer reruns  the nm-cloud-setup periodically to update the instance network configuration.

Such behavior can interfere with the manual configuration required for configuring a host interface dedicated to the emulator by resetting the manual configuration to the configuration retrieved from the instance metadata.

Solution

Test if the problem is caused by the nm-cloud-setup configuration:

  • Disable and stop the nm-cloud-setup.timer:

    # systemctl disable nm-cloud-setup.timer
    # systemctl stop nm-cloud-setup.timer

  • Repeat the manual interface configuration to prepare the NIC for use by the emulator.
  • Wait to see if the manual configuration is now persistent.

If the test confirms that the cause of the problem is the nm-cloud-setup configuration, disable the nm-cloud-setup service as well:

# systemctl disable nm-cloud-setup
# systemctl stop nm-cloud-setup

Google Cloud Platform (GCP)

Problem Cause

By default, Google cloud tools installed on the Linux instance automatically start the attached network interfaces and configure them using DHCP. This resets any manual interface configuration periodically.

Should this be undesirable, for example, because a NIC is to be dedicated to the guest operating system running in the emulator, this automatic configuration can be suppressed by disabling the setup in the file /etc/default/instance_configs.cfg.

Problem Solution

Important information:

  • Older Charon-SSP marketplace images are based on CentOS 7, newer ones are based on Linux 8.x.
  • The NetworkManager is disabled by default in instances based on Charon marketplace images that use Linux 7.x.
  • If you disable the automatic interface setup by GCP on instances running Linux 7.x, you must make sure that the correct ifcfg-files for every interface exist in /etc/sysconfig/network-config. Failure to do so, can make your instance unreachable after the next network restart. On instances based on Charon marketplace images using Linux 8.x you can use the NetworkManager manually or via the Charon Manager to configure the IP setup for additional interfaces.
  • If you use a RHEL/CentOS 8 or later image as the base image for your Charon host, the interface must be controlled by the NetworkManager. You can set up the appropriate configuration by editing the interface configuration files, using nmcli commands, the nmtui utility or the Charon Manager.

To disable automatic interface configuration by the cloud tools, edit the file and set the parameter setup to false as shown in the example below:

# vi /etc/default/instance_configs.cfg
[NetworkInterfaces]
dhclient_script = /sbin/google-dhclient-script
dhcp_command =
ip_forwarding = true
setup = false

Linux 7.x: after restarting the network (systemctl restart network), the configuration as defined in the ifcfg-files should be set for the interfaces.

Linux 8.x: on these systems with the NetworkManager enabled, instead

  • reactivate the connection on which the changes were performed:
    nmcli example: # nmcli con down <connection_name> && nmcli con up <connection_name>)
    (the command syntax is to ensure that the connectivity is not lost by executing the commands separately)
  • To reload a changed configuration file into the NetworkManager, use the command # nmcli connection reload. The Charon Manager will perform these steps automatically.

Please note: if your instance normally would detect the network MTU automatically, this will not work if DHCP is disabled, and the correct MTU must be set manually.

Related Articles




© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.