LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2007, 10:13 AM   #1
master
Member
 
Registered: Oct 2003
Location: Birmingham/Eng/UK
Distribution: /Debian3.1/suse/Win7/8/10
Posts: 680

Rep: Reputation: 30
subnets how to


Hi Im hoping someone here can clear something up for me I am studying subnets.The problem is I dont understand something so I need some one to give me an example please.
(b) The IP address allocated by a network administrator is 172.16.0.0 255.255.224.0.
How many possible subnets and usable subnets are there? How many hosts in each subnet? In both cases, explain your answer.
(16 marks)

Answer:
This address “172.16.0.0 255.255.224.0” Is a class B network address. This means the first 2 octets are owned by the network and the rest is for the host. To calculate how many subnets there are I converted the first octet owned by the host in the subnet part of the address to binary which is:
224 = 11100000
I then calculated how many 1s there were in the binary conversion which is 3.
I then did 2 ^ 3 = 8 - 2 = 6. This last sum told me how many subnets I could have which is 6.

To calculate how many hosts I went to the first octet owned by the host in the subnet part of the address which is “224” and converted it to binary which is “11100000”
224 = 11100000
I then calculated how many 0s there were in the binary address which is 5.
2 ^ 5 = 32 – 2 = 30 which says I can have 30 hosts per subnet.

I believe I am doing this part right.
My problem is this even though i can work out how many subnets and hosts I can have with a given subnet address I dont know what my next subnet would read so i dont know how to answer the next set of questions I have been given,so I am hoping someone can give me an example.

The question they gave me is.
The IP address allocated by a network administrator is 198.230.10.0 255.255.255.240.
(i) What is the network address of the fifth (4) subnet?

(ii) what is the address of the first useable host in the fifteenth (14) subnet?

I have worked out that the address "198.230.10.0 255.255.255.240" can only have 14 subnets I suppose what i want to be able to do is know how to list the 14 subnets so that i can answer the questions
Dont get me wrong Im not cheating I just dont know how to work it out if someone does give me an example it does not have to be based on this question.
Thanks in advance.
 
Old 12-07-2007, 11:11 AM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by master View Post
To calculate how many subnets there are I converted the first octet owned by the host in the subnet part of the address to binary which is:
224 = 11100000
I then calculated how many 1s there were in the binary conversion which is 3.
I then did 2 ^ 3 = 8 - 2 = 6. This last sum told me how many subnets I could have which is 6.
Where did the -2 come from? You have 8 subnets with netmask 255.255.224.0 in the class B network prefix 172.16. They are:
Code:
172.16.000.0/19
172.16.032.0/19
172.16.064.0/19
172.16.096.0/19
172.16.128.0/19
172.16.160.0/19
172.16.192.0/19
172.16.224.0/19
Quote:
Originally Posted by master View Post
To calculate how many hosts I went to the first octet owned by the host in the subnet part of the address which is “224” and converted it to binary which is “11100000”
224 = 11100000
I then calculated how many 0s there were in the binary address which is 5.
2 ^ 5 = 32 – 2 = 30 which says I can have 30 hosts per subnet.
That makes sense.
Quote:
Originally Posted by master View Post
I believe I am doing this part right.
My problem is this even though i can work out how many subnets and hosts I can have with a given subnet address I dont know what my next subnet would read so i dont know how to answer the next set of questions I have been given,so I am hoping someone can give me an example.
Read the example above to see how to enumerate subnets (using the most natural ordering).
 
Old 12-07-2007, 12:47 PM   #3
master
Member
 
Registered: Oct 2003
Location: Birmingham/Eng/UK
Distribution: /Debian3.1/suse/Win7/8/10
Posts: 680

Original Poster
Rep: Reputation: 30
where did the -2 come from
Well looking through all the tutorials on the net i have found this one
http://www.betaone.net/forum/thread-18215.html
The way I understand it is we minus 2 so we can find out the number of useable hosts because when we break this down we will be reserving 2 ips one for the network address and one for the broadcast which we can't use for a regular host.
I have been looking at your answer
172.16.000.0/19
172.16.032.0/19
172.16.064.0/19
172.16.096.0/19
172.16.128.0/19
172.16.160.0/19
172.16.192.0/19
172.16.224.0/19
can you please tell me your working out how did you come by these numbers.
Regards Nige.

Thanks for your reply.
 
