Changing IP on CentOS system

I'm really writing this down for my own benefit. I mainly live in the Gentoo world, so when I hop on a CentOS box, I usually end up cursing for a bit. I needed to change a system to use a static IP vs. DHCP. To view the IP or interface settings, you need to view networking profiles:

cat /etc/sysconfig/networking/profiles/default/ifcfg-eth0

This should look similar to this:

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

Originally, there was no IPADDR, GATEWAY or NETMASK and BOOTPROTO was set to dhcp. To change the values edit the following file:

vi /etc/sysconfig/networking/devices/ifcfg-eth0

After changes have been made, restart the interface.

/etc/init.d/network restart

Some CentOS/RHEL info since it is my distro of choice:

The interface files you want to edit by hand are in /etc/sysconfig/network-scripts as /etc/sysconfig/networking is used by the GUI tools. On CentOS, if the GUI tools are installed, the network tool can be started as system-config-network

Instead of restarting the network, issuing ifdown eth0 followed by ifup eth0 will restart just that interface.

Instead of executing the /etc/init.d scripts directly, you can use the "service" command, as in service network restart