Home | Networking | Computer HWare/SWare | NOS: Unix/Linux | Favorites | Contact Me | RCC Home

AND’ing

 

The logic of ‘AND’ing can be explained by the following diagram.

 

               A                    B                                                                               TRUTH TABLE

 


                          Switches                                                                    SWITCH#

                            0  = open                            Light                             A         B                

                             1 = closed                                                                 0        0       0 = off

                                                                                                                 0        1       0 = off

           -   +                                                                                                1        0       0 = off

                                                                                                                 1        1       1 = ON

 


Battery

 

 

NOTICE THAT THERE IS ONLY ONE COMBINATION THAT ALLOWS THE LIGHT TO BE TURNED ON. 

 

THAT IS HOW logical ‘AND’ing is done. 

When we logically ‘AND’ the destination host IP address and the subnet mask, the result will give us the subnetwork (or network) address of the destination host.

 

NOTE:           I will only get a “1” result -if  I   “AND”  a  ‘1’  with another  ‘1’

If either bit is 0 (zero) – I’ll get a 0 (zero) result.

This is done vertically with the bit in the top binary number  AND’ed with the bit in the number below.

 

Example: IP address           192.                168.                16.                   33

Binary equivalent                   11000000.     10101000.     00010000.     00100001

(Default ) subnet mask                    

(255.255.255.0)                    11111111.     11111111.     11111111.     00000000

result of ‘AND’ing               11000000.     10101000.     00010000.     00000000

(in dotted decimal form)                   192.                168.                16.                   0

This gives me the network ID for this host

 

 

Look at another example with 3 bits borrowed for subnetting.

 

Example: IP address          192.                168.                16.                   33

Binary                                     11000000.     1010100.       00010000.     00100001

Subnet mask

(255.255.255.224)                11111111.     11111111.     11111111.     11100000

result of ‘AND’ing               11000000.     10101000.     00010000.     00100000

(in dotted decimal form)                   192.                168.                16.                   32

Notice that this gives us the sub-network number to which this host belongs in.


Home | Networking | Computer HWare/SWare | NOS: Unix/Linux | Favorites | Contact Me | RCC Home