H5 Cattle and cattle chess source download Nine people cattle cattle build a full set of tutorials

Source: Internet
Author: User
Tags new set

The world has billions of computers connected, with 22 communications. A net card from Shanghai sends a signal, and another one in Los Angeles receives a signal. They don't actually know the other person's physical location. Don't you think it's magical?

The core of the Internet is a series of protocols, often referred to as Internet Protocol Suites (Internet Protocol Suite), which provide detailed information on how computers are connected and networked, and understand how the Internet works by understanding these protocols.

Here are my study notes. As these protocols are so complex and large, I want to summarize a concise framework to help me master them in general. For the sake of understanding, I have done a lot of simplification, some areas are not comprehensive and accurate, but should be able to demonstrate. Follow the principles of the Internet.

=============================================================================================================== ========================================================================================

Introduction to Internet Protocol



First, an overview

1.1 Five-layer model

The implementation of the Internet is divided into several levels, each with its own functions, such as buildings, each of which is supported by the next layer.

The user only touches the top level and does not feel the bottom layer at all. To understand the Internet, we must start from the lowest level and understand the function of each layer from bottom to top.

There are different models for layering. Some models are divided into seven levels, some of which are divided into four levels. I think dividing the Internet into five levels is easier to explain.

As shown above, the underlying is called the physical layer, and the top layer is called the application layer. The middle three layer is the link layer, the network layer and the transport layer, the lower layer is closer to the hardware, the higher the upper level is closer to the user.

Their name is not important, just need to know that the Internet can be divided into several levels.

1.2-Layer protocol

Each layer is designed to perform a function, and in order to achieve these functions, everyone needs to follow common rules.

The rules we follow are called protocols.

Each layer of the Internet defines a number of protocols, the general terms of which are called Internet Protocol groups, which are at the heart of the Internet. The following are the functions of each layer, primarily the main protocol for each layer.

Two. Physical Layer

Let's start at the bottom.

When the computer wants to build a network, the first thing to do is of course, we first connect the computer, we can use optical cable, cable, twisted pair, radio waves and so on.

It mainly specifies some electrical characteristics of the network, and is responsible for transmitting 0 and 1 of electrical signals.

Third, link layer

3.1 Definitions

Pure 0 and 1 do not make any sense. They must specify the way to explain: how many electrical signals each signal bit is meant to be

This is the function of the link layer.

3.2 Ethernet Protocol

In the early days, each company had its own method of grouping electrical signals, and gradually, a protocol called Ethernet began to play a leading role.

Ethernet provides a set of electrical signals to form a packet called a frame, each frame divided into two parts: Head (head) and data (data).

The header contains some descriptions of the package, such as the sender, receiver, data type, etc., and the data is the specific content of the package.

The length of the header is fixed to 18 bytes. The length of the data is 46 bytes and the length is 1500 bytes. Therefore, the entire frame is 64 bytes, and the maximum is 1518 bytes. If the data is long, it must be divided into multiple frames for transmission.

3.3 MAC Address

As mentioned above, the head of the Ethernet packet contains the sender and receiver information, then how to identify the sender and receiver?

Ethernet, all devices connected to the network must have a NIC interface, the packet must be transferred from one network card to another network card, the address of the network card is the sending address of the packet and the receiving address, called the MAC address.

Each NIC has a unique MAC address, a length of 48 bits, usually expressed in 12 hexadecimal digits.

The first 6 16 digits are the manufacturer number, and the 6 16-digit number is the serial number of the company's network card. With the MAC address, you can locate the network card and the path of the packet.

3.4 Broadcast

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

First, how the NIC knows the MAC address of the other network card

The answer is that there is an ARP protocol to solve this problem. This is left to be discussed later, where you only need to know that the Ethernet packet must know the MAC address of the receiver before it is sent.

Second, even if there is a MAC address, how the system sends the packet to the receiver accurately

The answer is that Ethernet is in a very primitive way, and it does not accurately send packets to the receiver, but instead sends them to all the computers on the network so that each computer determines whether it is a receiver.

In the above picture, Computer 1 sends a grouping to computer 2, and Computers 3, 4, and 5 receive the group on the same subnet. They read the packet's header, find the receiver's MAC address, and then compare it to their MAC address. If the two are the same, accept the grouping for further processing, or discard the groupings. This type of transmission is called broadcast.

The link layer can transfer data between multiple computers by defining the packet, the MAC address of the network card, and the way the broadcast is sent.

Four. Network layer

4.1 Origin of the network layer

Ethernet protocol relies on MAC address to send data, theoretically, the Shanghai network card only need to rely on MAC address to find the network card in Los Angeles, which is technically possible.

However, there is a major drawback to doing so. Ethernet uses broadcasts to send packets, that is, all members of a group, that is, if two computers are not on the same subnet, the broadcast will not pass. This design is reasonable, otherwise every computer on the Internet will receive all p will cause disaster.

