Lab 1.3.6 Binary Numbering

Estimated time: 30 min.

Objectives:

> This lab will focus on your ability to accomplish the following tasks:

> - Identify the positions in a binary number and know the value of each
> - Identify the positions in a decimal number and know the value of each
> - Work with base 10 exponents (powers of 10) and understand how position defines value
> - Work with base 2 exponents (powers of 2) and understand how position defines value
> - Manually convert simple binary numbers and decimal numbers
> - Manually convert 32-bit binary IP addresses and dotted decimal IP addresses
> - Use the Windows Scientific Calculator to check your answers (go to the View Menu in the calculator window and select the Scientific option)
> - Describe the differences between binary and decimal numbering systems

Background:

> This lab will help you learn to work with the binary numbering system. You will convert binary numbers (base 2) to decimal numbers (base 10) and decimal to binary. Computers and networking equipment such as routers work with binary numbers, a series of BITS (short for Binary Digits) which are either ON (a binary 1) or OFF (a binary 0). They are encoded internally in the PC and on networking media (cables) as either electrical voltages on copper cable such as Unshielded Twisted Pair (UTP) or as light pulses on fiber cable. The current version of the Internet Protocol (IPv4) uses a 32-bit address (usually divided into 4 "octets" or 8-bit bytes) to identify a particular network and a host on that network. Humans are more comfortable working with decimal numbers and so IP addresses are usually written as 4 decimal numbers separated by periods (dots), each representing an octet, to make them easier to read. This is referred to as "dotted decimal notation". Understanding binary numbers and how they relate to decimal numbers is critical to understanding IP addresses, subnets and network routing.

Tools / Preparation:

> This is primarily a written lab exercise but you will use the Windows Scientific Calculator so you will need access to a PC. You may want to refer back to Lab 1.3 – PC Network Settings for some real IP addresses to convert. The following resources will be required:

> - PC workstation with Windows operating system (Win 95, 98, NT or 2000) installed on PC and access to the Windows Calculator.

Notes:

Step 1 - Decimal Numbers.

> Explanation:

We are most familiar with "decimal" numbers (base 10). The decimal numbering system is based on the powers of 10. This exercise will help develop an understanding of the exponentiation or "powers" of numbers using the base 10 number system which is what our arithmetic and money system is based on. With base 10, the right-most position has a value of 1 (same as base 2). Each position moving to the left is worth 10 times more. 10 to the zero power (10^0) is one, 10 to the first power (10^1 or 10 x 1) is 10, 10 to the second power (10^2 or 10 x 10) is 100 and 10 to the third power (10^3 or 10 x 10 x 10) is 1,000 etc. Just multiply the number in each position times the value of each position (e.g. 400 = 4 x 10^2 or 4 x 100). Remember any number to the zero power is 1.

Decimal Number Conversion Example.

The following chart shows how the decimal number system represents the number 352,481. This will help in understanding the binary numbering system.

Exponent | 10

6
10 5

10 4
10 3
10 2
10 1
10 0
Position | 7 | 6 | 5 | 4 | 3 | 2 | 1
Value | 1000000 | 100000 | 10000 | 1000 | 100 | 10 | 1
Number | 0 | 3 | 5 | 2 | 4 | 8 | 1
| 0 x 1,000,000 | 3 x 100,000 | 5 x 10,000 | 2 x 1,000 | 4 x 100 | 8 x 10 | 1 x 1

The number 352,481 if read from right to left would be (1 x 1) + (8 x 10) + (4 x 100) + (2 x 1,000) + (5 x 10,000) + (3 x 100,000) for a total of 352,481 (a six-digit number).

Here is another way to look at it that makes it easier to add up the decimal number values:

Position of digit (from right) | Value of bit position (10^X or ten to the power of) | Number value from 0 to 9 | Calculation | Decimal Value
1st Decimal Digit | 10^ 0 or 1 | 1 | 1 x 1 | 1
2nd Decimal Digit | 10^ 1 or 10 | 8 | 8 x 10 | 80
3rd Decimal Digit | 10^ 2 or 100 | 4 | 4 x 100 | 400
4th Decimal Digit | 10^ 3 or 1000 | 2 | 2 x 1,000 | 2,000
5th Decimal Digit | 10^ 4 or 10000 | 5 | 5 x 10,000 | 52,000
6th Decimal Digit | 10^ 5 or 100000 | 3 | 3 x 100,000 | 300,000
Decimal Value (Total of 6 digits) |  |  |  | 352,481

Step 2 - Binary Numbers

> Explanation:

Binary means "two" and each digit in a binary number can only have two values (zero or one). It is also called a base 2 numbering system. Binary numbers are the key to understanding how routers work and how packets get from one workstation (host) to another server (host) on a TCP/IP network. Internet addresses are made up of 32 bits or 4 groups of eight bits known as "OCTETS". Each bit of each octet has a value based on its position. Of the 8 bits in an octet, the left-most bit is worth 128 (2^7) and the right most bit is worth 1 (2^0). The value of each bit is based on the powers of two.

