The relationship between the Internet layer (IP) and the data link layer (Ethernet)

1. Routing

The routing selection process is actually to choose an appropriate path. This "suitability" is not an easy thing to measure. The length of the path, the speed of communication, and the size of equipment overhead should be considered comprehensively. The routing here refers to the "path planning function" in the IP protocol.

2. Routing in the IP protocol

In the IP protocol, when data arrives at a certain router, the router only knows its current situation (equivalent to the routing table), but does not know the overall environment of the entire network. It is an exploratory process. The routing table describes "what kind of IP" is transmitted from "what kind of network interface"

3. Data link layer protocol (Ethernet)

1. Responsible work

Data transfer between two adjacent nodes

2. Core protocol

Ethernet (protocols involving data link layer + physical layer) such as: the usual network cable is generally an Ethernet cable

3. Give examples to illustrate the relationship between the transport layer, network layer, and data link layer

To go back to my hometown, my hometown is in the northeast, Jilin Province, Baicheng City, Da'an City (county), Anguang Town
(1) Standing on the transmission layer
Starting position: No. 1 Road, Weiyang District, Xi'an City, Shaanxi Province
Target position: Da'an, Baicheng City, Jilin Province Anguang Town
(2) at the network layer
Optional route 1: Xi’an-Beijing-Baicheng-Anguang
Optional route 2: Xi’an-Changchun-Baicheng-Anguang
Optional route 3: Xi’an-Shenyang-Da’an-Anguang
Optional route 4: Xi'an-Beijing-Changchun-Baicheng-Anguang
(3) Standing at the data link layer
Select route 2: Xi'an-Changchun-Baicheng-Anguang
Xi'an-Changchun: by plane
Changchun-Baicheng: by train
Baicheng- An Guang: Take the bus

4. Different terms used to describe data (seldom differentiated)

Transport layer: a data segment (segment) synchronization segment (syn), confirmation segment (ack), end segment (fin), reset segment (rst) network layer: a datagram (packet
)
data Link layer: a data frame (frame)

5. Ethernet frame format

insert image description here
(1) The destination address and source address here refer to the mac address, which is still very different from the IP address.
(2) A mac address occupies 6 bytes, generally expressed in hexadecimal.
(3) The length range of an IP datagram: 46-1500 (of which 46-1500 is controlled by MTU)
MTU: There is a hard limit on the physical layer, and the corresponding data frame of the data link layer has a certain size range. This range is the MTU. Different hardware media correspond to different MTUs. IP packets are often divided not because the IP length is reached, but because the upper limit of the MTU is reached.
(4) CRC: checksum

Four, mac address (data link layer address)

1. Introduction of mac address

A mac address occupies 6 bytes, and the scope of the representation is much larger than that of IPV4. The mac can make each host have a unique address. open.

2. How to check the mac address of your own host

mac address: enter ipconfig in cmd to view the physical address, generally expressed in hexadecimal

2. The difference between IP address and mac address

Both the IP address and the mac address can describe the location of a host, but they are independent at the beginning of the invention, and there are still differences.
The IP address is dynamically assigned (after connecting to the network, the corresponding router/other device will automatically assign an IP to the host) The
mac address is hard-coded (the network card is hard-coded when it comes out)

3. Draw a picture to describe the mac address

Host A wants to transmit a datagram to host B, skipping the encapsulation process of the application layer and the transport layer, and directly considering the network layer.
insert image description here

5. ARP protocol

1. Function

Auxiliary protocol, strictly speaking, this protocol not only belongs to the data link layer, but spans the data link layer and the network layer. The function of this protocol is to query the corresponding mac address according to the IP.

2. Working process

To put it simply, when a device connects to the network, it first broadcasts an ARP request (broadcast in the current LAN). The device that receives this request returns an ARP response (including the IP and mac of each device). Devices that are newly connected to the network save this relationship (using a hash table or a hard table, such as the table in the register on the forwarding chip (LSW)). Such a process may be performed periodically, mainly because the network environment may change dynamically.

6. DNS domain name resolution system

1. Why was the DNS domain name resolution system invented?

The DNS domain name resolution system is both an application layer protocol and a system. The domain name, like www.baidu.com, is the vest of the IP address. Although the IP address can be expressed in dotted decimal, which is more convenient for users to view, but the dotted decimal is still not convenient for memorization and dissemination, so there is a domain name. It is a string of words, used for segmentation. When transmitting, it is actually converted to the corresponding IP address according to the domain name, and then transmitted according to the IP address.

2. Function of DNS domain name resolution system

The original DNS is actually a text file called the hosts file, which is stored on each host. The file contains key-value pairs, the corresponding relationship between ip and domain name. Once the mapping relationship between domain name and ip changes, it will be troublesome. So the hosts file mechanism has been eliminated, but the file still exists. In the current scenario of using hosts, generally when testing, a program relies on another server (accessing this server through a domain name). When testing the program, you can modify hosts and map this domain name to the test server IP. It is guaranteed that the original code can be tested without modifying the original code, and it will not affect the normal online environment.
The current DNS is a group of specialized servers through which domain name resolution can be completed, as shown in the figure.
insert image description here

3. So many computers all over the world need to access the DNS server, how to solve this problem?

(1) The browser/client itself will cache the domain name resolution results. (The corresponding relationship between domain names and IPs may change, but not frequently), avoiding a large number of unnecessary DNS requests
(2) There are multiple DNS servers
that are initially maintained by a dedicated organization, the root domain name server, If you want to apply for a domain name, you need the approval of the organization and then put the result into the DNS server
(3) In order to alleviate the pressure on the organization, various network operators will also build their own domain name server mirrors.
Build some DNS servers nearby in China (each region or even each city), and regularly synchronize data from the root domain name server. When domestic users use DNS, they only need to check the domestic DNS service.
(4) When mirroring the DNS server, you can further divide
com, org, and vip into a dedicated server according to the domain name, so as to ensure that the data volume and request volume of each server are not too large.

Guess you like

Origin blog.csdn.net/stitchD/article/details/123965098