Three tables in network transmission, including MAC address table, ARP cache table, and route table

Source: Internet
Author: User

I. Detailed description of the MAC address table

Speaking of the MAC address table, you have to talk about the working principle of the switch, because the switch forwards data frames according to the MAC address table. There is a table in the vswitch that records the relationship between the MAC address of the LAN host and the switch interface. The vswitch is responsible for transmitting data frames to the specified host according to this table.

How a vswitch works

After receiving the data frame, the switch first records the source MAC address and corresponding interfaces in the data frame to the MAC table, then, the system checks whether the MAC table contains information about the target MAC address in the data frame. If yes, the data frame is sent (that is, unicast) according to the corresponding interface recorded in the MAC table ), if no data frame exists, the data frame is sent (that is, broadcast) from the non-accept interface ).

For example: describes in detail the process of data frame transmission by the switch.

650) this. width = 650; "title =" 1.jpg" src = "http://www.bkjia.com/uploads/allimg/131227/01020S022-0.jpg"/>

1) host A sends A data frame with the source MAC address and the target MAC address as host B to the switch.

2) After receiving the data frame, the switch first records the source MAC address and the corresponding interface (interface: f 0/1) in the data frame to the MAC address table.

3) then, the switch checks whether there is information about the target MAC address in the data frame in its MAC address table. If so, the switch sends the information from the interface recorded in the MAC address table. If not, the data frame is sent from all interfaces of the non-receiving interface (except the f 0/1 interface ).

4) at this time, all hosts in the LAN will receive the data frame, but only host B will respond to the broadcast when it receives the data frame and respond to a data frame, this data frame contains the MAC address of host B.

5) when the switch receives the data frame responded by host B, it also records the source MAC address (that is, the MAC address of host B) in the data frame, when host A communicates with host B, the switch implements unicast based on the records in the MAC address table.

For example, how do I record the MAC address table of a vswitch when multiple vswitches are interconnected in a LAN?

650) this. width = 650; "title =" 2.jpg" src = "http://www.bkjia.com/uploads/allimg/131227/01020Q331-1.jpg"/>

1) host A sends A data frame from the source MAC address host C to the switch.

2) After receiving the data frame, switch 1 learns the source MAC address and checks the MAC address table. If no record of the target MAC address is found, the data frame is broadcast, both host B and vswitch 2 receive this data frame.

3) vswitch 2 after receiving the data frame, it also records the source MAC address and the corresponding interface in the data frame to the MAC address table and checks its MAC address table, if a record with no target MAC address is found, the data frame is broadcasted.

4) After receiving the data frame, host C will respond to the data frame and return a data frame whose source MAC address is its own, in this case, both vswitch 1 and vswitch 1 record the MAC address of host C to their MAC address table and send the data frame to host A in the form of unicast.

5) at this time, the communication between host A and host C is A unicast transmission of data frames. The communication between host B and host C is the same as the above process, therefore, the MAC address table of vswitch 2 records that the MAC addresses of host A and host B correspond to interface f 0/1.

Conclusion: As shown in the above two figures, the vswitch has the function of Dynamically Learning the source MAC address, and one interface of the vswitch can correspond to multiple MAC addresses, however, a MAC address can only correspond to one interface.

Note: The MAC address for vswitch dynamic learning is only valid for S by default. If the MAC address recorded within S does not communicate, this record is deleted.

 

Ii. ARP cache table details

We have explained how the vswitch works. We know that the vswitch communicates through the MAC address, but how do we obtain the MAC address of the target host? In this case, we need to use the ARP Protocol. Each host has an ARP table, which records the correspondence between the host IP address and the MAC address.

ARP: ARP is a network-layer protocol that resolves IP addresses to MAC addresses.

For example, explain in detail how ARP works.

650) this. width = 650; "title =" 3.jpg" src = "http://www.bkjia.com/uploads/allimg/131227/01020Q302-2.jpg"/>

