In computer science, the concept of network layers is a framework that helps to understand complex network interactions. There are two models that are widely referenced today: OSI and TCP/IP. The concepts are similar, but the layers themselves differ between the two models. Show What are the network layers?While TCP/IP is the newer model, the Open Systems Interconnection (OSI) model is still referenced a lot to describe network layers. The OSI model was developed by the International Organization for Standardization. There are 7 layers:
People have come up with tons of mnemonic devices to memorize the OSI network layers. One popular mnemonic, starting with Layer 7, is “All People Seem To Need Data Processing.” But one that I’m partial to, which starts with Layer 1, is “Please Do Not Throw Sausage Pizza Away.” The TCP/IP model is a more concise framework, with only 4 layers:
One mnemonic device for the TCP/IP model is “Armadillos Take In New Ants.”
Download our whitepaper to see how the Plixer NPMD platform helps NetOps teams monitor network and application performance at the perimeter and interior, while also detecting abnormalities that impact network performance, scalability, and availability. Network Layers and FunctionsFor the OSI model, let’s start at the top layer and work our way down.
The TCP/IP model, sometimes referred to as a protocol stack, can be considered a condensed version of the OSI model.
How Network Layers WorkAs we walk through an example, keep in mind that the network layers models are not strictly linear. One layer doesn’t finish its processes before the next one begins. Rather, they work in tandem. Application, Presentation, and Session LayersLet’s suppose you’re using Skype on a laptop. You’re messaging your friend, who’s using Skype on their phone from a different network. Skype, as a network-connected application, uses Layer 7 (Application) protocols like Telnet. If you send your friend a picture of your cat, Skype would be using the File Transfer Protocol (FTP). Layer 6 (Presentation) receives application data from Layer 7, translates it into binary, and compresses it. When you send a message, Layer 6 encrypts that data as it leaves your network. Then it decrypts the data when your friend receives it. Applications like Skype consist of text files and image files. When you download these files, Layer 5 (Session) determines which data packets belong to which files, as well as where these packets go. Layer 5 also establishes, maintains, and ends communication between devices.
Transport and Network LayersLayer 4 (Transport) receives data from Layer 5 and segments it. Each segment, or data unit, has a source and destination port number, as well as a sequence number. The port number ensures that the segment reaches the correct application. The sequence number ensures that the segments arrive in the correct order. This layer also controls the amount of data transmitted. For example, your laptop may be able to handle 100 Mbps, whereas your friend’s phone can only process 10 Mbps. Layer 4 can dictate that the server slow down the data transmission, so nothing is lost by the time your friend receives it. But when your friend sends a message back, the server can increase the transmission rate to improve performance. Lastly, Layer 4 performs error-checking. If a segment of data is missing, Layer 4 will re-transmit that segment. TCP and UDP are both very well-known protocols, and they exist at Layer 4. TCP favors data quality over speed, whereas UDP favors speed over data quality. Layer 3 (Network) transmits data segments between networks in the form of packets. When you message your friend, this layer assigns source and destination IP addresses to the data segments. Your IP address is the source, and your friend’s is the destination. Layer 3 also determines the best paths for data delivery.
Layer 2 (Data Link) receives packets from Layer 3. Whereas Layer 4 performs logical addressing (IPv4, IPv6), Layer 2 performs physical addressing. It adds sender and receiver MAC addresses to the data packet to form a data unit called a frame. Layer 2 enables frames to be transported via local media (e.g. copper wire, optical fiber, or air). This layer is embedded as software in your computer’s Network Interface Card (NIC). In short, Layer 2 allows the upper network layers to access media, and controls how data is placed and received from media. Hardware—the things you can actually physically touch—exist at Layer 1 (Physical). This layer converts the binary from the upper layers into signals and transmits them over local media. These can be electrical, light, or radio signals; it depends on the type of media used. When your friend receives the signals, they’re decapsulated, or translated back into binary and then into application data so your friend can see your message.
In ConclusionThis is a lot to absorb! Essentially, network layers help us understand how data moves from something human-readable, to computer-readable, to a transmitted signal, and back again. To learn more about networking, check out some of our other blogs:
In the previous section, we learned about the Network Access layer. Essentially we learned more about the anatomy of a frame, physical addressing, and what exactly the physical layer accomplishes. Don’t relax yet- we still have three layers to go! What the Internet Layer Is Responsible ForThe Internet Layer is used to deliver data on a complex routed network. In some cases, we can get by with simply using physical addressing. However, this would only work on extremely small LAN connections that do not use routers. For anything bigger or more complex, we will need to make use of the Internet Layer. The Internet Layer uses logical addressing, as compared to physical addressing. Logical addresses can be read and forwarded among routers, while physical addresses lack the routed functionality. The Internet Layer is also responsible for identifying computers on any network so that data can be successfully sent. Lastly, the Internet Layer is responsible for converting the logical IP address of the destination computer to a physical address, so data can be delivered to the correct computer. The Anatomy of an IP DatagramBefore we get into how the Internet Layer routes data, we first have to know what it is routing exactly. Specifically, data at this level is called a datagram. And from what we learned in previous sections, we know the Internet Layer attaches an IP header onto data. But what does this IP header consist of? At first glance, this is a lot of information to digest. But don’t be dismayed- it is a lot simpler than you may think. Check below for detailed information on each field.
The above diagram should be reviewed until a firm grasp is held on the concept of an IP header. If you feel you have the concepts down well enough, it’s time to move onto routing the data! Routing the Information with the IP Protocol and IP AddressesThe Internet Protocol, or IP, operates on the Internet layer. This protocol provides a hardware-independent addressing system in the form of IP addresses. For every Network Interface Card, or NIC, there should be a unique IP address. After all, how could we send data to a specific computer if more than one computer was using an IP address? Look at the diagram below and see if you can tell any similarities between the IP addresses. You may have noticed that the first three numbers are identical in each address. IP addresses are made up of two portions: the network ID and the host ID. The network ID is responsible for telling other computers which network the computer resides on (useful if we are using subnets or multiple LAN segments). The host portion tells us which specific computer on the network the computer is. In terms of an actual home address, the network ID would be the street of your home- while the host ID would be the house number. In case you needed proof that each IP address is 32 bits, count each one and zero in the binary format. Each 1 or 0 is a bit. Since there are 8 bits in a byte, we can also say that each IP address is 4 bytes in size. Notice that each class is dictated through the first octet’s value. However, there is more going on behind the scenes that we are aware of with the above diagram. Each class has a specific amount of network and host octets. Review the diagram below for more information. Remembering the network octets is easy- simply remember that each class from A to C adds a network octet. Keep in mind that Class D and Class E addresses exist, but for the sake of simplicity, we will not cover them just yet since you’ll likely not use one anytime soon. For now, we have one more thing to learn about concerning IP addresses: reserved IP addresses. Reserved IP AddressesThere are certain IP addresses that are reserved; meaning they have a special purpose. For instance, you can’t use all zeroes for the host octets, since this is the actual network address. (The Class C address 192.168.2.0 is not usable, for instance.) We also may not use the broadcast address- which is simply represented as all 1’s in binary, or 255 in decimal. (The Class C address 192.168.2.255 is not usable, for instance.) Don’t worry- we will cover broadcast addresses more thoroughly in later sections. Lastly, you may not use the 127.0.0.1 address since it is a loopback address- mainly used for testing and troubleshooting. There are certain IP addresses that are used for private networks, meaning that they aren’t for internet use. These addresses, therefore, don’t have to be unique and can be used for network use. These private addresses are:
Use these addresses however you see fit on your own network- but also know that since these are private addresses, you may not access the internet with them. Last but not Least, ARP and RARPWe certainly have covered a lot so far! Don’t worry- we only have ARP and RARP to review for now. The Address Resolution Protocol, or ARP, is used to map IP addresses to physical addresses. To actually deliver data to a computer we use its physical address. You may remember that every physical address is unique and is burned into the NIC card at the factory. Your Network InterfaceCard is actually a fairly dumb device. All it does when receiving data is look at incoming information and check to see if it is addressed to it or not. Ironically, it doesn’t even know its own IP address! Since we can’t depend on the NIC card we use ARP tables, otherwise known as the ARP cache. The best part of the situation is that ARP tables are built dynamically- no need to configure anything normally. These ARP tables will associate physical addresses to logical addresses, and will be used to route data to specific computers. But what if there aren’t any addresses in the ARP tables, yet we have data being sent to a computer on a network? In this instance, the host sends a broadcast called an ARP request frame. The ARP request frame contains IP address and physical address information for the host that sent the request. Other hosts on the network receive the ARP request, and hopefully the unresolved IP address is found out. If it is, a new entry into the ARP table is made. This happens more than you’d think since ARP tables actually expire after a certain amount of time. Simple enough, right? Next we have RARP, which can be simply seen as the opposite of ARP. It technically stands for Reverse ARP, so you wouldn’t be wrong in believing this. RARP is used when the IP address is known, but the physical address isn’t. |