Just a little bit of theory
Again technical stuff! Ehm...a *VERY* little bit of boolean logic follows...please, don't think about Halloween costumes, since netmasks are different things. ;o) A mask is a pattern used to filter particular characters or numbers from character strings and numeric strings. For example, consider the string 'C O F F E E'. You could use a string like 'C E E' to get the string 'OFF' by applying this simple rule: 'equal letters are stripped away'. In fact, as you see:
Anyway, computers use numbers. Binary digits or BITs (BInary digiT) exactly. A bit can be '0' or '1'. You can think to bits as light bulbs. A light bulb can have 2 different states: turned on or turned off. So '1' means turned on and '0' means turned off. What has this to do with IP addresses? Well, IP addresses are decimal digits. This number: 184.108.40.206 is equivalent to this one: 1100100 . 00000001 . 00000100 . 0001100 (its binary representation). Now, when you use binary masks, you can perform some particular operations such as 'AND', 'OR', 'NOT', NAND and others. This kind of 'stuff' is called 'boolean logic' (thanks to George Boole, the guy who developed it). If you would like more, go to Google and search for "boolean logic". This 'stuff' is not really important here, anyway it is helpful to better understand some things, so let's go on a little further. Netmask method makes use of the logical 'AND'. Logical AND between 2 binary digits works so:
0 AND 0 = 0
Where 1 means TRUE and 0 means FALSE by convention. So you could see the above scheme so:
1) FALSE AND FALSE = FALSE
Confused? Let's see an example:
Birds can fly (TRUE)
Now...are the sentences listed here true?
1) Birds can laugh AND cry
Things are clearer now? ;o) I hope so. Let's go back to bits...decimal digit '4' is equal to binary digit '00000100'. Ok, don't forget this now: decimal digit '255' is equal to binary digit '11111111'. MEMORIZED? Ok, now take a look at this:
00000100 (i.e. '4')
As you can see, the result is equal to the first binary digit (00000100). In fact the rule is: result of a logical AND between any bit and 1 is *ALWAYS* equal to the first of the
2 binary digits. In other words, each '1' copies its corresponding bit. So 255 is used to copy bytes. Unlike 255, 0 means: don't copy it, just ignore it. So:
00000100 (i.e. '4')
Now, I think you are remembering those strange numbers so often unclear and mysterious...right? Take a look at the following mask: 255.255.255.0. As I said before, it is equal to this one:
is equal to 220.127.116.11 right?
1100100 . 00000001 . 00000100 . 0001100
Well, this is the network address. Hmnm...you are ready to know the truth now: the netmask is a way of pointing out the number of bits starting at the left that represent the network. The remaining bits on the right identify the host. So by means of a netmask you can know where is the network and where is the host inside of an IP address. So triplets '255' identify the network whereas digit '0' identifies hosts. In the above example, 18.104.22.168 is the network address whereas 22.214.171.124 up to 126.96.36.199 are the IP addresses of the host connected to that network. Notice that 188.8.131.52 is not a host's IP address but it is the broadcast address. Messages sent to 184.108.40.206 go to all computers connected to the 220.127.116.11 network. Standard netmasks are:
255.0.0.0 (for A class networks)
You can't use a very long wire to build a huge network connecting all computers in the world. It couldn't work. Too much computers talking each other could interfere with each other. The wire couldn't have enough bandwidth to handle all the traffic. You must connect many little networks instead. In other words, you must use subnets. Computers talking to other computers in the same subnet won't interfere with computers in other subnets talking to computers in those subnets. Furthermore, you can't mix networks using different technologies. So you can't mix Ethernet, Token Ring, ATM and so on in the same physical network. Anyway you use a subnet for each technology and mix subnets. In fact, by means of subnets you can mix different kind of networks. Let's see a typical C class IP address:
you could use the standard netmask:
192.168.0.0 AND 255.255.255.0 gives 192.168.00. as a result. So 192.168.0.0 is a network, 192.168.1.0 is another network, 192.168.2.0 another network and so on. In fact, by using the netmask 255.255.255.0 you are saying
that first 3 triplets define your network whereas the fourth triplet defines hosts. Each triplet is on byte long (8 bits) so 3 triplets are 3 bytes (24 bits). In other words 24 bits are for your network and remaining 8 bits (32 - 24 = 8) are for hosts.
You could also write so: 255.255.255/24 (meaning that 24 bits are for your network). If you use 192.168.1.0 AND 255.255.255.0, you are saying that 192.168.1.0 is your network whereas 192.168.1.x addresses are for hosts.
In other words you are using *ONE* network only. Anyway, you could divide your network into 2 subnets. To do that, you must use a particular netmask: 255.255.255.128 (or 255.255.255/25). What does it mean?
When you have a single network without subnets, you are using the 255.255.255.0 (or 255.255.255/24) netmask, because 24 bits (3 triplets) are for your network but if you want to define a subnet, you have to take another
bit for that subnet. So you take 1 from 8 bits defining hosts. In other words you needs 25 bits for network so 7 bits remain for hosts (255.255.255/25 or 255.255.255.128). Notice that 128 is the maximum value you can get with 7 bits.
To know the maximum value you can get with X bits, you must use the following formula:
So 27=128 (but you have to subtract the bit dedicated to the network and the bit dedicated to the broadcast address from that). By means of the 255.255.255/25 netmask you have 2 network now: 192.168.1.0 and 192.168.1.128. So you can use 129 up to 254 for hosts (255 is the broadcast address).
You have 2 networks now (subnets) but you can split each of them again to get 4 different networks. To to that you need another bit, so you need 26 bits to define networks: 255.255.255/26 (or 255.255.255.192).
Things get unclear right? Ok watch the following scheme:
And so on. If you use another bit more for networks (27, i.e. 24 + 3 bits) you can define 8 different subnets.
In other words with 0 bits you can define 1 network only, with 1 further bit you can define 2 subnets, with 2 bits you can define 4 subnets, with 3 bits you can define 8 subnets and so on. Remember that on bit more means that you are splitting your network.
So you could have 1 network only, 2 networks, 4 networks, 8 networks, 16 networks...up to 64 subnets!
But you have less hosts too ;o). I don't think having 64 subnets with 2 hosts each could be really helpful.
Ok, let's stop talking about netmasks and subnets now.
Home About Mail us!
Copyright © 1998-2006 Wowarea