How to set up a computer network without being hackers
 

Just a little bit of theory

Netmasks

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:

C O F F E E
C - - - E E
------------
- O F F - -

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: 100.1.4.12 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
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1

Where 1 means TRUE and 0 means FALSE by convention. So you could see the above scheme so:

1) FALSE AND FALSE = FALSE
2) FALSE AND TRUE = FALSE
3) TRUE AND FALSE = FALSE
4) TRUE AND TRUE = TRUE

Confused? Let's see an example:

Birds can fly (TRUE)
Birds can sing (TRUE)
Birds can laugh (FALSE)
Birds can cry (FALSE)

Now...are the sentences listed here true?

1) Birds can laugh AND cry
2) Birds can laugh AND fly
3) Birds can fly AND laugh
4) Birds can fly AND sing

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')
AND
11111111 (i.e. '255')
-------------------------
00000100 (result)

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')
AND
00000000 (i.e. '0')
------------------------
00000000
(i.e. 0 or even void result, null result, nothing, don't copy, ignore and so on)

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:
11111111 . 11111111 . 11111111 . 00000000. Right? Now we can use a simple netmask. Let's consider this IP address: 100.1.4.12 (that is equivalent to this one: 1100100 . 00000001 . 00000100 . 0001100)
and this netmask: 255.255.255.0 (that is equivalent to this one: 11111111 . 11111111 . 11111111 . 00000000). Logical AND between them:

100.1.4.12
AND
255.255.255.0

is equal to 100.1.4.0 right?

1100100 . 00000001 . 00000100 . 0001100
AND
11111111 . 11111111 . 11111111 . 00000000
----------------------------------------------------------
1100100 . 00000001 . 00000100 . 0000000

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, 100.1.4.0 is the network address whereas 100.1.4.1 up to 100.1.4.254 are the IP addresses of the host connected to that network. Notice that 100.1.4.255 is not a host's IP address but it is the broadcast address. Messages sent to 100.1.4.255 go to all computers connected to the 100.1.4.0 network. Standard netmasks are:

255.0.0.0 (for A class networks)
255.255.0.0 (for B class networks)
255.255.255.0 (for C 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:

192.168.x.x

you could use the standard netmask:

255.255.255.0

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:

2X

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:

NETMASK 255.255.255.0 (or 255.255.255/24)SubnetNetwork NumberBroadcastIP range (for hosts)
none02551-254
NETMASK 255.255.255.128 (or 255.255.255/25)SubnetNetwork NumberBroadcastIP range (for hosts)
101271-126
2128255129-254
NETMASK 255.255.255.192 (or 255.255.255/26)SubnetNetwork NumberBroadcastIP range (for hosts)
10631-1-62
26412765-126
3128191129-190
4192255193-254

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.

(Page 1 of 6)

Index  --->

DISCLAIMER:
Any named products on this website are copyright © and/or trademarks ® of their respective companies. INFORMATION ON THIS WEB SITE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. The material included in this site has been compiled from a variety of sources and the site may include technical inaccuracies or typographical errors. Information may be changed or updated without notice. While every effort is made to ensure the correctness of the information provided here, the author can accept no responsibility for damages caused directly or indirectly from the use of such information. The author will not be responsible for damage or loss of data. You are advised to backup data regularly! By entering this site you are agreeing to this and also to never suing the author.

 

Home  About  Mail us!  

Copyright © 1998-2006 Wowarea