This post is gathered from here (read it for more details)
The first thing I like to do is to turn off NetworkManager. This service is responsible for requesting DHCP addresses and configuring the network interfaces. Since we are setting them statically we do not need it.
First let’s stop NetworkManager:
service NetworkManager stop
Now let’s make sure it does not start at boot:
chkconfig NetworkManager off
Let’s also make sure the network service is set to start at boot:
chkconfig network on
Now that NM (NetworkManager) is out of the way we need to edit three files.
/etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/resolv.conf
First let’s edit /etc/sysconfig/network. Here w e will need to tell the system to turn on networking, the hostname of the machine and the gateway. Open the file in your favorite text editor and add or change the following lines. Of course you will need to make sure the configuration matches your system, this is just an example.
NETWORKING=yes HOSTNAME=server.domain.com GATEWAY=192.168.1.1
Now save and close that file. Let’s move on to editing the /etc/sysconfig/network-scripts/ifcfg-eth0 file. Open the file in your favorite text editor and add or change the following lines.
DEVICE=eth0 BOOTPROTO=static BROADCAST=192.168.1.255 IPADDR=192.168.1.10 NETMASK=255.255.255.0 NETWORK=192.168.1.0 ONBOOT=yes
Now that the network interface is taken care of we need the final important piece of the puzzle, DNS. Without DNS you will not be able to go to a website by name, on connect to anything else on the network unless you know the IP address. To tell the system what DNS servers to use we edit the /etc/resolv.conf file. Open the file in your favorite editor and add or change the following lines (search line is optional).
search domain.com nameserver 192.168.1.2 nameserver 192.168.1.3
Now that we have given the system the necessary information all we need to do is restart the network service.
service network restart