Networking All-in-One For Dummies. Doug Lowe
Читать онлайн книгу.Application layer
The application layer of the TCP/IP model corresponds to the session, presentation, and application layers of the OSI Reference Model. A few of the most popular application layer protocols are
Hypertext Transfer Protocol (HTTP): The core protocol of the World Wide Web.
File Transfer Protocol (FTP): A protocol that enables a client to send and receive complete files from a server.
Telnet: The protocol that lets you connect to another computer on the Internet in a terminal emulation mode.
Simple Mail Transfer Protocol (SMTP): One of several key protocols that are used to provide email services.
Domain Name System (DNS): The protocol that allows you to refer to other host computers by using names rather than numbers.
Chapter 3
IP Addresses
IN THIS CHAPTER
Delving into the binary system
Digging into IP addresses
Finding out how subnetting works
Delving into ports
Looking at network address translation
One of the most basic components of TCP/IP is IP addressing. Every device on a TCP/IP network must have a unique IP address. In this chapter, I describe the ins and outs of these IP addresses. Enjoy!
Understanding Binary
Before you can understand the details of how IP addressing works, you need to understand how the binary numbering system works because binary is the basis of IP addressing. If you already understand binary, please skip to the section “Introducing IP Addresses.” I don’t want to bore you with stuff that’s too basic.
Counting by ones
Binary is a counting system that uses only two numerals: 0 and 1. In the decimal system (with which most people are accustomed), you use ten numerals: 0–9. In an ordinary decimal number — such as 3,482 — the rightmost digit represents ones; the next digit to the left, tens; the next, hundreds; the next, thousands; and so on. These digits represent powers of ten: first 100 (which is 1); next, 101 (10); then 102 (100); then 103 (1,000); and so on.
In binary, you have only two numerals rather than ten, which is why binary numbers look somewhat monotonous, as in 110011, 101111, and 100001.
The positions in a binary number (called bits rather than digits) represent powers of two rather than powers of ten: 1, 2, 4, 8, 16, 32, and so on. To figure the decimal value of a binary number, you multiply each bit by its corresponding power of two and then add the results. The decimal value of binary 10111, for example, is calculated as follows:
1 × 20 = 1 × 1 = 1
1 × 21 = 1 × 2 = 2
1 × 22 = 1 × 4 = 4
0 × 23 = 0 × 8 = 0
1 × 24 = 1 × 16 = 16
Total = 1 + 2 + 4 + 0 + 16 = 23
Fortunately, converting a number between binary and decimal is something a computer is good at — so good, in fact, that you’re unlikely ever to need to do any conversions yourself. The point of learning binary is not to be able to look at a number such as 1110110110110 and say instantly, “Ah! Decimal 7,606!” (If you could do that, Piers Morgan would probably interview you, and they would even make a movie about you.)
Instead, the point is to have a basic understanding of how computers store information and — most important — to understand how the binary counting system works, which I describe in the following section.
Here are some of the more interesting characteristics of binary and how the system is similar to and differs from the decimal system:
In decimal, the number of decimal places allotted for a number determines how large the number can be. If you allot six digits, for example, the largest number possible is 999,999. Because 0 is itself a number, however, a six-digit number can have any of 1 million different values.Similarly, the number of bits allotted for a binary number determines how large that number can be. If you allot eight bits, the largest value that number can store is 11111111, which happens to be 255 in decimal.
To quickly figure how many different values you can store in a binary number of a given length, use the number of bits as an exponent of two. An eight-bit binary number, for example, can hold 28 values. Because 28 is 256, an eight-bit number can have any of 256 different values. This is why a byte — eight bits — can have 256 different values.
This “powers of two” thing is why computers don’t use nice, even, round numbers in measuring such values as memory or disk space. A value of 1K, for example, is not an even 1,000 bytes: It’s actually 1,024 bytes because 1,024 is 210. Similarly, 1MB is not an even 1,000,000 bytes but instead 1,048,576 bytes, which happens to be 220.
One basic test of computer nerddom is knowing your powers of two because they play such an important role in binary numbers. Just for the fun of it, but not because you really need to know, Table 3-1 lists the powers of two up to 32.TABLE 3-1 Powers of Two
Power | Bytes | Kilobytes | Power | Bytes | K, MB, or GB |
---|---|---|---|---|---|
21 | 2 | 217 | 131,072 | 128K | |
22 | 4 | 218 | 262,144 | 256K | |
23 | 8 | 219 | 524,288 | 512K | |
24 | 16 |
220
|