Old 12-07-2007, 02:18 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by osor View Post
That makes sense.
Actually, when I said this, I was not thinking clearly. There are not 2^5-2 hosts per subnet. In fact there are 2^13-2 (8190) hosts in each subnet. The thirteen comes in because you have to look at all the zeros in the binary netmask (you left out the eight zeros at the end). Another way to look at it is 1*1*32*256-2 (1 possible choice for the first number, 1 possible choice for the second number, 32 possible choices for the third number, and 256 possible choices for the fourth number).
Quote:
Originally Posted by master View Post
where did the -2 come from
Well looking through all the tutorials on the net i have found this one
http://www.betaone.net/forum/thread-18215.html
The way I understand it is we minus 2 so we can find out the number of useable hosts because when we break this down we will be reserving 2 ips one for the network address and one for the broadcast which we can't use for a regular host.
Yes, you do need to subtract 2 when finding the number of hosts in a (sub)network. You don’t need to subtract 2 when finding the number of subnets in a given network.
Quote:
Originally Posted by master View Post
can you please tell me your working out how did you come by these numbers.
Ok. First, we look at our given network (prefix). This is the class B prefix 172.16 (which corresponds to 172.16.0.0/16). But we want to split this entire class B network up into smaller subnetworks. Specifically, we want subnets with 19 bits reserved for the network (i.e., with a netmask of 255.255.224.0). We already calculated that there are eight of these—i.e., 2^(19-16). We also calculated that each subnet has 8192 numbers (only 8190 of which are usable as actual hosts). Let’s start at the 172.16.0.0/19 and count the number of addresses until we reach our limit:
Code:
Index         IP address
1           172.16.00.000
2           172.16.00.001
3           172.16.00.002
…
254         172.16.00.253
255         172.16.00.254
256         172.16.00.255
257         172.16.01.000
258         172.16.01.001
259         172.16.01.002
260         172.16.01.003
…
511         172.16.01.254
512         172.16.01.255
513         172.16.02.001
…
8190        172.16.31.253
8191        172.16.31.254
8192        172.16.31.255
And so you see that the first 8192 addresses run from 172.16.0.0 to 172.16.31.255. The next subnet will therefore start at 172.16.32.0 and the last address will be 172.16.63.255.

In general, it is true of all 19-bit networks that the first two numbers in the IP are always the same, the third is always between a multiple of 32 and one less than the next higher multiple of 32, and the fourth is between 0 and 255.
 
Old 12-07-2007, 08:39 PM   #5
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Quote:
The question they gave me is.
The IP address allocated by a network administrator is 198.230.10.0 255.255.255.240.
(i) What is the network address of the fifth (4) subnet?

(ii) what is the address of the first usable host in the fifteenth (14) subnet?

I have worked out that the address "198.230.10.0 255.255.255.240" can only have 14 subnets I suppose what i want to be able to do is know how to list the 14 subnets so that i can answer the questions
Dont get me wrong Im not cheating I just dont know how to work it out if someone does give me an example it does not have to be based on this question.
Are you sure you came up with 14 Subnets for this one ? 2^X = 14 ? .... Sorry X does not compute

255.255.255.240 = 28 11111111.11111111.11111111.11110000

2^4 = __ subnets

Looks like you used the 'usable host calculation' ((2^4)-2) to figure the number of available subnets..


here is the first subnet worked out...
Code:
Address:   198.230.10.0         11000110.11100110.00001010.0000 0000
Netmask:   255.255.255.240 = 28 11111111.11111111.11111111.1111 0000
Wildcard:  0.0.0.15             00000000.00000000.00000000.0000 1111
=>
Network:   198.230.10.0/28      11000110.11100110.00001010.0000 0000
HostMin:   198.230.10.1         11000110.11100110.00001010.0000 0001
HostMax:   198.230.10.14        11000110.11100110.00001010.0000 1110
Broadcast: 198.230.10.15        11000110.11100110.00001010.0000 1111
Hosts/Net: 14                    Class C
So do your math again.. 2^4 = 16 so each subnet, taking into account the network and broadcast address, is comprised of 16 addresses... I think you'll find your missing subnets for this question..



Sub-netting is an odd bird.. it seems difficult and confusing at first, then something sorta clicks and you finally just get it.. once you get it, you wonder why it seemed so darn difficult in the first place..

hang in there, and pretty soon you'll be doing complex boolean algebra in you noggin
 
Old 12-09-2007, 05:52 AM   #6
master
Member
 
Registered: Oct 2003
Location: Birmingham/Eng/UK
Distribution: /Debian3.1/suse/Win7/8/10
Posts: 680

Original Poster
Rep: Reputation: 30
Hi thanks for all the help.

The IP address allocated by a network administrator is 198.230.10.0 255.255.255.240.
(i) What is the network address of the fifth (4) subnet?

(ii) what is the address of the first usable host in the fifteenth (14) subnet?

