Chapter 49. Automatically configuring network interfaces in public clouds using nm-cloud-setup

Normally, a virtual machine (VM) has only one interface that is configurable by DHCP. However, some VMs might have multiple network interfaces, IP addresses, and IP subnets on one interface that is not configurable by DHCP. Also, administrators can reconfigure the network while the machine is running. The nm-cloud-setup utility automatically retrieves configuration information from the metadata server of the cloud service provider and updates the network configurations of VM in public clouds.

49.1. Configuring and pre-deploying nm-cloud-setup

To enable and configure network interfaces in public clouds, run nm-cloud-setup as a timer and service.


On Red Hat Enterprise Linux On Demand and AWS golden images, nm-cloud-setup is already enabled and no action is required.


  • A network connection exists.
  • The connection uses DHCP.

    By default, NetworkManager creates a connection profile which uses DHCP. If no profile was created because you set the no-auto-default parameter in /etc/NetworkManager/NetworkManager.conf, create this initial connection manually.


  1. Install the nm-cloud-setup package:

    # dnf install NetworkManager-cloud-setup
  2. Create and run the snap-in file for the nm-cloud-setup service:

    1. Use the following command to start editing the snap-in file:

      # systemctl edit nm-cloud-setup.service

      It is important to either start the service explicitly or reboot the system to make configuration settings effective.

    2. Use the systemd snap-in file to configure the cloud provider in nm-cloud-setup. For example, to use Amazon EC2, enter:


      You can set the following environment variables to enable the cloud provide you use:

      • NM_CLOUD_SETUP_AZURE for Microsoft Azure
      • NM_CLOUD_SETUP_EC2 for Amazon EC2 (AWS)
      • NM_CLOUD_SETUP_GCP for Google Cloud Platform(GCP)
      • NM_CLOUD_SETUP_ALIYUN for Alibaba Cloud (Aliyun)
    3. Save the file and quit the editor.
  3. Reload the systemd configuration:

    # systemctl daemon-reload
  4. Enable and start the nm-cloud-setup service:

    # systemctl enable --now nm-cloud-setup.service
  5. Enable and start the nm-cloud-setup timer:

    # systemctl enable --now nm-cloud-setup.timer

Additional resources