TCP/IP First-Step [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

TCP/IP First-Step [Electronic resources] - نسخه متنی

Mark A. Sportack

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Learning to Count All Over Again


Understanding the IP address space requires a command of the binary mathematics on which it is founded. Although that might sound somewhat daunting, it is quite simple. You're just counting with just two numbers! Table 6-2 and shows how to symbolize the decimal number 128 in binary digits.

Tables 6-2 and 6-3 is that Table 6-3 only goes up to 2 to the 7th power. IP addresses consist of 4 groups of 8 bits each, so there is no need for numbers higher than 2 to the 7th power.

One practical implication of Table 6-3 is that an upper limit is imposed on the decimal value of each part of an IP address. Adding 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 equals 255. Thus, any of the 4 parts of an IP address can only range from 0 to 255. Table 6-4 presents the building blocks of this capability. If the Base10 equivalent does not appear intuitive, check the decimal value of the Base2 columns in Table 6-3.

Table 6-4. Value of Base2 Number Columns

Base2

Base10 Equivalent

00000001

1

00000010

2

00000100

4

00001000

8

00010000

16

00100000

32

01000000

64

10000000

128

Table 6-4 shows just the basics of counting in Base2. For simplicity's sake, you see how to count in the powers of 2: 1, 2, 4, 8, 16, 32, 64, and 128. You can tell they are powers of 2 because each is exactly a doubling of the number before it. Notice the binary number for each of these decimal numbers; it requires just 1 bit to be equal to 1. The others are 0s.

However, the same 8-bit binary string can be used to count from 0 to 255. Such values are calculated by summing the decimal values of each column populated with a 1. To actually count to numbers that aren't powers of 2 requires you to have more than 1 of the 8 bits set equal to 1. Table 6-5 shows more of how this works.

Table 6-5. Counting in Base2

Base2

Base10 Equivalent

00000000

0

00000001

1

00000010

2

00000011

3

00000100

4

00000101

5

00000110

6

00000111

7

00001000

8

00001001

9

00001010

10

00001011

11

00001100

12

00001101

13

00001110

14

00001111

15

00010000

16

11111111

255

Converting binary to decimal, therefore, requires you to sum the decimal equivalents of all columns in the binary string that have a 1 instead of a 0. This summation must be done separately for each group of 8 bits in the IP address.


/ 133