Illustrated TCP/IP Illustrated TCP/IP
by Matthew G. Naugle
Wiley Computer Publishing, John Wiley & Sons, Inc.
ISBN: 0471196568   Pub Date: 11/01/98
  

Previous Table of Contents Next


Chapter 52
An Example Conversion

(Hint: Convert the address to binary, apply the mask in binary, and then convert it back to decimal as shown in the slide.)

An operation is performed on an IP address. It is called a bit–wise AND operation. The IP address is ANDed with the subnet mask to allow the network station to determine the subnet mask. Yes, some math is involved here. Basically, when you are ANDing two binary numbers together, the following rule applies:

1.  1 AND 1 = 1
2.  1 AND 0 = 0
3.  0 AND 0 = 0

After this operation, the bits that “fall out” indicate the network and subnet bits.

The slide shows the mask operation. At the bottom is the IP address in binary. This address is logically ANDed with the mask. The bits that drop out of this operation will indicate to any TCP/IP station the network address. It masks out the host address and leaves the network address.

Remember one other item: Even though we have boundaries, using a short subnet mask moves the binary number that we are trying to get. In the previous example, we kept using the bits in the third octet as if they were part of the fourth octet. That is how we came up with 257. Since the mask was shorter than all 8 bits in the third octet, when figuring out the addressing, we continued to use the bits of the third octet as if they were part of the fourth octet. This makes the last bit of the third octet the 256 bit (binary) for the fourth octet. Be careful, using this same example, we must clear our heads and start over when figuring out what numbers are now assigned to the subnet. After we have figured out the host number, we then apply the mask, just like new, back on the third octet and look for the subnets. If it is a 7–bit subnet, then after we convert to binary, we number the last bit in the third octet as the first bit of the subnet numbering scheme, however, not actually part of the subnet number itself.

Sounds confusing but try a few more.

Class A addresses can use the second, third, or fourth (not the whole fourth field) field for subnets.

Class B addresses can use the third or fourth (not the whole fourth field) field for subnets.

Class C is tricky. The only field left is the single host field (one byte). Subnetting this is allowed, but you can only use up to 6 of the bits in the fourth field. You need to have a couple of hosts somewhere!


An Example Conversion


Previous Table of Contents Next