How to Configure Static IP Address on CentOS 6.3 Linux Server

This post will covers the steps to configure static ip address, default gateway, netmask, dns server and make a network auto start at boot on linux CentOS 6.3. Server normally configured with static ip address, so that easier to maintain the configuration on it’s client and DNS server will always able to resolve it.

DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="xx:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="no"
TYPE="Ethernet"
UUID="xxxxxxxx-05a0-4adf-84fd-850aca6521c7"

1. Configure eth0:

[root@centos63 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="xx:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="xxxxxxxx-05a0-4adf-84fd-850aca6521c7"
IPADDR=192.168.1.54
NETMASK=255.255.255.0

2. Configure Default gateway:

[root@centos63 ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos63.ehowstuff.local
GATEWAY=192.168.1.1

3. Restart Network interface:

[root@centos63 ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]

4. Configure DNS server :

[root@centos63 ~]# vi /etc/resolv.conf
nameserver 8.8.8.8
1 comment
  1. Barcelona23
    Barcelona23
    July 28, 2012 at 7:33 am

    Any idea about this error. I’m using centOs 6.3 with vmware.

    Reply
Leave a Reply

Your email address will not be published. Required fields are marked *

SiteGround.com

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.

TRY FREE

* up to 30 days money back guarantee