Skip to main content

ANDing problem

More
18 years 6 months ago #13450 by iana
ANDing problem was created by iana
Hi guys,

Im having problems understanding ANDing, i know it is use by a router to send data packets,what i dont understand is, why a destination IP needs to be ANDs to its own subnet mask.

Help me
More
18 years 6 months ago #13454 by TheBishop
Replied by TheBishop on topic AND
Hello iana
A destination IP address is ANDed with its subnet mask to let the router understand which part of the address identifies the destination network and which part identifies the target host.
For example:

IP address 10.1.1.1 in binary is
00001010:00000001:00000001:00000001

Subnet mask is 255.255.0.0 which in binary is
11111111:11111111:00000000:00000000

If you AND in binary then
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1

So AND ing the IP Address and Subnet Mask allows the 'network' part of the destination address to filter through while surpressing the part that identifies the destination host:

00001010:00000001:00000001:00000001 AND
11111111:11111111:00000000:00000000
gives
00001010:00000001:00000000:00000000
which identifies the destination network, 10.1.0.0

All the router then has to do is decide which interface it needs to forward the packet on to have it reach this destination network. Once on that network, the part of the address which identifies the host comes into play

Does that clear it up a bit?
Time to create page: 0.131 seconds