How to configure static IP addresses in CentOS 6

CentOS 6 minimal by default does not come with the network pre-configured.

In this guide, we will be showing you how to set a static IP address in CentOS 6 minimal.

We will first set up the Ethernet by editing the configuration file below.

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=1c:65:9d:93:fc:e1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
NM_CONTROLLED=yes
PEERDNS=yes
IPADDR=192.168.1.179
NETMASK=255.255.255.0


And then configure the default gateway

# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=server
GATEWAY=192.168.1.1
And then configure the DNS server

  # vi /etc/resolv.conf
nameserver 8.8.8.8

Once those changes are made, we need to restart the network services

# /etc/init.d/network restarted

If the IP address is not being used by any other device in the network, it will be assigned to your CentOS system.
You can confirm it by issuing the command below

# ifconfig

Leave a Reply

Your email address will not be published.