It is called in different data in different protocols

Data Link Layer: is solved in the LAN data from host A to B

It called the transport layer data segment, called the network layer data packets, the data link layer is called a data frame.

Ethernet

Ethernet frame format

Ethernet frame format is as follows:

Here Insert Picture Description

1.MAC generally comprise 48 address bit to 6 bytes. Identify unique MAC address is a host address, because the MAC address is a card number, a card number (the fixed time Default NIC) uniquely determined.

2. how split MAC address (header and payload)?
We know the MAC frame by the MAC header and the payload of fixed length.

3.MAC decide how to frame payload delivered to the upper layer which specific agreement?

Determined according to the type of MAC header.

Real run on the network data is MAC frame.

4.MAC frame problem solving point to point.

The LAN communication principle Keywords: MAC address of the collision domain, the destination IP address does not change, all the same LAN devices can receive data transmitted from the transmitting side, can not meet directly discarded after comparison MAC address.

6. Type:

0800 indicates the IP packets;

When 0806 is put inside the ARP on behalf of, a maximum transmittable MAC frame 1500 bytes, the MAC frame also minimum transmission standard, the minimum amount of transmission packets is less than if the MAC frame is filled with PAD, but occupying only the filling meaningless Follow allowed when normal transmission can be followed by de-header packet that is referenced to the payload.

0835 on behalf of which put a RARP.

7. The end of the frame is a CRC.

8. The source address and destination address is the hardware address of the network card (also called a MAC address) and a length of 48, is fixed at the factory on the card.

LAN data from the same host A to host B Package demultiplexing process:

In the same LAN when the data from the host B to the host A, the host A from the application layer to the data link layer network is placed, all of the data link layer in the same LAN hosts are received the data, this All hosts in the MAC packet when the destination address is compared with its own IP address, the packet is discarded if can be different, if the same (a table) by the link layer header to the payload of fixed length separated, then depending on the type delivered to the upper layer; false u disposed transmitted to the IP network layer protocol, in accordance with the total length of the header and payload separation, according to the header 8 protocol to transfer data to an upper layer; assumed that the transmission to the transport layer TCP protocol the header length TCP / header basic unit can know the TCP header length, can be a header and payload separation, according to the destination port number to upload data to the upper layer; assumed that the transmission to the HTTP application layer protocol, the HTTP protocol according to a blank line header and separation of the payload, according to the content-length header payload length can be obtained.

In the wide area network data from host A to host B procedure:

A host determines the destination IP address is not in the local area network, to which the data is first sent it to the nearest router. Placing the network, the packet is discarded on other hosts after the first host A To encapsulating data from the application layer to the data link layer; Comparative router after the MAC address of the MAC frame with the score solution, see report header attributes Solutions network layer the destination IP address and subnet mask bitwise comparison of the routing table after the packet encapsulation (adding a new MAC frame) after transmitting data to the next router (NAT technology to achieve time, the MAC source address and destination MAC changes address, destination IP address does not change), until the destination host in the same local area network with a router myself be found by comparing the routing table, this time because only know the IP address of the destination host without knowing its MAC address (MAC address has been due in a variation, and because the network are running until the MAC frame the destination host must MAC address), this time through the ARP protocol IP address of the destination host until the host MAC address, the MAC address of the router knows the MAC encapsulation the frame is then transmitted to host B can decompress packets demultiplexed.

MAC address

1.MAC address is used to identify a node connected to a data link layer;

2. The length 48 and 6 bytes. General hexadecimal number with a colon to represent (for example: 08: 00: 27: 03: fb: 19)

3. Make sure the card can not be modified at the factory, usually the only mac address (mac address of the virtual machine is not real mac address, is simulated, but also allows users to configure the network card mac address)

IP address VSMAC address

IP address describes the overall journey start and end points; each of the MAC address is described in the start and end of a range on the road.

MTU: can be modified, but generally the default values

MTU limit corresponds to the size of the transmission package delivery, this limit is to limit the data links corresponding to different physical layer produced.

