Скачать книгу

the middle left of the Calculator window, you can see the current value displayed by the Calculator in hexadecimal (HEX), decimal (DEC), octal (OCT), and binary (BIN). You can also tell which base the main display shows, because it’s highlighted with a bar. In Figure 3-1, the current mode is DEC, so the decimal value 100 is shown in large text in the upper-middle part of the display. You can switch the main display to hexadecimal, octal, or binary by clicking HEX, OCT, or BIN, respectively.

      You can also see the current value in all four bases. Thus, in the figure, you can see that decimal 100 is 64 in hexadecimal, 144 in octal, and 01100100 in binary.

      Here are a few other things to note about the Programmer mode of the Calculator:

       Although you can convert decimal values to binary values with the programmer Calculator, the Calculator can’t handle the dotted-decimal IP address format that’s described later in this chapter. To convert a dotted-decimal address to binary, just convert each octet separately. For example, to convert 172.65.48.120 to binary, first convert 172; then convert 65; then convert 48; and finally, convert 120.

       The Programmer Calculator has several features that are designed specifically for binary operations, such as AND, OR, XOR, and so on.

       The Programmer Calculator also has many other cool features for working with binary values. Spend some time exploring it when you have a few minutes!

Snapshot of the Windows Calculator in Programmer mode.

      FIGURE 3-1: The Windows Calculator in Programmer mode.

      An IP address is a number that uniquely identifies every host on an IP network. IP addresses operate at the network layer of the TCP/IP protocol stack, so they are independent of lower-level data link layer MAC addresses, such as Ethernet MAC addresses.

      Networks and hosts

      IP stands for Internet Protocol, and its primary purpose is to enable communications between networks. As a result, a 32-bit IP address actually consists of two parts:

       The network ID (or network address): Identifies the network on which a host computer can be found

       The host ID (or host address): Identifies a specific device on the network indicated by the network ID

      Most of the complexity of working with IP addresses has to do with figuring out which part of the complete 32-bit IP address is the network ID and which part is the host ID, as described in the following sections.

      

As I describe the details of how host IDs are assigned, you may notice that two host addresses seem to be unaccounted for. For example, the Class C addressing scheme, which uses eight bits for the host ID, allows only 254 hosts — not the 256 hosts you’d expect. The host ID can’t be 0 (the host ID is all zeros) because that address is always reserved to represent the network itself. And the host ID can't be 255 (the host ID is all ones) because that host ID is reserved for use as a broadcast request that’s intended for all hosts on the network.

      The dotted-decimal dance

      IP addresses are usually represented in a format known as dotted-decimal notation. In dotted-decimal notation, each group of eight bits — an octet — is represented by its decimal equivalent. For example, consider the following binary IP address:

       11000000101010001000100000011100

      To convert this value to dotted-decimal notation, first divide it into four octets, as follows:

       11000000 10101000 10001000 00011100

      Then, convert each of the octets to its decimal equivalent:

       11000000 10101000 10001000 00011100192 168 136 28

      Then, use periods to separate the four decimal numbers, like this:

       192.168.136.28

      This is the format in which you’ll usually see IP addresses represented.

Schematic illustration of the octets and dotted-decimal notation.

      FIGURE 3-2: Octets and dotted-decimal notation.

      When the original designers of the IP protocol created the IP addressing scheme, they could have assigned an arbitrary number of IP address bits for the network ID. The remaining bits would then be used for the host ID. For example, suppose that the designers decided that half of the address (16 bits) would be used for the network, and the remaining 16 bits would be used for the host ID. The result of that scheme would be that the Internet could have a total of 65,536 networks, and each of those networks could have 65,536 hosts.

      In the early days of the Internet, this scheme probably seemed like several orders of magnitude more than would ever be needed. However, the IP designers realized from the start that few networks would actually have tens of thousands of hosts. Suppose that a network of 1,000 computers joins the Internet and is assigned one of these hypothetical network IDs. Because that network will use only 1,000 of its 65,536 host addresses, more than 64,000 IP addresses would be wasted.

      WHAT ABOUT IPv6?

      Most of the current Internet is based on version 4 of the Internet Protocol, also known as IPv4. IPv4 has served the Internet well for more than 30 years. However, the growth of the Internet has put a lot of pressure on IPv4’s limited 32-bit address space. This chapter describes how IPv4 has evolved to make the best possible use of 32-bit addresses. Eventually, though, all the addresses will be assigned, and the IPv4 address space will be filled to capacity. When that happens, the Internet will have to migrate to the next version of IP, known as IPv6.

      IPv6 is also called IP next generation, or IPng, in honor of the favorite television show of most Internet gurus, Star Trek: The Next Generation.

      IPv6 offers several advantages over IPv4, but the most important is that it uses 128 bits for Internet addresses instead of 32 bits. The number of host addresses possible with 128 bits is a number so large that it would have made Carl Sagan proud. It doesn’t just double or triple the number of available addresses, or even a thousand-fold or even a million-fold. Just for the fun of it, here is the number of unique Internet addresses provided by IPv6:

       340,282,366,920,938,463,463,374,607,431,768,211,456

Скачать книгу