How to Configure Static IP Address on CentOS 6.4

When you run one or more of any type of Web, DNS, Email, FTP or any other application server’s directly on your site, then you are require Static IP address. If you run a website hosting in Virtual Private Server (VPS), end user will types the domain name (e.g www.example.com) into their web browser it is translated via a DNS service to a specific IP address of your web server. Rules of thumb, any type of server is mandatory to have static IP Address because it is constant, otherwise the end user or the websites visitors will experience inaccessible website. This post will share how to setup Static IP Address on CentOS 6.4.

See also  How to Grant a New User to Root Privileges on CentOS 6 / CentOS 7

1. Configure static IP address on eth0 :

[root@centos64 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Original :

DEVICE=eth0
HWADDR=00:0C:29:F1:24:F0
TYPE=Ethernet
UUID=324bfeb3-2a7c-409c-98d0-5cf1607596c4
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=dhcp

Set to the following :

DEVICE=eth0
HWADDR=00:0C:29:F1:24:F0
TYPE=Ethernet
UUID=324bfeb3-2a7c-409c-98d0-5cf1607596c4
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.2.62
NETMASK=255.255.0.0

2. Configure gateway :

[root@centos64 ~]# vi /etc/sysconfig/network

Add gateway line :

NETWORKING=yes
HOSTNAME=centos64.ehowstuff.local
GATEWAY=192.168.2.1

3. Configure DNS :

; generated by /sbin/dhclient-script
search Belkin ehowstuff.local
nameserver 192.168.2.1

Update to the following :

search ehowstuff.local
nameserver 8.8.8.8

4. Restart network service to apply the changes :

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

Comments

1 Comment

Leave a Reply

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