Introduction to Internet Protocol (i)

Source: Internet
Author: User
Tags new set
Introduction to Internet Protocol (i)This article is from "Nanyi blog", please click to read the original

We use the Internet every day, do you ever wonder how it is implemented.


Billions of computers worldwide, connected together, 22 communication. Shanghai a piece of network card sends out the signal, Los Angeles another piece of network card incredibly received, the two actually do not know each other's physical location, you do not think this is a very magical thing.


The core of the Internet is a series of protocols, collectively known as the Internet Protocol (Internet Protocol Suite). They make detailed provisions on how computers are connected and networking. Understanding the protocols, we understand the principles of the Internet.


Here is my study note. Because these agreements are too complex and too large, I want to tidy up a concise framework to help me grasp them in general. To keep it simple and easy to understand, I've done a lot of simplification, some of which are not comprehensive and precise, but should be able to explain the principles of the Internet.


I. Overview


1.1 Five-layer model


The realization of the Internet is divided into several layers. Each layer has its own function, just like a building, each layer is supported by the next layer.


The user touches, just the top layer, does not feel at all below the layer. To understand the Internet, you have to start from the bottom and understand the capabilities of each layer from below.


There are different models for layering, some models are divided into seven layers, and some are divided into four layers. I think it is easier to explain the Internet into five layers.



As shown above, the bottom layer is called the "solid layer" (physical layer), the topmost layer is called the "Application Layer" (Application layer), the middle layer of three (bottom-up) is the "link layer", "Network layer" (Network layer) and "Transport Layer" (Transport layer). The lower layer, the closer to the hardware, the higher the upper layer, the closer the user.


It doesn't really matter what their name is. Just know that the Internet is divided into several layers.


Layer 1.2 and Protocol


Each layer is designed to perform a function. In order to achieve these functions, we need to abide by common rules.


The rules that we all obey are called "agreements" (protocol).


Every layer of the Internet defines a lot of protocols. Collectively, these protocols are called "Internet Protocols" (Internet Protocol Suite). They are the core of the Internet, the following describes the functions of each layer, mainly to introduce each layer of the main protocol.


Second, the physical layer


We start at the bottom of the floor.


The first thing to do is to set up a computer network. Of course, the first to connect the computer, you can use optical cable, cable, twisted-pair, radio waves and other ways.



This is called the "solid Layer", which is the physical means of connecting the computer. It mainly specifies the electrical characteristics of the network, the role is responsible for the transmission of 0 and 1 of electrical signals.


Third, the link layer


3.1 Definitions


Pure 0 and 1 have no meaning, and must be interpreted: how many electrical signals are counted as a group. What each signal bit means. This is the function of the link layer, which, above the entity layer, determines how 0 and 1 are grouped.


3.2 Ethernet Protocol


In the early days, each company had its own way of grouping electrical signals. Gradually, a protocol called "Ethernet" (Ethernet) dominates the situation.


Ethernet provides that a set of electrical signals constitutes a packet called "frame". Each frame is divided into two parts: header (head) and data.



"Header" contains some description items of the packet, such as sender, recipient, data type, etc.; "Data" is the specific content of the packet.


The length of the "header", fixed to 18 bytes. The length of the "data" is as short as 46 bytes and up to 1500 bytes. Therefore, the entire "frame" is a minimum of 64 bytes and a maximum of 1518 bytes. If the data is long, it must be split into multiple frames for sending.


3.3 MAC Address


As mentioned above, the "header" of the Ethernet packet contains the information of the sender and the recipient. So, how are the senders and recipients identified?


Ethernet specifies that all devices connected to the network must have a "Nic" interface. The packet must be routed from one network card to another. The address of the network card is the sending and receiving address of the packet, which is called the MAC address.



Each NIC comes out of the factory with a unique MAC address in the world, with a length of 48 bits, usually in 12 hexadecimal digits.



The first 6 hexadecimal digits are the vendor number, and the last 6 are the vendor's NIC serial number. With the MAC address, you can locate the network card and the path to the packet.


3.4 Broadcast


Defining an address is just the first step, and there are more steps behind it.


First, how a piece of network card will know the MAC address of another NIC.


The answer is that there is an ARP protocol that solves this problem. This is left to the back, only to know that the Ethernet packet must know the receiver's MAC address before it can be sent.


Second, even if there is a MAC address, how the system can send packets to the receiving party accurately.


The answer is that Ethernet uses a very "primitive" way, it is not to send packets to the receiver accurately, but to all the computers within the network to send, so that each computer to determine whether it is the receiver.




In the image above, computer 1th sends a packet to computer number 2nd, and Computers 3rd, 4th, and 5th of the same subnet receive the packet. They read the "header" of the packet, find the receiver's MAC address, and then compare it to their MAC address, and if the two are the same, accept the package, do further processing, or discard the package. This type of transmission is called "broadcast" (broadcasting).


With the definition of the packet, the MAC address of the NIC, the way the broadcast is sent, the link layer can transfer data between multiple computers.


Four, the network layer


4.1 The origin of the network layer


Ethernet protocol that relies on MAC addresses to send data. Theoretically, relying solely on the MAC address, Shanghai's network card can find the network card in Los Angeles, technically can be achieved.


However, there is a major drawback to doing so. Ethernet uses broadcast to send packets, all members of a "package", not only inefficient, but also confined to the sub-network of the sender. In other words, if two computers are not on the same subnet, the broadcast is not passed. This design is reasonable, otherwise every computer on the Internet will receive all the packages, which will cause disaster.


The internet is a giant network of countless sub-networks, much like the idea that computers in Shanghai and Los Angeles will be on the same subnet, which is almost impossible.




Therefore, you must find a way to differentiate which MAC addresses belong to the same subnet and which are not. If it is the same subnet, it is sent by broadcast, otherwise it is sent by "route" mode. ("Routing" means the distribution of packets to different sub-networks, which is a large topic that is not covered in this article.) Unfortunately, the MAC address itself cannot do this. It is only relevant to the vendor, regardless of the network in which it is located.


This led to the birth of the "network layer". Its role is to introduce a new set of addresses that allow us to distinguish whether different computers belong to the same subnet. This set of addresses is called "Network Address", referred to as "url".


Therefore, after the "Network layer" appears, each computer has two kinds of addresses, one is the MAC address, the other is the network address. There is no connection between the two addresses, the MAC address is bound on the network card, the network address is assigned by the administrator, they are only randomly grouped together.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.