Thursday, July 20, 2017

Change network mask on centos

Change network mask on centos


This post shows how to change the network mask and other ifconfig information on centos. After login to centos run the following command to open and edit the ifcfg-eth0 file:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Look for the line starting with PREFIX0, change the network mask here (not that this is specified in bits so, "PREFIX0=22" means network mask is 255.255.255.252).

After change is completed, restart the network service by running the following command:

service network restart