It is almost impossible to imagine that the computers in Shanghai and Los Angeles will be on the same subnet, because the Internet is a huge network of countless subnets.

Therefore, you must find a way to differentiate which MAC addresses belong to the same sub-network, which are not the same subnet, it will be sent over the broadcast, otherwise it will be sent by route (routing, that is, how to distribute the packets to different sub-networks), is a large top. Unfortunately, the MAC address itself does not do this, it is only related to the manufacturer, and is not related to the network.

This led to the birth of the network layer. Its purpose is to introduce a new set of addresses that allow us to differentiate between different computers belonging to the same subnet.

Therefore, after the network layer appears, each computer has two addresses, one is the MAC address, and the other is the network address. There is no connection between the two addresses. The MAC address is bound to the NIC and the network address is assigned by the administrator. They are just randomly grouped together.

The network address helps us determine the subnet where the computer resides, and the MAC address sends the packet to the destination network card in that subnet, so logically, you must first process the network address and then process the MAC address.

4.2 IP protocol

The protocol that specifies the network address is called the IP protocol, and the address it defines is called an IP address.

Currently, the fourth version of the IP protocol is widely used, namely IPv4. This version specifies that the network address consists of 32 bits.

Traditionally, we used four-segment decimal numbers to represent IP addresses, from 0.0.0.0 to 255.255.255.255.

Each computer on the Internet will be assigned to an IP address. This address is divided into two parts, the first part represents the network, the second part represents the host. For example, the IP address of the 32-bit address 172.16.254.1 assumes that its network portion is the first 24 bits (172.16.254), and then the host portion is the last 8 bits (last). Computers on the same subnet must have the same IP address on the same network, which means that the 172.16.254.2 should be on the same subnet as 172.16.254.1.

But the problem is that we can't judge the network part just from the IP address, or 172.16.254.1, such as its network portion, the top 24, the first 16, or even the first 28, cannot be seen from the IP address.

So, how do we determine if the two computers belong to the same subnet's IP address? This requires another parameter subnet mask.

The so-called subnet. is a parameter that represents a subnet attribute. It is formally equivalent to an IP address, is also a 32-bit binary number, its network portion is all 1, the host part is all 0. For example, IP address 172.16.254.1, if the network part is known as the first 24 bits, the host is the last 8 bits, the subnet mask is 111111.11111111.11111.11111.11111.00000000, with a decimal write of 255.255.255.0.

Understanding the subnet mask This method performs and operations on both the IP address and the subnet mask (two numbers are 1, the result is 1, otherwise 0), and then if the results are the same, the results are compared and if the results are the same, they are in the same subnet, otherwise they are not.

For example, the subnet mask for 172.16.254.1 and 172.16.254.23 with a known IP address is 255.255.255.0. Are they on the same subnet? They are and subnet masks respectively, and the result is 172.16.254.0, so they are in the same subnet.

In summary, the IP protocol has two main functions, one is to assign an IP address to each computer, and the other is to determine which addresses are in the same subnet.

4.3 IP messages

Data sent according to IP protocol is called IP grouping, it is not difficult to imagine the need to include IP address information.

But as I mentioned earlier, the Ethernet packet contains only the MAC address, and there is no IP address field. Do you need to modify the data definition and add additional columns?

The answer is no, we can put the IP packet directly into the data portion of the Ethernet packet, so there is no need to modify the Ethernet specification. This is the advantage of the Internet hierarchy: The change in the upper layer does not involve the underlying structure.

Specifically, IP packets are also divided into two parts: headers and data.

Header part mainly includes version, length, IP address and other information, the data part is the specific content of IP grouping.

The head portion of the IP packet is 20 to 60 bytes long, and the total length of the packet is up to 65535 bytes. Therefore, in theory, the data portion of the IP packet can be up to 65515 bytes. As mentioned earlier, the data portion of the Ethernet packet is only 1500 bytes long. Therefore, if the IP packet exceeds 1500 bytes, it needs to be divided into several Ethernet groupings and sent separately.

4.4 ARP Protocol

As for the network layer

Since the IP packet is sent as an Ethernet packet, we must know two addresses at the same time, one for the other MAC address and another for the IP address.

Therefore, we need a mechanism to get the MAC address from the IP address.

This can be divided into two cases, the first case is that if two hosts are not on the same subnet, then there is virtually no way to obtain each other's MAC address, and the packet can only be sent to the gateway at the junction of two sub-networks for the gateway to process.

In the second case, if two hosts are on the same subnet, we can use the ARP protocol to get the MAC address of the other host. In the other's MAC address column, it fills FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF, which indicates that this is an. Address. Each host in its subnet receives the packet, extracts the IP address from it, and compares it to its own IP address. If the two are the same, they are answered by D to report their MAC address to each other, otherwise the grouping will be discarded.

In short, with the ARP protocol, we can get the MAC address of the host in the same subnet and send the packet to any host.

H5 Cattle and cattle chess source download Nine people cattle cattle build a full set of tutorials

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.