1. The data length of an Ethernet frame 46 bytes specified minimum, maximum 1500 bytes; when the ARP packet length byte 46 is insufficient to make up padding bits (PAD) in the back.

2. The maximum value of 1500 called an Ethernet maximum transmission unit (MTU), different network types have different the MTU;

3. that the packet will be fragmented if a packet routed to the Ethernet MTU from the dial-up link, the data packet length is greater than the dial-up link (IP fragmented);

4. Different data link layer is different from a standard MTU.

MTU and MSS relationship: MTU-IP header -TCP header = MSS

Special case: fragmentation is not necessarily in the transport layer, there may be a small router MTU packet fragmentation, or the entire transmission of the road in the final slice reload. But generally not recommended fragmentation, packet loss rate increases.

MTU impact on IP protocol

Transmitting each packet MTU size limit, if the packet size is larger than the MTU IP fragmentation, but increases the loss ratio. When the slice is lost, TCP retransmission can be performed. Generally not recommended fragments is determined by the transport layer.

MTU impact of the UDP protocol

Increased packet loss rate for the entire packet fragmentation is not recommended. However, if the packet loss can be obtained by detecting the 16-bit checksum in the UDP header.

MTU impact on the TCP protocol

** In order to reduce fragmentation, TCP connection is established in the process, the two sides will carry out communications MSS negotiation. * Ideally, the value of the MSS will not be exactly in the IP fragmentation processing in the maximum length (this length is still subject to the MTU of the data link layer), the two sides will ** head when sending TCP SYN MSS value can write their own support, and then select the two sides informed each other of the smaller MSS value as the final MSS, ** MSS value is the 40-byte TCP header variable length options (kind = 2)

ARP protocol: the role of the IP address into a MAC address (must be known at the time because LAN communication MAC address of the destination host)

ARP protocol process: When the router only knows the IP address of the local area network to a host, first broadcasts the MAC address of the router in the LAN, the IP address and the destination host IP address, all hosts in the destination host IP address and its own IP address comparator, If different discarded directly; if the same MAC address is sent to the sender the destination host separately. Thereafter, the router can send data to the destination host. **

Theoretically ARP protocol layer belonging to the link (due to the LAN)

ARP datagram format

Here Insert Picture Description

ARP does not carry data, the operating system of its own internal development.

1. We can see from the ARP packet format payload length of 28 bytes, less than the minimum amount of transmitted MAC frame, it needs to be filled.

2. How will the MAC frame header and payload separated from it? Fixed length

3. how to deliver it to the top? Depending on the type (0806) the MAC header removed frame, the payload (28+ bytes) and ARP deposit layer (of the MAC frame portion, the data link layer).

4.MAC how to distinguish between payload and filling part? Fixed length payload

Specific example using ARP request to fill

Here Insert Picture Description

ARP specific implementation: ARP added after filling out the CRC can be broadcast to the local area network, all hosts to its admissibility, packets are first de-type sub-frame with a view, after the MAC frame cross each host to ARP, in accordance with op determines the MAC frame is a request or response, then the destination IP address and the IP address of comparison, if directly discarded different (in the ARP), if the same is an ARP reply. When the router receives the response, extracting the Ethernet transmitting end position, after the MAC frame encapsulated (again fill requests ARP) sends the IP packet, the last packet demultiplexing destination host solution.

For example the specific use ARP reply to fill

Here Insert Picture Description

ARP cache: ARP router with the destination host will get a temporary maintenance, but it will not be long.

In linux can be obtained by #arp -a command line with their hosts on the same LAN IP address and MAC address of the other hosts, but if a host with your host but did not get through #arp -a in the same local area network its address, by #ping + IP address of the host (corresponding to the host message), then use #arp -a command line can be seen.

 

This article forwarding source article address: https: //blog.csdn.net/weixin_42617262/article/details/88854058

 

Guess you like

Origin www.cnblogs.com/forestsky/p/11025057.html