I have a CentOS 7 Minimal VirtualBox VM that I would like to set a static IP address on. I want to assign the static IP address via a Bash script within the VM (so not using the VirtualBox network interface).
How can this be done?
So far I've tried editing the file :
/etc/sysconfig/network-scripts/ifcfg-enp0s8, and putting the below in it (per this question: https://superuser.com/a/365088).
TYPE="Ethernet" DEVICE="enp0s8" BOOTPROTO="static" IPADDR=192.168.100.101 NETMASK=255.255.255.0
But then the network adaptor doesn't restart (
service network restart), which after a considerable amount of restarts/resets/trial, and error, and copious googling, it seems like it could be dozens of different things.
ip a lists two devices:
I also have a
ifcfg-enp0s3 config file in the sysconfig dir (not sure why).
So, what's a nice, simple, predictable, reliable way of setting a static IP address in CentOS 7 Minimal?