Centos – Setting static IP on CentOS without system-config-network

centosipstatic-ip

Background information:
I have a problem installing system-config-network. It appears it cannot find an update to sqlite (checks every mirror and comes back empty handed.) I have tried the skipping broken option and package cleanups from yum-utils.

Since I cannot get it installed, I decided to set an ip manually from console. A quick Google search comes back empty handed as for an easy how-to guide that works. What do I need to do for a currently configured DHCP ip to change it to a Static IP from console.

Thanks,
Josh

Best Answer

Edit the /etc/sysconfig/network-scripts/ifcfg-eth[num] file like this:

DEVICE=eth0
BOOTPROTO=none
HWADDR=<your MAC>
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=<ip>
GATEWAY=<gateway>

When you are done run /etc/init.d/network restart.

Related Topic