How to Configure Static IP Address on CentOS 5.8 x86

Share this Article :

In this post, i will share the quick steps on how to configure static ip address on linux CentOS 5.8 server. This post assumed that you have installed linux CentOS 5.8 with minimum type of installation. If you planned to run this CentOS as a server, it better to configure static ip address.

After you have installed CentOS 5.8 linux server, the default DHCP ip configuration will be as below :

[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Example:

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:A1:17:AD
ONBOOT=yes

Please follow the following steps to configure static ip address on your linux CentOS 5.8 server.

1. Configure eth0 ip address and default gateway :

[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:A1:17:AD
ONBOOT=yes
IPADDR=192.168.1.53
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1
TYPE=Ethernet
PEERDNS=yes
USERCTL=no

2. Restart Network interface:

[[email protected] ~]# /etc/init.d/network restart

or

[[email protected] ~]# service network restart

3. Configure DNS server:

[[email protected] ~]# vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

Leave a Reply