Chapter 9. Setting up a static networking configuration by using cloud-init
You can set up network configuration with cloud-init by adding a network-interfaces section to the metadata. With this setting, you can configure static IP addresses, gateways, and other network settings.
Red Hat Enterprise Linux (RHEL) provides its default networking service through NetworkManager, a dynamic network control and configuration daemon that keeps network devices and connections up and active when they are available.
Your datasource might provide a network configuration. For details, see the cloud-init section Network Configuration Sources.
If you do not specify network configuration for cloud-init and have not disabled network configuration, cloud-init tries to determine if any attached devices have an existing connection. If it finds a connected device, it generates a network configuration that issues a DHCP request on the interface. Refer to the cloud-init documentation section Fallback Network Configuration for more information.
Prerequisites
Depending on the requirements of your datasource, edit the
user-datafile or add the following directive to thecloud.cfg.ddirectory:NoteAll user directives include
#cloud-configat the top of the file so thatcloud-initrecognizes the file as containing user directives. When you include directives in thecloud.cfg.ddirectory, name the file*.cfg, and always include#cloud-configat the top of the file.
Procedure
Add a
network-interfacessection. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can disable a network configuration as follows:
network: config: disabled
network: config: disabledCopy to Clipboard Copied! Toggle word wrap Toggle overflow