Linux - Set IP/DNS

1. Set static ip
Edit /etc/sysconfig/network-scripts/ifcfg-eth0

centos6:
DEVICE="eth0" 
BOOTPROTO="static" 
HWADDR="00:22:4D:7A:EC:71" 
NM_CONTROLLED="yes" 
ONBOOT="yes" 
TYPE="Ethernet" 
UUID="e05e5c26-2f48-4228-97c4-953fe6ad0e54" 
IPADDR=192.168.1.10 
NETMASK=255.255.255.0 
GATEWAY=192.168.1.1 
centos7:
# init settings
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
#BOOTPROTO=dhcp
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s8
UUID=b43dc135-58a9-427f-9daf-45d6e69b526a
DEVICE=enp0s8
ONBOOT=yes

# add the following
BOOTPROTO="static"
IPADDR=192.168.56.11
GATEWAY=192.168.56.1
NETMASK=255.255.255.0
DNS1=192.168.56.1

2. Set DNS
Edit /etc/resolv.conf

nameserver 8.8.8.8 
nameserver 8.8.4.4

3. Adding secondary IP Addresses(optional)
Add /etc/sysconfig/network-scripts/ifcfg-eth0:1 (eth0 is the primary adapter, physical, :1 is the virtual adapter sequence)

DEVICE="eth0:1"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.1.9
NETMASK=255.255.255.0
then start it by
ifup eth0:1
or by
service network restart
ref: http://dbiers.me/adding-secondary-ip-addresses-centosrhel/