The binary numbering system is based on the powers of 2. This exercise will help develop an understanding of exponentiation or "powers" of numbers using the base 2 number system which is what all computers and data communications use. With base 2, the right-most position has a value of 1 as with base 10. Each position moving to the left is worth 2 times more. 2 to the zero power (2^0) is one, 2 to the first power (2^1 or 2 x 1) is 2. 2 to the second power (2^2 or 2 x 2) is 4 and 2 to the third power (2^3 or 2 x 2 x 2) is 8 etc. Just multiply the number in each position (either a 0 or a 1) times the value of each position (e.g. 8 = 1 x 2^3 or 1 x 8) and add up the total. Remember any number to the zero power is 1. Convert the following binary numbers to decimal numbers. In the first exercise you will convert a binary number to a decimal number. Starting from the right, the first binary digit is a ZERO which is calculated as zero times 2^0 (two to the zero power or 0 x 1 – anything to the zero power is 1). The second position from the left is also a ZERO so this is zero times 2^1 (or 0 x 2). The third binary number from the right is a ONE. This is 1 times 2^2 (two to the 2nd power or 4).

Binary Number Conversion Example.

The following table shows the detail calculations (starting from the right side) to convert the binary number 10011100 into a decimal number.

Position of digit (from right) | Value of bit position (two to the power of) | Is bit a One (on) or a Zero (Off) | Calculation | Decimal Value

1st Decimal Digit
2^ 0 or 1 0 0 x 1 0
2nd Decimal Digit 2^ 1 or 2
0 0 x 2 0
3rd Decimal Digit 2^ 2 or 4
1 1 x 4 4
4th Decimal Digit 2^ 3 or 8
1 1 x 8 8
5th Decimal Digit 2^ 4 or 16
1 1 x 16 16
6th Decimal Digit 2^ 5 or 32
0 0 x 32 0
7th Decimal Digit 2^ 6 or 64
0 0 x 64 0
8th Decimal Digit 2^ 7 or 128
1 1 x 128 128
Decimal Value (Total of 8 digits) 156

Step 3 - Binary to Decimal Practice Exercises.

> Task:

Practice converting the 4 binary octets of an IP address to the dotted decimal equivalent.

Explanation:

Look at the Binary number bit status. If there is a ONE in a position add the value shown. If there is a ZERO in a position then do not add it. Note that 8 bits cannot represent a decimal number greater than 255 (If all 8 positions are ones then 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255).

1. Solve for the 1st , 2 nd , 3 rd and 4 th octet Decimal value

Exponent | 2

7 2 6 25 2 4 2 3 2 2 2 1 2 0
Bit Position 8 7 6 5 4 3 2 1
Value 128 64 32 16 8 4 2 1
Binary Number Bit Status 1 0 0 1 1 1 0 0

1

st Octet Decimal Value: ________________

Exponent

27 26 25 24 23 22 21 20
Bit Position
8 7 6 5 4 3 2 1
Value
128 64 32 16 8 4 2 1
Binary Number Bit Status
1 1 1 0 0 0 1 1

2

nd Octet Decimal Value: ________________

Exponent | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20
Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1
Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
Binary Number Bit Status | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0

3

rd Octet Decimal Value: ________________

Exponent | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20
Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1
Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
Binary Number Bit Status | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0

4

th Octet Decimal Value: ________________

2. Enter the Dotted Decimal octet values for all four octets for the above IP address:

> 10011100 . 11100011 . 01110000 . 11011010

> _______ ___ __________ __________ ___________

Step 4 - Decimal to Binary Practice Exercises.

> Task:

Practice converting the following decimal values of the IP address 209.114.58.165 to the binary octet equivalent.

Explanation:

Look at the Decimal value and then subtract binary values starting from 128 (the highest value binary bit). If the number is larger than 128 then put a one in the first position binary number bit status. Subtract 128 from the number and then see if there is a 64 left. If there is put a one there otherwise put a zero and see if there is a 32. Continue until all 8 bits are defined as either a zero or a one.

1. Solve the 1

st , 2 nd , 3 rd and 4 th octet Decimal value to binary bit number

Exponent | 2

7 2 6 25 2 4 2 3 2 2 2 1 2 0
Bit Position 8 7 6 5 4 3 2 1
Value 128 64 32 16 8 4 2 1
Binary Number Bit Status

1

st Octet Binary Value: ________________

Exponent

27 26 25 24 23 22 21 20
Bit Position
8 7 6 5 4 3 2 1
Value
128 64 32 16 8 4 2 1
Binary Number Bit Status

2

nd Octet Binary Value: ________________

Exponent | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20
Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1
Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
Binary Number Bit Status |  |  |  |  |  |  |  |

3rd Octet Binary Value: ________________

Exponent | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20
Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1
Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
Binary Number Bit Status |  |  |  |  |  |  |  |

4

th Octet Binary Value: ________________

2. Enter the 8 Binary bits (zeros and ones) octet values for all four octets for the IP address:

> 209 . 114 . 58 . 165
> __________ __________ __________ __________