LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-17-2019, 01:51 PM   #1
chrisguk
LQ Newbie
 
Registered: Aug 2014
Posts: 9

Rep: Reputation: Disabled
8 or 16 Bit netmask


I thought I was loosing my mind but I setup an interface with the IP 10.10.0.254 and a netmask of 16 bit. Once I brought the interface up and ran ifconfig it stated that the address was 8 bit 255.0.0.0

Anyone know why?
 
Old 04-17-2019, 01:54 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,375

Rep: Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571
Quote:
Originally Posted by chrisguk View Post
I thought I was loosing my mind but I setup an interface with the IP 10.10.0.254 and a netmask of 16 bit. Once I brought the interface up and ran ifconfig it stated that the address was 8 bit 255.0.0.0

Anyone know why?
Since you tell us absolutely NOTHING about version/distro of Linux, hardware, network environment, what you were expecting, etc., then no...we don't know why. Read the "Question Guidelines".

Without any sort of details, there's no way anyone can even guess.
 
Old 04-17-2019, 02:09 PM   #3
chrisguk
LQ Newbie
 
Registered: Aug 2014
Posts: 9

Original Poster
Rep: Reputation: Disabled
Sorry,

Distro ubuntu server 16.04
Virtual Machine on KVM
Network is a small LAN with a standard gateway.

I was expecting the output to show a 16bit netmask considering this is what I put in the iface config file.

Last edited by chrisguk; 04-17-2019 at 02:22 PM.
 
Old 04-17-2019, 02:41 PM   #4
ehartman
Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 527

Rep: Reputation: 251Reputation: 251Reputation: 251
Quote:
Originally Posted by chrisguk View Post
I thought I was loosing my mind but I setup an interface with the IP 10.10.0.254 and a netmask of 16 bit. Once I brought the interface up and ran ifconfig it stated that the address was 8 bit 255.0.0.0

Anyone know why?
You must have specified the netmask wrong because 255.0.0.0 is neither an 8- nor a 16-bit netmask, it is the default 24-bit netmask that belongs to a 10.*.*.* private network.
The number of 0-bits from the RIGHT is the netmask, so an 8-bit mask gives 255.255.255.0 and a 16-bit one would result in 255.255.0.0

I.e, in my private network I use only a 3-bit netmask, so ifconfig returns:
netmask 255.255.255.248
as that private net contains less than 7 systems anyway.
 
Old 04-17-2019, 03:05 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,464

Rep: Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654
Quote:
I.e, in my private network I use only a 3-bit netmask, so ifconfig returns:
netmask 255.255.255.248
as that private net contains less than 7 systems anyway.
The CIDR netmask notation is based upon the number of ones not zeros...

255.255.255.248 i.e 11111111.11111111.11111111.11111000 or /29

10.0.0.0 is a class A network which by default is a 255.0.0.0 or /8 network. I do agree with you that the OP probably entered an invalid format and the default was automatically used.

Post the interface config file.

Last edited by michaelk; 04-17-2019 at 04:15 PM.
 
Old 04-17-2019, 05:21 PM   #6
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 2,881

Rep: Reputation: 999Reputation: 999Reputation: 999Reputation: 999Reputation: 999Reputation: 999Reputation: 999Reputation: 999
Quote:
Originally Posted by michaelk View Post
Post the interface config file.
...also the ifconfig output.
 
Old 04-17-2019, 08:32 PM   #7
ehartman
Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 527

Rep: Reputation: 251Reputation: 251Reputation: 251
Quote:
Originally Posted by michaelk View Post
The CIDR netmask notation is based upon the number of ones not zeros...
You're right, thanks for the correction. It was rather too late (for me) when I posted that reply. Sorry to the OP.
 
Old 04-17-2019, 08:59 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,464

Rep: Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654
I knew what meant
 
Old 04-18-2019, 05:46 AM   #9
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, PCLinuxOS
Posts: 163

Rep: Reputation: 10
This might be a configuration issue. When you don't provide netmask while configuring, it will take default netmask based on IP address you have given. in your case, it is /8.

Please provide your configuration here.
 
Old 04-18-2019, 07:20 AM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,375

Rep: Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571Reputation: 5571
Quote:
Originally Posted by kaushalpatel1982 View Post
This might be a configuration issue. When you don't provide netmask while configuring, it will take default netmask based on IP address you have given. in your case, it is /8.

Please provide your configuration here.
Right; based on the question, we already knew this was a misconfiguration issue, and we've asked for the configuration here several times already. OP already stated they put a 16 bit value in the interface config file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pptp vpn netmask scheidel21 Linux - Networking 5 03-01-2010 07:19 AM
netmask spank Linux - Newbie 3 12-15-2003 09:12 AM
how do i get a netmask and default router code rszanto Linux - Newbie 2 04-13-2003 03:45 AM
How do you get a netmask and default router code rszanto Linux - Networking 1 04-12-2003 07:01 PM
PPP netmask RHrulz Linux - Networking 3 02-04-2003 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration