Uncategorized

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]
DEVICE=eth0
HWADDR=00:0c:29:77:dc:33
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.0.0.33
GATEWAY=10.0.0.1
TYPE=Ethernet

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

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]
DEVICE=eth0
HWADDR=00:0c:29:77:dc:33
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.0.0.33
GATEWAY=10.0.0.1
TYPE=Ethernet

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