1) if host A wants to send data to host B, host A first checks its ARP cache table to check whether the IP address of host B Corresponds to the MAC address. If yes, the MAC address of host B is encapsulated into the data frame as the source MAC address. If not, host A will send an ARP request, the request's target IP address is the IP address of host B, the target MAC address is the broadcast frame of the MAC address (that is, the FF-FF-FF-FF-FF-FF ), the source IP address and MAC address are the IP address and MAC address of host.

2) When the switch receives the data frame, it finds that the data frame is a broadcast frame. Therefore, the data frame is sent from all interfaces not receiving the data frame.

3) When host B receives the data frame, it verifies whether the IP address is its own and records the ing between host A's IP address and MAC address to its ARP cache table, at the same time, an ARP response will be sent, including its own MAC address.

4) After receiving the response data frame, host A records the ing between host B's IP address and MAC address in its ARP cache table. At this time, the switch has learned the MAC addresses of host A and host B.

 

Route table details

A router is responsible for communication between different networks. It is an important device in today's networks. It can be said that there is no Internet without a router. There is also a table in the vro. This table is called a route table, which records information to different network segments. The information in the route table is divided into direct-connection routes and non-direct-connection routes.

Direct Connection route: The CIDR Block directly connected to the router interface, which is automatically generated by the router.

Non-direct connection route: The CIDR block that is not directly connected to the router interface. This record must be manually added or dynamic routing is used.

Some entries recorded in the routing table need to be manually added (called Static Routing), and some need to test dynamically obtained (called Dynamic Routing ). A directly connected route is a static route.

Vrouters work at the network layer and can recognize logical addresses at the network layer. When an interface of a vro receives a packet, the router reads the network part of the Logical Address of the corresponding destination in the packet, and then searches in the routing table. If the route entry of the target address is found in the routing table, the packet is forwarded to the corresponding interface of the router. If no route entry of the target address is found in the routing table, if the default route is configured, the default route configuration is forwarded to the corresponding interface of the router. If the default route is not configured, the packet is discarded and inaccessibility information is returned. This is the process of data routing.

For example, describes the working principle of a vro in detail.

650) this. width = 650; "title =" 5.jpg" src = "http://www.bkjia.com/uploads/allimg/131227/01020V938-3.jpg"/>

1) HostA encapsulates packets from the upper layer into IP packets at the network layer. The source IP address is itself, and the target IP address is HostB, hostA uses the 24-bit subnet mask configured on the local machine to perform the "and" Operation on the target address, and obtains that the destination address is not the same network segment as the local machine, therefore, packets sent from HostB must be forwarded by gateway route.

2) HostA uses ARP requests to obtain the MAC address of the E0 port of the gateway route A, encapsulates the MAC address of the E0 interface of the router into the target MAC address at the link layer, and the source MAC address is itself.

3) router A can receive data frames from E0, remove the encapsulation of the data link layer, and check whether there are items matching the destination IP address CIDR Block (that is, the IP address CIDR block of 192.168.2.2) in the routing table, send the data recorded in the CIDR Block 192.168.2.0 to the next hop address 10.1.1.2. Therefore, the data is reencapsulated at the E1 port of vroa, the source MAC address is the MAC address of the E1 interface of vroa A, and the encapsulated target MAC address is the MAC address of the E1 interface of vro2 2.

4) When route B receives data frames from Port E1, it also removes the encapsulation of the data link layer, detects the target IP address, and matches the data with the route table, at this time, we find that the destination address CIDR block is the direct connection CIDR Block of the E0 port. Through ARP broadcast, router B obtains the MAC address of HostB. At this time, the data packets are encapsulated on the E0 interface of router B, the source MAC address is the MAC address of the E0 interface of vrob B, and the target MAC address is the MAC address of HostB. After the encapsulation is complete, it is directly sent to HostB from the E0 interface of the router.

5) at this time, HostB will receive data sent from HostA.

Summary: The route table records the path from one network to another. Therefore, the router works according to the route table.

 

After reading the above Article, do you feel that the original data transmission over the network is so complicated! Haha... in fact, these processes are completed by computers themselves, and we need to do very little.

It may not be comprehensive. Please forgive me! I hope to help you.

 

 

This article is from the "initialize" blog, please be sure to keep this source http://cshbk.blog.51cto.com/5685776/1223132

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.