First you will need to edit the file ifcfg-eth0 :


vi /etc/sysconfig/network-scripts/ifcfg-eth0

Here is an example, just make sure to change your IP Address that you want to use and your netmask if applicable.

DEVICE=”eth0″
NM_CONTROLLED=”yes”
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
NAME=”System eth0″
IPADDR=192.168.1.44
NETMASK=255.255.255.0

Next you need to go in and configure your default gateway :


vi /etc/sysconfig/network

Again here is an example, make sure to keep your hostname what you set it up to be :

NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1

Last thing you will need to do is set up your nameservers :


vi /etc/resolv.conf

Here is an example, this example is using google’s DNS server and a home router

nameserver 8.8.8.8
nameserver 192.168.1.1

And finally you will need to restart the network service :


/etc/init.d/network restart