prefix vs netmask

Issues related to configuring your network
Post Reply
erixstrong
Posts: 4
Joined: 2014/03/06 16:45:58

prefix vs netmask

Post by erixstrong » 2014/03/06 17:03:16

Hi all,

We have a lot of servers running CentOS and in CentOS 6.4 there is a network setting that changed giving our software problem.

I would like to have information on why when you install CentOS (6.4 in my case) and configure the network setting from the GUI, the NETMASK setting is not included any more in the ifcfg-eth0.
Instead a PREFIX setting is seen.

I would also like to have the implication of having both settings if they don't match.



Thanks,

Eric

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: prefix vs netmask

Post by gerald_clark » 2014/03/06 17:46:29

I suggest you not use the NetworkManager service but use the network sevice instead.
system-config-network does have a netmask field.
Please read the FAQ http://wiki.centos.org/FAQ/CentOS6

erixstrong
Posts: 4
Joined: 2014/03/06 16:45:58

Re: prefix vs netmask

Post by erixstrong » 2014/03/06 18:10:19

Thanks Gerald for your reply.

Actually, we are using the CentOS (basic server) network configurator of the installer GUI to set up the network, like most probably our users will probably do. (we will need to change that...)

I was just wondering why the NETMASK setting was change to PREFIX, to understand the reasons behind this change.

Also, If both NETMASK and PREFIX are included in the ifcfg-eth0 file, which one has priority for the OS ?

From what I'm seeing the PREFIX will have priority, if this is true, does this mean that the NETMASK is not used at all by the CentOS any more ?



Rgds,

Eric

User avatar
Super Jamie
Posts: 308
Joined: 2014/01/10 23:44:51

Re: prefix vs netmask

Post by Super Jamie » 2014/03/07 03:36:20

You can use either PREFIX or NETMASK, but you only need to use one.

NETMASK=255.255.255.0 and PREFIX=24 mean the same thing.

You can see all the valid parameters in the network config files with less $(locate sysconfig.txt)

erixstrong
Posts: 4
Joined: 2014/03/06 16:45:58

Re: prefix vs netmask

Post by erixstrong » 2014/03/07 15:18:51

Hi Jamie,

Thanks for the command less $(locate sysconfig.txt). I didn't know about this file.

I knew that 255.255.255.0 and prefix 24 was the same thing.
Its only that our software was looking at the netmask setting and now we will need to change it, to look at the netmask & the prefix, in case a user makes a modification manually of the network config file.

It is not a big deal, but I was wondering what was the advantage of using the prefix instead of the netmask or why it was changed.



Rgds,

Eric

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: prefix vs netmask

Post by gerald_clark » 2014/03/07 16:19:23

Instead of reading the config files you could perhaps check the output of 'ifconfig eth0' or 'ip address show eth0'.

User avatar
Super Jamie
Posts: 308
Joined: 2014/01/10 23:44:51

Re: prefix vs netmask

Post by Super Jamie » 2014/03/07 23:10:48

erixstrong wrote:It is not a big deal, but I was wondering what was the advantage of using the prefix instead of the netmask or why it was changed.
PREFIX was added, you can still use NETMASK if you wish to.

I'm not one of the initscript developers, but I suspect the option to use CIDR prefix was added simply because it's easier to work with a small number like "18" or "24" or "28" than mess around with long subnet masks.

If you are concerned about your admins editing a file in the wrong way, then educate them! The options are all documented in sysconfig.txt and IIRC the upstream vendor's documentation has some bits too. Train your admins to use the config files properly, document your organization's config standard, and there should (theoretically) never be a problem with someone confused by the ifcfg files :)

erixstrong
Posts: 4
Joined: 2014/03/06 16:45:58

Re: prefix vs netmask

Post by erixstrong » 2014/03/17 17:03:24

Thank you Super Jamie and all for your answers.

Post Reply