My new domain network Management

Network Math

Binary presentation of data
Computers work with and store data using electronic switches that are either ON or OFF. Computers can only understand and use data that is in this two-state or binary format. 1 is represented by an ON state, and 0 is represented by an OFF state. The ones and zeros are used to represent the two possible states of an electronic component in a computer. They are referred to as binary digits or bits.

The American Standard Code for Information Interchange (ASCII) is the most commonly used code for representing alpha-numeric data in a computer. ASCII uses binary digits to represent the symbols typed on the keyboard. When computers send ON/OFF states over a network, electrical, light, or radio waves are used to represent the 1s and 0s. Notice that each character has a unique pattern of eight binary digits assigned to represent the character.

Because computers are designed to work with ON/OFF switches, binary digits and binary numbers are natural to them. Humans use the decimal number system, which is relatively simple when compared to the long series of 1s and 0s used by computers. So the computer binary numbers need to be converted to decimal numbers.

Sometimes binary numbers need to be converted to Hexadecimal (hex) numbers which reduces a long string of binary digits to a few hexadecimal characters. This makes it easier to remember and to work with the numbers.

Bits and bytes

A binary 0 might be represented by 0 volts of electricity (0 = 0 volts).

A binary 1 might be represented by +5 volts of electricity (1 = +5 volts).

Computers are designed to use groupings of eight bits. This grouping of eight bits is referred to as a byte. In a computer, one byte represents a single addressable storage location. These storage locations represent a value or single character of data, such as an ASCII code. The total number of combinations of the eight switches being turned on and off is 256. The value range of a byte is from 0 to 255. So a byte is an important concept to understand when working with computers and networks.

Base 10 number system

Numbering systems consist of symbols and rules for using those symbols. The most commonly used numbering system is the decimal, or Base 10, numbering system. Base 10 uses the ten symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. These symbols, can be combined to represent all possible numeric values.

The decimal number system is based on powers of 10. Each column position of a value, from right to left, is multiplied by the number 10, which is the base number, raised to a power, which is the exponent. The power that 10 is raised to depends on its position to the left of the decimal point. When a decimal number is read from right to left, the first or rightmost position represents 100 (1), the second position represents 101 (10 x 1= 10). The third position represents 102 (10 x 10 =100). The seventh position to the left represents 106 (10 x 10 x 10 x 10 x 10 x 10 =1,000,000). This is true no matter how many columns the number has.

Base 2 number system

Computers recognize and process data using the binary, or Base 2, numbering system. The binary system uses only two symbols, 0 and 1, instead of the ten symbols used in the decimal numbering system. The position, or place, of each digit from right to left in a binary number represents 2, the base number, raised to a power or exponent, starting from 0. These place values are, from right to left, 20, 21, 22, 23, 24, 25, 26, and 27, or 1, 2, 4, 8, 16, 32, 64, and 128 respectively.

Example:

101102 = (1 x 24 = 16) + (0 x 23 = 0) + (1 x 22 = 4) + (1 x 21 = 2) + (0 x 20 = 0) = 22 (16 + 0 + 4 + 2 + 0)

If the binary number (101102) is read left to right, there is a 1 in the 16s position, a 0 in the 8s position, a 1 in the 4s position, a 1 in the 2s position, and a 0 in the 1s position, which adds up to decimal number 22.

Converting decimal numbers to 8-bit binary numbers

There are several ways to convert decimal numbers to binary numbers. The flowchart in Figure describes one method. The process is trying to figure out which values of the power of 2 that add together to get the decimal number being converted to a binary number. This method is one of several methods that can be used. It is best to select one method and practice with it until it always produces the correct answer.

Conversion exercise
Use the example below to convert the decimal number 168 to a binary number:

  • 128 fits into 168. So the left most bit in the binary number is a 1. 168 - 128 leaves 40.
  • 64 does not fit into 40. So the second bit in from the left is a 0.
  • 32 fits into 40. So the third bit in from the left is a 1. 40 - 32 leaves 8.
  • 16 does not fit into 8 so the fourth bit in from the left is a 0.
  • 8 fits into 8. So the fifth bit in from the left is a 1. 8 - 8 leaves 0. So, the remaining bits to the right are all 0.

