You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

The default installation of Red Hat CoreOS(RHCOS) and Fedora CoreOS(FCOS) Linux system will likely be getting IP address from the DHCP server. This is partially true because of how installation is through ignition configuration files which are not flexible for static IP Address assignment.

Check: How To Run FCOS on KVM / OpenStack

Unlike other Linux operating systems, the RHCOS / FCOS has no install-time configuration. The system begins with a generic disk image. For each deployment mechanism (cloud VM, local VM, bare metal), configuration can be supplied at first boot. FCOS reads and applies the configuration file with Ignition.

Set Static IP Address on RHCOS / FCOS Machine

The easy way of assigning a static IP address to a RHCOS/FCOS Linux machine is by using nmcli. nmcli is a command-line tool for managing NetworkManager and reporting network status.

Once you’ve installed RHCOS/FCOS, check the default Network profile as reported by Network Manager.

$ nmcli connection show 
NAME                UUID                                  TYPE      DEVICE 
Wired connection 1  700e90aa-2867-3ad8-ba3d-e4a21f73c98c  ethernet  ens192 

As seen in my output, I have a network named ‘Wired connection 1’ which is mapped to ens192 network interface. Your output could vary from above depending on the environment RHCOS/FCOS is running on.

So I’ll set static IP address on RHCOS/FCOS Linux using command below.

sudo nmcli connection mod 'Wired connection 1' \
  ipv4.method manual \
  ipv4.addresses 192.168.20.10/24 \
  ipv4.gateway 192.168.20.254 \
  ipv4.dns 192.168.20.254 \
  +ipv4.dns 8.8.8.8 \
  connection.autoconnect yes

Where:

  • 192.168.20.10 is the IP address to assign
  • /24 is the subnet mask prefix – equals to 255.255.255.0
  • 192.168.20.254 is the gateway address for the network. Also DNS server
  • 8.8.8.8 is the secondary DNS server to be set
  • connection.autoconnect yes – Bring up the network automatically after reboot
  • ipv4.method manual – Set the IP assignment method to manual. Change from DHCP

Validate your changes.

$ nmcli connection show 'Wired connection 1'
$ cat /etc/sysconfig/network-scripts/ifcfg-Wired_connection_1 

Restart Network Manager to confirm not issues.

sudo systemctl restart NetworkManager

Similar guides:

Vuls – Best Vulnerability Scanner for Linux / FreeBSD / WordPress / Network

How to Configure Network Teaming on CentOS / RHEL 8/7

Add Secondary IP Address To CentOS / RHEL Network Interface

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF