[NTLUG:Discuss] ...a little binary IP help, please...

Steve Baker sjbaker1 at airmail.net
Wed Jun 27 11:02:30 CDT 2001


Fred James wrote:
> 
> I am trying to understand the binary representation of an IP address,
> and the process of ANDing with the (sub)netmask.
> The book states that the decimal address 192.168.0.20 would be 11000000
> 01101000 00000000 00010100 in binary, and then labels those bytes as
> 192.68.0.20
> I thought the place values were: 256 128 64 32 16 8 4 2 1, in which case
> x.x.0.20 is OK, but the 192.168.x.x, or 192.68.x.x seems wrong.

11000000 binary is 192 in decimal - so the first byte is OK.

But, yes - that second byte looks wrong:

01101000 binary is 104 in decimal
168 decimal is 10101000 in binary
 68 decimal is 01000100 in binary

...presumably a typo in the book. It looks like they meant to use
168 but switched the first two digits of the binary number.

There's a *reason* we don't use binary in human interfaces!

----------------------------- Steve Baker -------------------------------
HomeMail : <sjbaker1 at airmail.net>   WorkMail: <sjbaker at link.com>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sf.net     http://tuxaqfh.sf.net  http://tuxkart.sf.net
           http://agtoys.sf.net   http://prettypoly.sf.net
           http://freeglut.sf.net http://toobular.sf.net



More information about the Discuss mailing list