Xem mẫu

1102.book Page 29 Tuesday, May 20, 2003 2:53 PM Bits, Bytes, and Measurement Terms 29 Table 1-6 Binary and Decimal Equivalents of Hexadecimal Digits Binary Hexadecimal 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 To convert from hexadecimal to binary, convert every hex digit into 4 bits. For example, to convert hex AC (0xAC) to binary, you first convert hex A, which is 1010 binary, and then you convert hex C, which is 1100 binary. So hex AC is 10101100 in binary. Notice that all possible combinations of four binary digits have only one hexadecimal symbol, whereas two symbols are required for decimal. The reason why hex is used is that two hexadecimal digits can efficiently represent any combination of eight binary digits (as opposed to decimal, which would require up to four digits). In allowing two decimal digits to represent 4 bits, using decimal could also cause confusion in reading a value. For example, the eight bit binary number 01110011 would be 115 if con-verted to decimal digits. Does this represent 11-5 or 1-15? If 11-5 is used, the binary number would be 10110101, which is not the number originally converted. Using hexadecimal, the conversion is 1F, which always converts back to 00011111. 1102.book Page 30 Tuesday, May 20, 2003 2:53 PM 30 Chapter 1: Introduction to Networking The best way to think about hexadecimal is to think of it as a shorthand way of read-ing binary. It reduces an 8-bit number to just two hex digits. This reduces the confu-sion of reading long strings of binary numbers and the amount of space it takes to write them. Remember that hexadecimal is sometimes abbreviated as 0x, so hex 5D might be written as 0x5D. To convert from hex to binary, simply expand each hex digit into its 4-bit binary equivalent. Hexadecimal Conversion In this exercise, you practice converting hexadecimal values to decimal and binary values. Four-Octet Dotted-Decimal Representation of a 32-Bit Binary Number Currently, addresses assigned to computers on the Internet (IP addresses) 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 8 bits (an octet) into its decimal equivalent. Do this conversion exactly as was shown in the section, “Binary-to-Decimal Conversion.” When written, the complete decimal number is represented as four groups of decimal digits separated by periods, such as 10.15.129.201. This is called dotted-decimal nota-tion and provides a compact, easy-to-remember way of referring to 32-bit addresses. This representation is used frequently later in this course, so be sure to understand it. When converting to binary from dotted decimal, remember that each group of from one to three decimal digits represents a group of eight binary digits. If the decimal number you are converting is less than 128, you need to add 0s to the left of the equiv-alent binary number until you have a total of 8 bits. For example, to convert the dotted-decimal value 10.15.129.201 to its binary equiva-lent, you should write the number as 00001010.00001111.10000001.11001001. Boolean Logic Boolean logic is based on digital circuitry that accepts one or two incoming voltages and, based on these input voltages, generates an output voltage. For the purpose of computers, the voltage difference is associated with two states, on and off. These two states are in turn represented by a 1 or a 0, which are the two digits in the binary num-ber system. 1102.book Page 31 Tuesday, May 20, 2003 2:53 PM Bits, Bytes, and Measurement Terms 31 Boolean logic is a binary logic that allows two numbers to be compared, and then a choice based on those two numbers is generated. These choices are the logical AND, OR, and NOT. With the exception of the NOT, Boolean operations have the same func-tion. They accept two numbers (1 or 0) and generate a result based on the logic rule. This section presents the operations, starting with the NOT operation. The next sec-tion provides an example of directly applying Boolean logic in networking—network masking. This example covers the AND operation. The NOT operation, as shown in Table 1-7, simply takes whatever value is presented (0 or 1) and inverts it. A 1 becomes a 0, and a 0 becomes a 1. Remember that the logic gates are electronic devices built specifically for this purpose. This is the logic rule that they follow; whatever is input, the opposite is output. Table 1-7 NOT Operation Input Output 0 1 1 0 The AND operation, as shown in Table 1-8, takes two input values. If both values are 1, the logic gate generates a 1 output; otherwise, it outputs a 0. There are four combi-nations of input values. Three combinations generate a 0, and one combination gener-ates a 1. The AND operation is used extensively with IP addressing and subnet masks. Table 1-8 AND Operation AND 0 1 0 0 0 1 0 1 The OR operation, as shown in Table 1-9, also takes two input values. If one value is 1 or both values are 1, the output is 1. Just like the AND operation, there are four com-binations of input values. However, in an OR operation, three of the combinations generate a 1 output, and one combination generates a 0 output. The two networking operations that use Boolean logic are subnetwork masking and wildcard masking. Masking operations provide a way to filter addresses. The addresses identify the devices on the network. Masking allows the addresses to be grouped or controlled by other network operations. 1102.book Page 32 Tuesday, May 20, 2003 2:53 PM 32 Chapter 1: Introduction to Networking Table 1-9 OR Operation OR 0 1 0 0 1 1 1 1 IP Addresses and Subnet Masks The 32-bit binary addresses used on the Internet are called Internet Protocol (IP) addresses. This section covers the relationship between IP addresses and network masks. You learn more about IP addresses in Chapter 7. When IP addresses are assigned to computers, some of the bits on the left side of the 32 bit IP number are used to 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 called a host. So a computer’s IP address usually consists of a network portion and a host portion that represents a particular computer on a particular network. For the computer to know 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 identify the com-puter’s network. The network mask sequentially fills in the 1s from the left side of the mask. A subnetwork mask is always all 1s until the network address is identified. Then it is all 0s from there to the mask’s rightmost bit. The bits in the IP address that are 0 identify the computer (host) on that network. Some examples of subnet masks follow. Example 1: 11111111.00000000.00000000.00000000 written in dotted decimal is 255.0.0.0. Example 2: 11111111.11111111.00000000.00000000 written in dotted decimal is 255.255.0.0. In the first example, the first 8 bits from the left are the network address, and the last 24 bits are the host address. In the second example, the first 16 bits are the network address, and the last 16 bits are the host address. Converting the IP address 10.34.23.134 to binary results in the following: 00001010.00100010.00010111.10000110 1102.book Page 33 Tuesday, May 20, 2003 2:53 PM Summary 33 To determine the network portion of the IP address, compare the subnet mask bits to all 32 bits of the IP address 1 bit at a time, using the AND process, and record the result. The combination of a 0 IP address bit and a 0 mask bit is a 0. The combination of a 0 and a 1 is a 0. The combination of a 1 and a 1 is a 1. To better demonstrate, consider the following examples: Example 1: Using the first mask (255.0.0.0): 00001010.00100010.00010111.10000110: IP address 11111111.00000000.00000000.00000000: network mask 00001010.00000000.00000000.00000000 is the network part of the address. In dotted-decimal format, 10.0.0.0 is the network portion of the IP address. Example 2: Using the second mask (255.255.0.0): 00001010.00100010.00010111.10000110: IP address 11111111.11111111.00000000.00000000: network mask 00001010.00100010.00000000.00000000 is the network part of the address. In dotted-decimal format, 10.34.0.0 is the network portion of the IP address. The importance of subnetwork masking will become much clearer as you work more with IP addresses. For now, it is only important that you understand the concept of the network mask. Summary In this chapter, you learned the following key points: Computers are vital components of every network. The more you know about computers, the easier it is to understand networks. Knowing how a computer functions makes it easier to understand networks. TCP/IP is the protocol of the Internet. The ping command is a simple way of testing connectivity. Software allows the user to interface with the hardware. In networking, web browsers and e-mail are the most commonly used software programs. Troubleshooting PCs is a necessary skill when working on networks. It is important to be familiar with the components of a computer and to under-stand the functions of a NIC. It is also important to be able to install a NIC. Bits are binary digits. 8 bits equals 1 byte. ... - tailieumienphi.vn
nguon tai.lieu . vn