Setting a static IP on Centos 7

edit /etc/sysconfig/network-scripts/ifcfg-eth0. This file might have a different name, depending on your interface name. You can find your interface name like so:

[justin@reiners.io ~] ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
      inet 10.240.10.22  netmask 255.255.255.255  broadcast 10.240.10.22
      ether 42:01:0a:f0:00:16  txqueuelen 1000  (Ethernet)
      RX packets 140129486  bytes 320630524130 (298.6 GiB)
      RX errors 0  dropped 0  overruns 0  frame 0
      TX packets 164316279  bytes 35380508973 (32.9 GiB)
      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

  lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
      inet 127.0.0.1  netmask 255.0.0.0
      inet6 ::1  prefixlen 128  scopeid 0x10<host>
      loop  txqueuelen 1  (Local Loopback)
      RX packets 34360581  bytes 4351601807 (4.0 GiB)
      RX errors 0  dropped 0  overruns 0  frame 0
      TX packets 34360581  bytes 4351601807 (4.0 GiB)
      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

In this example, your adaptor is named eth0.

change the BOOTPROTO from dhcp to static

append the following lines, but use your required values here. The file will have more lines as well but we only worry about these values for now.

BOOTPROTO=static
IPADDR=192.168.0.123
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=8.8.8.8
DNS2=8.8.4.4

once changed:

ifdown eth0
ifup eth0
-or-
systemctl restart network

Profit.