How to configure a static IP address on CentOS 7

in #centos76 years ago (edited)

To verify the status of Network Manager service:

$ sudo systemctl status NetworkManager.service
network service.png

To check which network interface is managed by Network Manager, run:

$ nmcli dev status
mmcli.png

Have two way to configure a static IP address

Without network manager

Go to the /etc/sysconfig/network-scripts directory, and locate its configuration file (ifcfg-enp0s3). Create it if not found.
enp0s3.png
Open the configuration file and edit the following variables:
editnws.png

"NM_CONTROLLED=no": This interface will be set up using this configuration file, instead of being managed by Network Manager service.
"ONBOOT=yes": Tells the system to bring up the interface during boot.

Save changes and restart the network service using the following command:
$ sudo systemctl restart network.service

Verify that the interface has been properly configured:
$ ip addr
ipaddr.jpg