(quote)
Address: 198.230.10.0 11000110.11100110.00001010.0000 0000
Netmask: 255.255.255.240 = 28 11111111.11111111.11111111.1111 0000
Wildcard: 0.0.0.15 00000000.00000000.00000000.0000 1111
=>
Network: 198.230.10.0/28 11000110.11100110.00001010.0000 0000
HostMin: 198.230.10.1 11000110.11100110.00001010.0000 0001
HostMax: 198.230.10.14 11000110.11100110.00001010.0000 1110
Broadcast: 198.230.10.15 11000110.11100110.00001010.0000 1111
Hosts/Net: 14 Class C

So when I break this number down in to 16 subnets
255.255.255.0
255.255.255.16
.32
.48
.64
.80
.96
.112
.128
.144
.160
.176
.192
.208
.224
255.255.255.240

So our network address was 230.10.0
Our first useable ip we simply added 1 on to the network address to make it "198.230.10.1"

Our last useable ip address is "198.230.10.14" because we can only have 14 useable ips as 2 of them are reserved for the broadcast and network address.

That means "198.230.10.16" would be the network address of the second subnet.
so
Address: 198.230.10.16
HostMin: 198.230.10.17
HostMax: 198.230.10.30
Broadcast: 198.230.10.31
Hosts/Net: 14 Class C

If I have got this all right I would just continue that sequence so that "198.230.10.32" would be the wire address of the next subnet.

Are you sure you came up with 14 Subnets for this one ?

You are quite right I did actually come up with 16 subnets I was simply misguided by myself,I did -2 thinking I was supposed to subtract 2 the same way we do with the host calculation.I wont make that mistake again.

So question is have I got it or have I tripped.
Thanks again for some great replys

Last edited by master; 12-09-2007 at 12:47 PM.
 
Old 12-09-2007, 10:42 AM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by master View Post
So question is have I got it or have I tripped.
You seem to have gotten it.
 
Old 12-09-2007, 01:05 PM   #8
master
Member
 
Registered: Oct 2003
Location: Birmingham/Eng/UK
Distribution: /Debian3.1/suse/Win7/8/10
Posts: 680

Original Poster
Rep: Reputation: 30
Thank you to the both of you who helped me.
Cheers Nige.
 
Old 12-09-2007, 04:45 PM   #9
master
Member
 
Registered: Oct 2003
Location: Birmingham/Eng/UK
Distribution: /Debian3.1/suse/Win7/8/10
Posts: 680

Original Poster
Rep: Reputation: 30
I have been working on this all night there seems to be a problem with it.

The IP address allocated by a network administrator is 198.230.10.0 255.255.255.240.
(i) What is the network address of the fifth (4) subnet?

(ii) what is the address of the first usable host in the fifteenth (14) subnet?


Network: 198.230.10.0
HostMin: 198.230.10.1
HostMax: 198.230.10.14
Broadcast: 198.230.10.15 I have used 16 numbers in the first subnet

Network: 198.230.10.16
HostMin: 198.230.10.17
HostMax: 198.230.10.31
Broadcast: 198.230.10.32 I have used 16 numbers in the 2nd subnet

so just to speed things up here I will show the last numbers
.33
.34
.48
.49


.50
.51
.65
.66 I have used 16 numbers in each subnet,but as i continue with this numbering scheme I finally get this.

address 198.230.10.237
hostmin 198.230.10.238
hostmax


Can you see my problem for some reason this has not worked because I should of finished on "240" I have clearly missed something any chance on pointing it out to me??? please
 
Old 12-09-2007, 05:54 PM   #10
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by master View Post
Network: 198.230.10.16
HostMin: 198.230.10.17
HostMax: 198.230.10.31
Broadcast: 198.230.10.32 I have used 16 numbers in the 2nd subnet
No you haven’t. If you count 16, 17, 18, …, 32 you end up with 17 numbers. It should be HostMax = 198.230.10.30 and Broadcast = 198.230.10.31.
 
Old 12-10-2007, 01:51 PM   #11
master
Member
 
Registered: Oct 2003
Location: Birmingham/Eng/UK
Distribution: /Debian3.1/suse/Win7/8/10
Posts: 680

Original Poster
Rep: Reputation: 30
Hi osor,
I think I must of been very tired last night,in fact I know I was.Thanks very much for your fast reply and all of your help I can now see where I was going wrong.
Regards Nige.
 
  


Reply



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
connecting between subnets thirdorderharmonic Linux - Networking 4 12-15-2006 10:42 AM
Routing between two subnets ScottReed Linux - Networking 22 10-24-2006 10:32 PM
help on subnets HappyGilmore Linux - Networking 12 07-07-2005 09:33 AM
newbie, subnets ... -mk- Linux - Networking 1 08-17-2004 03:41 AM
Broadcast across subnets lezek Linux - Networking 3 01-01-2004 07:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:47 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
Open Source Consulting | Domain Registration