Static IP Configuration in CentOS

For example, to configure the IP of eth0, edit the file /etc/sysconfig/network-scripts/ifcfg-eth0

## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
 
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
NAME="System eth0"
TYPE=Ethernet
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
BOOTPROTO=static
IPADDR=192.168.1.88 # Replace with your ip address
NETMASK=255.255.255.0
 
 
## Configure Default Gateway
#
# vi /etc/sysconfig/network
 
NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1

And then restart the network interfaces by

/etc/init.d/network restart

Optionally, configure the DNS servers by editing the file /etc/resolv.conf

## Configure DNS Server
#
# vi /etc/resolv.conf
 
nameserver 8.8.8.8 # Replace with your nameserver ip
nameserver 192.168.1.1 # Replace with your nameserver ip

Published by

vivo

This is Vivo. Yes, I'm Vivo.

Leave a Reply

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