LVS-depth understanding of articles: network communication theory (b) ARP protocol communication between the local area network


Previous article I described how a simple data packet is forwarded on the LAN, a quick review process:

  • Host encapsulated data packet, which contains 请求体, 源IP, 目标IPand 源MAC地址other information.
  • After the packet switch, the switch sends the packet to the router to parse.
  • The packet router 目标IPwith routing table subnet mask 逻辑与operation to obtain the target segment, and forwards the target segment matches the gateway router.

I said at the end of the article, if the switch has been recorded in the mapping of all the devices on your LAN, then the message will not be forwarded through a router, then the switch is how to do it? We come to know a protocol -ARP协议

What is the ARP protocol

First, ARP协议the three-tier network protocol, which is based on the network protocol layer. In the network layer protocol, the data packets will only focus IP地址and MAC地址information, LVSin fact, is based on a three-layer network protocol (actually a pseudo-three, because the handshake LVS will peeping packets).

Vernacular terms, ARPthe agreement is used to broadcast a unified LAN segment of the machine IPand MACinformation.

Workflow ARP protocol

Or in the previous local area network topology as an example:
Here Insert Picture Description
If the host 10wants and 11communicate, go through the following steps:

  • Create an ARP protocol format packets, packet destination MAC address is all F, IP-11 target.
  • Message to the switch, which is found in a packet of ARP protocol, this message will be broadcast through the port own records.
  • 11 and 12 both hosts receives the ARP packet, finding the target 12 with its own local IP IP do not match, the packet will be discarded; 11 findings are consistent with the local IP, own MAC address is encapsulated into packets of the protocol ARP message, is sent to the switch.
  • 10 host receiving the packet, the MAC address 11 of the cache to the local ARP list.

It is noted that, in the third step, the host 11will be its own MAC address encapsulated ARP packets, is actually a the original packet process of being replaced, as follows:
Here Insert Picture Description
switch the communication of these messages a second to go in process, keep track of their relationships with the connected port mapping host:
Here Insert Picture Description
for example on connection of the switch of FIG. 3 hosts, corresponding 1,5,7 port respectively. The first host sends packets through the switch time, MAC address, switch port corresponding to the host will be recorded, so the communication times, the switch can be provided inside the respective ability to inform the host node outward path. Since only records the switch MAC address, all switches are Layer 2 protocol devices.

Next article we will enter the Internet communications, the Internet proved how two hosts are communicating and introduces NAT, DR, TUNand other knowledge.

Released five original articles · won praise 0 · Views 491

Guess you like

Origin blog.csdn.net/TheRainManFSA/article/details/105411543