Configuring FCOS to Use a Static IP Address
As with any custom configuration on FCOS, you can write specific files in the
storage node of the Ignition file.
The following snippet shows how to assign the following to eth0:
DNS search domain:
variant: fcos version: 1.0.0 storage: files: - path: /etc/NetworkManager/system-connections/eth0.nmconnection mode: 0600 overwrite: true contents: inline: | [connection] type=ethernet interface-name=eth0 [ethernet] mac-address=<insert MAC address> [ipv4] method=manual addresses=192.0.2.10/24 gateway=192.0.2.1 dns=192.168.124.1;220.127.116.11;18.104.22.168 dns-search=redhat.com
|During the initramfs portion of the boot process, dracut will attempt to grab a DHCP address. When it times out, Ignition will take over and write the above configuration into the filesystem.|
If the interface does not come up correctly on first boot (see tracker issue 358), you have two possible workarounds.
If you configured a username and password in your Ignition configuration, you can login to the host via the console and issue the following commands to force the static IP to take effect:
nmcli connection down eth0
nmcli connection up eth0
If you are not able to access the host via the console, you can reboot the host and the static IP configuration will take effect.