LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-18-2011, 10:14 AM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Rep: Reputation: 69
A question about CIDR Mask example...


Is this a valid example? and is my thinking correct?

73.19.22.14/17
Code:
11111111.11111111.1/1111111.11111111
   network               host
So 17 bits for network ID
Here's the break down for the value of each bit
Code:
128 64 32 16 8 4 2 1
So 15 bits for host ID which gives us
127 + 256 = 383 ips - 2 which leaves 381 available IP
I reserve 2 IPs for the network ID and broadcast IP.
Code:
Network ID: 73.19.22.14
IP Range: 73.19.22.15 - 73.19.22.255
          73.19.23.0  - 73.19.23.143
Broadcast IP: 73.19.23.144
Now on my IP Range, 73.19.23.0 and 73.19.22.255, can they be an IP or should it have been
Code:
Network ID: 73.19.22.14
IP Range: 73.19.22.15 - 73.19.22.254
          73.19.23.1  - 73.19.23.145
Broadcast IP: 73.19.23.146

Last edited by trist007; 09-18-2011 at 10:25 AM.
 
Old 09-18-2011, 11:11 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hi,

you'll need not a 17bit mask here but a 23bit mask.
Code:
Networkadress: 73.19.22.0/23 
IP-Range from 73.19.22.1 up to 73.19.23.254
where 73.19.23.255 is the broadcastadress.
this would be a valid subnet.

I think you confused
Quote:
Originally Posted by trist007
127 + 256 = 383 ips - 2 which leaves 381 available IP
with
Code:
128*256 - 2 = 32766 IP-adresses
which is obviously not what you're looking for.

Markus
 
Old 09-18-2011, 11:16 AM   #3
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Can you explain why I would need a 23 bit mask instead of a 17 bit mask?

IP Range: 73.19.22.1 up to 73.19.23.254
That would only be 73.19.22.1 - 73.19.22.254 and 73.19.22.1 - 73.19.23.254, that's only 255 + 254 IP addresses. How can there be 32766 IP-adresses?

The CIDR Mask is 73.19.22.14/17 not 73.19.22.0/23.

Would 73.19.22.14/17 not be a valid subnet?

Last edited by trist007; 09-18-2011 at 11:27 AM.
 
Old 09-18-2011, 11:39 AM   #4
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Ah ok I think I understand why I need a 23 bit mask.

So 73.19.22.14/17 is not a valid CIDR because to have a .14 at the end I would only be left with 1 bit for the host
Code:
01010011.00010011.00010110.00001110 
11111111.11111111.1111111 = 23 bits
I see now that the mask I applied above would work with /23
So yes 73.19.22.0/23 would be a valid CIDR mask
Code:
network ID: 73.19.22.0
IP range: 73.19.22.1 - 73.19.22.255 and 73.19.23.1 - 73.19.23.254
Broadcast: 73.19.23.255
Subnet Mask: 255.255.254.0
IPs available: 255 + 254 = 499
So then 73.19.22.255 and 73.19.23.0 are usable IPs?

Am I understanding it better?

Last edited by trist007; 09-18-2011 at 11:47 AM.
 
Old 09-18-2011, 11:42 AM   #5
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Quote:
Originally Posted by trist007 View Post
So 73.19.22.14/17 is not a valid CIDR because to have a .14 at the end I would only be left with 1 bit for the host
it is a valid IP-adress, but not a valid network-adress. But it would be a network with 32766 Adresses and the networkadress would be 73.19.22.0/17.

Markus
 
Old 09-18-2011, 11:45 AM   #6
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Quote:
Originally Posted by trist007
IP range: 73.19.22.1 - 73.19.22.255 and 73.19.23.1 - 73.19.23.254
no, the range would be
Code:
IP range: 73.19.22.1 - 73.19.23.254
what you describe where two subnets
Code:
73.19.22.0/24 and
73.19.23.0/24
Markus
 
Old 09-18-2011, 11:54 AM   #7
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
My previous question where the IP range: 73.19.22.1 - 73.19.23.254
Code:
So then 73.19.22.255 and 73.19.23.0 are usable IPs?
How would the bits look for 73.19.22.0/17?
Code:
01001001.00010011.00010110.00000000
11111111.11111111.1111111 = 23 bits
Wouldn't you need a 23 bit mask though?

Last edited by trist007; 09-18-2011 at 11:56 AM.
 
Old 09-18-2011, 12:00 PM   #8
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
with a 17bit mask you would have
Code:
network-adress: 73.19.0.0/17
or
network-adress: 73.19.128.0/17

01001001.00010011.00000000.00000000 
or 
01001001.00010011.10000000.00000000
Markus
 
Old 09-18-2011, 12:05 PM   #9
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Ah ok I see now, that makes sense. So 73.19.22.0/17 is not possible. What confuses me is when the CIDR notation ends in anything other than 0. But I see now how you can find the possibilities given a certain subnet mask.

My previous question where the IP range: 73.19.22.1 - 73.19.23.254 (in this case this range is considered to be on one subnet correct?)
Code:
So then 73.19.22.255 and 73.19.23.0 are usable IPs?

Last edited by trist007; 09-18-2011 at 12:07 PM.
 
Old 09-18-2011, 12:38 PM   #10
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
yes, this would be useable IPs.

Markus
 
Old 09-18-2011, 12:55 PM   #11
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Thank you Markus, you've been very helpful.
 
  


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
bash CIDR calculator genderbender Programming 18 10-29-2014 11:13 AM
Use flags and package.mask question artur13 Gentoo 6 03-22-2010 10:43 AM
[SOLVED] CIDR explanantion? qwertyjjj Linux - Newbie 2 08-18-2009 08:02 AM
C cidr argv quantt Programming 11 01-26-2009 08:03 AM
question about IP address and subnet mask 2007fld Linux - Networking 4 03-28-2007 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:30 AM.

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