Correct /etc/sysconfig/network-scripts/ifcfg-eth0 settings to assign a static IP

I normally use Ubuntu, so a simple netplan file works to assign an IP.

Have a project requiring CentOS 8 (shudder).

None of the ifcfg-eth0 conjurations I’ve tried has produced a successful static IP assignment.

Someone passing along a working ifcfg-eth0 assigning a static IP will be greatly appreciated.


Take a look at How to assign public ip to the container of centos where ubuntu focal as hypervisor for the commands to run.

Equally if you are using LXD’s DHCP service, then you can assign a static DHCP allocation in the LXD NIC device and the container can continue to use DHCP.