Network Layers
Every piece of the network is divided into layers. Each layer handles a specific part of the networking process and interacts only with the layers above and below it to provide a solid connection. New users often have trouble understanding this and laugh when it's said that layers "simplify" the networking process. We'll go over it in some detail, but the important thing to remember right now is that each layer only communicates with the layer directly above it and the layer directly beneath it.
The classic OSI network layer diagram has seven pieces, is exhaustively complete, and covers any situation in any network protocol. The Internet isn't "every situation" however, and this isn't a book about networking. We're limiting our discussion to the Internet and other networks that use the same protocols, so we can simplify this somewhat and divide the network into four layers: the application, the logical protocol, the physical protocol, and the physical layer.
The Physical Layer
At the very bottom we have the physical layer, which includes the network card and the wire, fiber, or radio waves running out of it. This layer includes the physical box that is a switch, hub, or base station, wires running from that device to the router, and the fiber that runs from your office to the telephone company. The telephone company switch is part of the physical layer, as are the transcontinental fibers. If someone can smash, drop, or cut it and inconvenience you, it's part of the physical layer. From this point on we're going to refer to the physical layer as a "wire," although it can be just about any sort of hardware.
A piece of wire, or some other physical media for signals to travel over — it's really that simple. If your wire is intact and meets the requirements of the physical protocol, you're in business. If not, you're hosed. Without a physical layer, the rest of the network will not function, period, end. One of the functions of Internet routers is to connect one sort of physical layer to another. The physical layer has no decision-making abilities and no intelligence; everything it does is dictated by the physical protocol.
The Physical Protocol Layer
The physical protocol layer is where things get interesting. The physical protocol talks over the wire. It encodes transmissions in the actual ones and zeros that are sent over the physical layer in the appropriate method for that sort of physical layer. For example, Ethernet uses Media Access Control (MAC) addresses and the Address Resolution Protocol (ARP); dial-up and wide area networks use the Point-to-Point Protocol (PPP). The physical protocol has to know how to speak to the physical layer.
While Ethernet and PPP are the most popular physical protocols, you will find many other protocols such as Asynchronous Transfer Mode (ATM), High Level Data Link Control (HDLC), and Internetwork Packet Exchange (IPX), as well as combinations such as the PPP over Ethernet used by some home-broadband vendors. While OpenBSD supports many different physical protocols, it doesn't support them all. If you have some unusual networking requirements, you will want to investigate whether OpenBSD can support them.
Some physical protocols have been implemented over many different physical layers; for example, Ethernet has been transmitted over twoax [1], coax, cat3, cat5, cat7, optical fiber, and radio waves. With minor changes in the device drivers, the physical protocol can address any sort of physical layer. This is one of the ways in which layers simplify the network. We will discuss Ethernet and PPP in some detail. Once you understand those, you should be able to figure out how to use other protocols without too much difficulty.
The physical protocol passes information to and from the physical layer to and from the logical protocol layer.
The Logical Protocol Layer
A computer program intended to run over any sort of network, over any sort of physical layer and physical protocol, cannot worry about the inner working of the physical protocol or physical layer. The logical protocol provides a consistent interface to programs that need to access the network, no matter which sort of physical layer it is running over. The most popular logical protocols are Internet Protocol (IP) and Transmission Control Protocol (TCP). These protocols provide things such as IP addresses and port operations. When a packet is transmitted, it includes a flag that identifies which protocol it uses. Logical protocols can work side by side and can even depend upon one another.
There are many logical protocols. See the file /etc/protocols for a mostly complete list. The ones we're most concerned with are IP and TCP (already mentioned), Internet Control Message Protocol (ICMP), and User Datagram Protocol (UDP).
The logical protocol talks to the physical protocol layer and to applications.
Applications
You can call applications another layer of the network. This is anything that the end user sees or any server program. Web browsers are applications, as are web servers, as are shell prompts and email clients, or compilers, or anything else. Applications only have to worry about the logical protocol and the application user.
[1]"Twoax" required two thick pieces of cable for each network connection. I saw this on an IBM System 38 in the fall of 1999, on a system that didn't speak TCP/IP. The moral of the story is: Be careful with what you implement today, because you may have to live with it for a very long time.
No comments:
Post a Comment