| 1.2 |
| 1 | 1.2 How Do Networks Communicate? Networks consist of connections between computers and devices. These connections are most commonly physical connections, such as wires and cables, through which electricity is sent. However, many other media exist. For example, it is possible to use infrared and radio as a communication medium for transmitting data wirelessly, or fiber-optic cables that use light rather than electricity. Such connections carry data between one point in the network and another. This data is represented as bits of information (either "on" or "off," a "zero" or a "one"). Whether through a physical medium such as a cable, through the air, or using light, this raw data is passed across various points in the network called nodes; a node could represent a computer, another type of hardware device such as a printer, or a piece of networking equipment that relays this information onward to other nodes in the network or to an entirely different network. Of course, for data to be successfully delivered to individual nodes, these nodes must be clearly identifiable. 1.2.1 Addressing Each node in a network is typically represented by an address, just as a street name and number, town or city, and zip code identifies individual homes and offices. The manufacturer of the network interface card (NIC) installed in such devices is responsible for ensuring that no two card addresses are alike, and chooses a suitable addressing scheme. Each card will have this address stored permanently, so that it remains fixed—it cannot be manually assigned or modified, although some operating systems will allow these addresses to be faked in the event of an accidental conflict with another card's address. Because of the wide variety of NICs, many addressing schemes are used. For example, Ethernet network cards are assigned a unique 48-bit number to distinguish one card from another. Usually, a numerical number is assigned to each card, and manufacturers are allocated batches of numbers. This system must be strictly regulated by industry, of course—two cards with the same address would cause headaches for network administrators. The physical address is referred to by many names (some of which are specific to a certain type of card, while others are general terms), including: • Hardware address • Ethernet address • Media Access Control (MAC) address • NIC address These addresses are used to send information to the appropriate node. If two nodes shared the same address, they would be competing for the same information and one would inevitably lose out, or both would receive the same data. Often, machines are known by more than one type of 3 address. A network server may have a physical Ethernet address as well as an Internet Protocol (IP) address that distinguishes it from other hosts on the Internet, or it may have more than one network card. Within a local area network, machines can use physical addresses to communicate. However, since there are many types of these addresses, they are not appropriate for internetwork communication. As discussed later in this chapter, the IP address is used for this purpose. 1.2.2 Data Transmission Using Packets Sending individual bits of data from node to node is not very cost effective, as a fair bit of overhead is involved in relaying the necessary address information every time a byte of data is transmitted. Most networks, instead, group data into packets. Packets consist of a header and data segment, as shown in Figure 1-1. The header contains addressing information (such as the sender and the recipient), checksums to ensure that a packet has not been corrupted, as well as other useful information that is needed for transmission across the network. The data segment contains sequences of bytes, comprising the actual data being sent from one node to another. Since the header information is needed only for transmission, applications are interested only in the data segment. Ideally, as much data as possible would be combined into a packet, in order to minimize the overhead of the headers. However, if information needs to be sent quickly, packets may be dispatched when nearly empty. Depending on the type of packet and protocol being used, packets may also be padded out to fit a fixed length of bytes. Figure 1-1. Pictorial representation of a packet header When a node on the network is ready to transmit a packet, a direct connection to the destination node is usually not available. Instead, intermediary nodes carry packets from one location to another, and this process is repeated indefinitely until the packet reaches its destination. Due to network conditions (such as congestion or network failures), packets may take arbitrary routes, and sometimes they may be lost in transit or arrive out of sequence. This may seem like a chaotic way of communicating, but as will be seen in later chapters, there are ways to guarantee delivery and sequencing. Indeed, the properties of guaranteed delivery and sequential order are often irrelevant to certain types of applications (such as streaming video and audio, where it is more important to present current video frames and audio segments than to retransmit lost ones). When these properties are necessary, networking software can keep track of lost packets and out-ofsequence data for applications. Packet transmission and transmission of raw bits of information are low-level processes, while most network programming deals with high-level transmission of data. Rather than simultaneously covering the gamut of transmission from raw bytes to packets and then to actual program data, it is helpful to conceive of these different types of communication as comprising individual layers. |
Комментарии