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 stopOR/etc/init.d/NetworkManager stopStep-2: Make sure NetworkManager does not start at boot:
chkconfig NetworkManager offStep-3: Make sure the network service is set to start at boot:
chkconfig network onNow 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-eth0DEVICE=eth0HWADDR=00:1E:67:6C:5F:DCTYPE=EthernetUUID=c68c7552-3271-41b7-a0ef-f8e5b93ce529ONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=staticIPADDR=172.26.83.16NETMASK=255.255.252.0Note: change IP address according to you.
Configure Default Gateway by editing “/etc/sysconfig/network” file:
# vi /etc/sysconfig/networkNETWORKING=yesHOSTNAME=localhost.localdomainNTPSERVERARGS=iburstGATEWAY=172.26.83.254Note: change IP address according to you.
Restart Network Interface
service network restartOR/etc/init.d/network restartAdd these lines to “vi /etc/resolv.conf” to configure DNS Server
# vi /etc/resolv.confnameserver 172.31.1.130nameserver 172.31.1.1Note: change IP address according to you.