LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   A question about CIDR Mask example... (https://www.linuxquestions.org/questions/linux-newbie-8/a-question-about-cidr-mask-example-903675/)

trist007 09-18-2011 09:14 AM

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


markush 09-18-2011 10:11 AM

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

trist007 09-18-2011 10:16 AM

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?

trist007 09-18-2011 10:39 AM

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?

markush 09-18-2011 10:42 AM

Quote:

Originally Posted by trist007 (Post 4475219)
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

markush 09-18-2011 10:45 AM

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

trist007 09-18-2011 10:54 AM

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?

markush 09-18-2011 11:00 AM

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

trist007 09-18-2011 11:05 AM

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?

markush 09-18-2011 11:38 AM

yes, this would be useable IPs.

Markus

trist007 09-18-2011 11:55 AM

Thank you Markus, you've been very helpful.


All times are GMT -5. The time now is 07:33 PM.