Chapter 54. 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.
54.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. The following procedure describes how to use
nm-cloud-setup for Amazon EC2.
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
/etc/NetworkManager/NetworkManager.conf, create this initial connection manually.
# dnf install NetworkManager-cloud-setup
Create and run the snap-in file for the
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.
systemdsnap-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_AZUREfor Microsoft Azure
NM_CLOUD_SETUP_EC2for Amazon EC2 (AWS)
NM_CLOUD_SETUP_GCPfor Google Cloud Platform(GCP)
NM_CLOUD_SETUP_ALIYUNfor Alibaba Cloud (Aliyun)
- Save the file and quit the editor.
# systemctl daemon-reload
Enable and start the
# systemctl enable --now nm-cloud-setup.service
Enable and start the
# systemctl enable --now nm-cloud-setup.timer
- Configuring an Ethernet connection