Ip Class/Subnet Question

venoz0r

Distinguished
Nov 19, 2005
32
0
18,530
Hey, i am new to networking, however, right now, i am taking on it, very seriously. I just have a general question, related to IP Classes and Subnet. Subnet's role is to define how many octets represent the network id and how many octets represent host id. Now, lets say i use a Class B ip for my network, which has 2 octets representing the Network ID. However in subnet i define that 3 octets will represent it. My question is - what will happen?

(just a general question that popped up :)
 

rgeist554

Distinguished
Oct 15, 2007
1,879
0
19,790
Then you can have more networks and less hosts / network.

Our example IP address: 172.16.0.1
Subnet w/ 3 octets for the network: 255.255.255.0
A subnet / IP is 32 bits, right?

3 octets = 24 bits (8*3)

Ok, stay with me now. We're going to use the formula (2^N-2) to figure out how many networks & hosts that will leave us with.
N = number of masked bits in used in the subnet. (In our case, this is 8 since the normal class B subnet uses 16.)

(2^8)-2 =254 subnets

Now we do the same for hosts / subnet:

(2^8)-2 = 254 hosts / subnet

In this case, N = the remaining number of bits in the subnet. So you have 8 bits left. Why? 32 bit - 16 bits (for normal cB subnet) = 16 bits - 8 bits (for subnet mask) = 8 bits.

Basically, you just further divide your network for organizational purposes. :p

-----------------------------------------------------------------

Another way to look at it:

IP: 172.16.0.1

Normally the "172.16" part would represent your network. The "0.1" part would represent your hosts. That means you could have 2^16-2=65,534 hosts on this single "172.16" network.

Instead, you've changed it to where "172.16.s" represent the network. So now only the ".1" represents your hosts. This means 2^8-2=254 host can be on this single "172.16.0" network... but, since you've changed the subnet by adding an extra octet to it, the "s" in "172.16.s" can be any number between 1-255. So that gives you another 2^8-2=254 networks.

Broken down...

Normal:
IP: 172.16.0.1
Subnet: 255.255.0.0

# of networks: 1
# of hosts / network: 65,634 (hopefully I did my math right)

Modified:
IP: 172.16.s.1
Subnet: 255.255.255.0

# of networks: 254
# of hosts / network: 254

Hopefully I didn't just confuse you more... lol.