CentOS - IP Setting - Static IP- Command Line

Commands required to set a static IP in CentOS  are

. In Terminal , turn into root user and type as

vi /etc/sysconfig/network-scripts/ifcfg-eth0
There Place the content as

There as you can see the parameter. Set similar in your PC.Then save & close it with <Shift> + <:> +<w> + <q> .

Then In terminal type as

vi /etc/sysconfig/network

There give your Gateway as shown

You can disable/Enable network from there.

Then check your Gateway updated or not with

route -n

Then after that restart your network with

service network restart

Thats it. Now you can connect to your CentOS to Internet.
Points to remember : Nothing much !! all you have to execute the commands as root user.