How To Configure Static IP On CentOS 6.5


In order to set static IP and complete this configuration, You will need the following information:
– IP Address
– Netmask
– Gateway Address
– DNS Server Addresses

Step-1: First you have to stop NetworkManager:

service NetworkManager stop
OR
/etc/init.d/NetworkManager stop

Step-2: Make sure NetworkManager does not start at boot:

chkconfig NetworkManager off

Step-3: Make sure the network service is set to start at boot:

chkconfig network on

Now NetworkManager is out of the way we need to edit these three files.
1. /etc/sysconfig/network-scripts/ifcfg-eth0
2. /etc/sysconfig/network
3. /etc/resolv.conf

First of all edit “/etc/sysconfig/network-scripts/ifcfg-eth0” file to configure eth0:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:1E:67:6C:5F:DC
TYPE=Ethernet
UUID=c68c7552-3271-41b7-a0ef-f8e5b93ce529
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=172.26.83.16
NETMASK=255.255.252.0

Note: change IP address according to you.

Configure Default Gateway by editing “/etc/sysconfig/network” file:

# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
NTPSERVERARGS=iburst
GATEWAY=172.26.83.254

Note: change IP address according to you.

Restart Network Interface

service network restart
OR
/etc/init.d/network restart

Add these lines to “vi /etc/resolv.conf” to configure DNS Server

# vi /etc/resolv.conf
nameserver 172.31.1.130
nameserver 172.31.1.1

Note: change IP address according to you.


You may also like...

Show Buttons
Hide Buttons