Result: Decimal 168 = 10101000

For more practice, try converting decimal 255 to binary. The answer should be 11111111.

The number converter activity in Figure will provide more practice.

Converting 8-bit binary numbers to decimal numbers

There are two basic ways to convert binary numbers to decimal numbers. The flowchart in Figure shows one example.

Binary numbers can also be converted to decimal numbers by multiplying the binary digits by the base number of the system, which is Base 2, and raised to the exponent of its position.

Example:

Convert the binary number 01110000 to a decimal number.

Note: Work from right to left. Remember that anything raised to the 0 power is 1. Therefore 20 = 1


0 x 20 = 0

0 x 21 = 0

0 x 22 = 0

0 x 23 = 0

1 x 24 = 16

1 x 25 = 32

1 x 26 = 64
+ 0 x 27= 0
–––––––––––
112

Note: The sum of the powers of 2 that have a 1 in their position

The number converter activity will provide more practice.

Four-octet dotted decimal representation of 32-bit binary numbers

Currently, addresses assigned to computers on the Internet are 32-bit binary numbers. To make it easier to work with these addresses, the 32-bit binary number is broken into a series of decimal numbers. To do this, split the binary number into four groups of eight binary digits. Then convert each group of eight bits, also known as an octet into its decimal equivalent. Do this conversion exactly as was shown in the binary-to-decimal conversion topic on the previous page.

When written, the complete binary number is represented as four groups of decimal digits separated by periods. This is referred to as dotted decimal notation and provides a compact, easy to remember way of referring to the 32 bit addresses. This representation is used frequently later in this course, so it is necessary to understand it. When converting to binary from dotted decimal, remember that each group, which consists of one to three decimal digits represents a group of eight binary digits. If the decimal number that is being converted is less than 128, zeros will be needed to be added to the left of the equivalent binary number until there are a total of eight bits.

Example:

Convert 200.114.6.51 to its 32-bit binary equivalent.

Convert 10000000 01011101 00001111 10101010 to its dotted decimal equivalent.

Hexadecimal

Hexadecimal (hex) is used frequently when working with computers since it can be used to represent binary numbers in a more readable form. The computer performs computations in binary, but there are several instances when the binary output of a computer is expressed in hexadecimal to make it easier to read.

Converting a hexadecimal number to binary, and a binary number to hexadecimal, is a common task when dealing with the configuration register in Cisco routers. Cisco routers have a configuration register that is 16 bits long. The 16-bit binary number can be represented as a four-digit hexadecimal number. For example, 0010000100000010 in binary equals 2102 in hex. The word hexadecimal is often abbreviated 0x when used with a value as shown with the above number: 0x2102.

Like the binary and decimal systems, the hexadecimal system is based on the use of symbols, powers, and positions. The symbols that hex uses are 0 - 9, and A, B, C, D, E, and F.

Notice that all possible combinations of four binary digits have only one hexadecimal symbol, where it takes two in decimal. The reason why hex is used is that two hexadecimal digits, as opposed to decimal that would require up to four digits, can efficiently represent any combination of eight binary digits. In allowing two decimal digits to represent four bits, using decimal could also cause confusion in reading a value. For example, the eight bit binary number 01110011 would be 115 if converted to decimal digits. Is that 11-5 or 1-15? If 11-5 is used, the binary number would be 1011 0101, which is not the number originally converted. Using hexadecimal, the conversion is 1F, which always converts back to 00011111.

Hexadecimal reduces an eight bit number to just two hex digits. This reduces the confusion of reading long strings of binary numbers and the amount of space it takes to write binary numbers. Remember that hexadecimal is sometimes abbreviated 0x so hex 5D might be written as "0x5D".

