File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes General Computing and the fly likes my understanding about subnet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "my understanding about subnet?" Watch "my understanding about subnet?" New topic
Author

my understanding about subnet?

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
This post is related to subnet (sub network). Please move it if it's not in right place.

It's more about confirming my understanding about subnet.

Theoretically, a subnet is a logical group of hosts (systems) in a bigger network. They have an IP address in following format xx.xx.xx.xx/xx

Now if someone gives me a subnet address (195.23.24.29/24). Can I get IP addresses of all the hosts in this subnet?

Here is my understanding:

Any IP address has two parts (first 3 octets represent network (xx.xx.xx) & 4th octet is host).
Coming back to subnet & my example, the 24 after the slash (/) represent the subnet mask (?). It means 24 ones & remaining (32-24 = 8) zeros.

11111111 11111111 11111111 00000000
255.255.255.0

Also the first (00000000) & last (11111111) can’t be used for hosts as first is for network & last is for broadcast. So we’ll have combinations starting from 00000001 till 11111110. Total 254 combinations or hosts in this subnet.

They’ll have IPs: 195.23.24.1, 195.23.24.2, 195.23.24.3 ………………………….. 195.23.24.254.

Is my understanding about subnet & above calculation correct?

I’ll provide another example to clarify my understanding:
Subnet address: 195.23.24.76/27
11111111 11111111 11111111 11100000
00000 & 11111 can’t be used. Combinations left are: 00001 till 11110.
Host IPs are: 195.23.24.1, 195.23.24.2, 195.23.24.3 …………………………… 195.23.24.30
Total 30 hosts are in the subnet.

If it’s correct then the 4th octet in subnet address is useless, we’re not using it for any purpose??

Thanks.

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

ankur rathi wrote:I’ll provide another example to clarify my understanding:
Subnet address: 195.23.24.76/27
11111111 11111111 11111111 11100000
00000 & 11111 can’t be used. Combinations left are: 00001 till 11110.
Host IPs are: 195.23.24.1, 195.23.24.2, 195.23.24.3 …………………………… 195.23.24.30
Total 30 hosts are in the subnet.


Actually the Host IPs are: 195.23.24.65, 195.23.24.66, 195.23.24.67 …………………………… 195.23.24.94

Henry

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Henry Wong wrote:
ankur rathi wrote:I’ll provide another example to clarify my understanding:
Subnet address: 195.23.24.76/27
11111111 11111111 11111111 11100000
00000 & 11111 can’t be used. Combinations left are: 00001 till 11110.
Host IPs are: 195.23.24.1, 195.23.24.2, 195.23.24.3 …………………………… 195.23.24.30
Total 30 hosts are in the subnet.


Actually the Host IPs are: 195.23.24.65, 195.23.24.66, 195.23.24.67 …………………………… 195.23.24.94

Henry


Thanks Henry.

195.23.24.76/27
195.23.24.01001100
27 -> 11100000

consider only bits where subnet mask is having 1s, ignore rest.
195.23.24.010-00000

since 00000 & 11111 can't be used.

195.23.24.01000001 will be first host (195.23.24.65). 195.23.24.66 ................. 195.23.24.01011110 (195.23.24.94) will be last.


Thanks again Henry!
:)


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: my understanding about subnet?