If you CentOS network configuration is set at DHCP and you want to change your network configuration to a static IP address, then read on.
The network configuration settings are generatlly found and edited in two places.
- /etc/sysconfig/network-scripts/ifcfg-eth0
- /etc/sysconfig/network
Edit the /etc/sysconfig/network-scripts/ifcfg-eth0 to resemble the following (replace the network addresses with your own).
DEVICE=eth0
USERCTL=no
ONBOOT=yes
BOOTPROTO=none
BROADCAST=192.168.1.255
NETWORK=192.168.1.0
NETMASK=255.255.255.0
IPADDR=192.168.1.5
Edit the /etc/sysconfig/network to resemble the following (replace the network addresses with your own).
NETWORKING=yes
HOSTNAME=name.host.net
FORWARD_IPV4=yes
GATEWAYDEV=
GATEWAY=192.168.1.254
DNS1=192.168.1.1
Alternatively, you can revert back to DHCP by editing /etc/sysconfig/network-scripts/ifcfg-eth0 to resemble the following.
DEVICE=eth0
USERCTL=no
ONBOOT=yes
BOOTPROTO=dhcp
BROADCAST=
NETWORK=
NETMASK=
IPADDR=
Source(s)
http://www.linuxheadquarters.com/howto/networking/networkconfig.shtml