To convert from hex to binary, simply expand each hex digit into its four bit binary equivalent

Boolean or binary logic

Boolean logic is based on digital circuitry that accepts one or two incoming voltages. Based on the input voltages, output voltage is generated. For the purpose of computers the voltage difference is associated as two states, on or off. These two states are in turn associated as a 1 or a 0, which are the two digits in the binary numbering system.

Boolean logic is a binary logic that allows two numbers to be compared and a choice generated based on the two numbers. These choices are the logical AND, OR and NOT. With the exception of the NOT, Boolean operations have the same function. They accept two numbers, which are 1 or 0, and generate a result based on the logic rule.

The NOT operation takes whatever value is presented, 0 or 1, and inverts it. A one becomes a zero and a zero becomes a one. Remember that the logic gates are electronic devices built specifically for this purpose. The logic rule that they follow is whatever the input is, the output is the opposite.

The AND operation takes two input values. If both are 1, the logic gate generates a 1 output. Otherwise it outputs a 0. There are four combinations of input values. Three of these combinations generate a 0, and one combination generates a 1.

The OR operation also takes two input values. If at least one of the input values is 1, the output value is 1. Again there are four combinations of input values. This time three combinations generate a 1 output and the fourth generates a 0 output.

The two networking operations that use Boolean logic are subnetwork and wildcard masking. The masking operations provide a way of filtering addresses. The addresses identify the devices on the network and allows the addresses to be grouped together or controlled by other network operations. These functions will be explained in depth later in the curriculum.

IP addresses and network masks
The 32-bit binary addresses used on the Internet are referred to as Internet Protocol (IP) addresses. The relationship between IP addresses and network masks will be addressed in this section.

When IP addresses are assigned to computers, some of the bits on the left side of the 32-bit IP number represent a network. The number of bits designated depends on the address class. The bits left over in the 32-bit IP address identify a particular computer on the network. A computer is referred to as the host. The IP address of a computer consists of a network and a host part that represents a particular computer on a particular network.

To inform a computer how the 32-bit IP address has been split, a second 32-bit number called a subnetwork mask is used. This mask is a guide that indicates how the IP address should be interpreted by identifying how many of the bits are used to identify the network of the computer. The subnetwork mask sequentially fills in the 1s from the left side of the mask. A subnet mask will always be all 1s until the network address is identified and then be all 0s from there to the right most bit of the mask. The bits in the subnet mask that are 0 identify the computer or host on that network. Some examples of subnet masks are:

11111111000000000000000000000000 written in dotted decimal as 255.0.0.0

or

11111111111111110000000000000000 written in dotted decimal as 255.255.0.0

In the first example, the first eight bits from the left represent the network portion of the address, and the last 24 bits represent the host portion of the address. In the second example the first 16 bits represent the network portion of the address, and the last 16 bits represent the host portion of the address.

Converting the IP address 10.34.23.134 to binary would result in:

00001010.00100010.00010111.10000110

Performing a Boolean AND of the IP address 10.34.23.134 and the subnet mask 255.0.0.0 produces the network address of this host:

00001010.00100010.00010111.10000110
11111111.00000000.00000000.00000000
00001010.00000000.00000000.00000000

Converting the result to dotted decimal, 10.0.0.0 is the network portion of the IP address, when using the 255.0.0.0 mask.

Performing a Boolean AND of the IP address 10.34.23.134 and the subnet mask 255.255.0.0 produces the network address of this host:

00001010.00100010.00010111.10000110
11111111.11111111.00000000.00000000
00001010.00100010.00000000.00000000

Converting the result to dotted decimal, 10.34.0.0 is the network portion of the IP address, when using the 255.255.0.0 mask.

This is a brief illustration of the effect that a network mask has on an IP address. The importance of masking will become much clearer as more work with IP addresses is done. For right now it is only important that the concept of the mask is understood.

Cisco Systems, Inc.

0 comments:

Post a Comment