How to Configure Static IP Address on CentOS 6.3 Linux Host

This post shows 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 host 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"

1. Configure eth0:

[root@centos ~]# nano /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="xx:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=192.168.3.3
NETMASK=255.255.255.0

2. Configure Default gateway:

[root@centos ~]# nano /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos.somedomain.local
GATEWAY=192.168.13.1

4. Configure DNS server :

[root@centos ~]# nano /etc/resolv.conf
nameserver 8.8.8.8

Tip, If after a reboot the interface is still not working, you may need to delete the 70-persistent-net.rules file from /etc/udev/rules.d

Related Posts

Leave a Reply