MAC Address table, ARP cache table, and routing table

Source: Internet
Author: User

A: MAC Address Table detailed

When it comes to the MAC address table, you have to say how the switch works because the switch forwards the data frame based on the MAC address table. There is a table in the switch that records the corresponding relationship between the MAC address of the LAN host and the switch interface, and the switch is responsible for transmitting the data frame to the specified host on the basis of this table.

How the Switch works

After the switch receives the data frame, it first records the source MAC address in the data frame and the corresponding interface to the Mac table, and then checks whether there is information about the destination MAC address in the data frame in the Mac table, and if so, sends the data frame according to the corresponding interface recorded in the Mac table (that is, unicast). If not, the data frame is sent out of the non-accepted interface (that is, broadcast).

Such as: detailed explanation of the switch transfer data frame process

1) Host A will send a source MAC address to itself, and the destination MAC address is a data frame for Host B sent to the switch.

2) After the switch receives this data frame, first record the source MAC address and corresponding interface (interface F 0/1) in the data frame to the MAC address table.

3) The switch then checks its MAC address table for information about the destination MAC address in the data frame, and if so, sends it out from the interface recorded in the MAC Address table, and if not, sends the data frame from all interfaces of the non-receiving interface (that is, except for the F 0/1 interface).

4) At this point, all hosts on the LAN receive this data frame, but only Host B responds to the broadcast when it receives the data frame, and responds to a data frame that includes the MAC address of Host B.

5) When the switch receives the data frame that Host B responds to, it also records the source MAC address in the data frame (that is, the MAC address of Host B), and when host A and Host B communicate, the switch implements unicast based on the records in the MAC Address table.

such as: When the LAN has multiple switches interconnection, the Switch MAC Address table is how to record it?

1) Host A sends a source MAC address to itself, and the destination MAC address host C's data frame is sent to the switch

2) After the switch 1 receives this data frame, it learns the source MAC address and checks the MAC address table, discovers the record without the destination MAC address, then broadcasts the data frame, and both Host B and switch 2 receive this data frame.

3) When the switch 2 receives this data frame, it will also record the source MAC address and corresponding interface in the data frame to the MAC Address table, and check its MAC address table to find a record without the destination MAC address, then broadcast this data frame.

4) When the host C receives the data frame, responds to the data frame and replies to a source MAC address for its own data frame, switch 1 and switch 1 will record the MAC address of host C to their MAC address table, and send this data frame to host a in unicast form.

5) At this time, host A and host C communication is a unicast transmission of data frames, Host B and host C communication as described above, so the MAC address table of switch 2 records the MAC address of host A and Host B corresponds to the interface F 0/1.

Summary: From the above two pictures can be seen, the switch has the ability to dynamically learn the source MAC address, and one interface of the switch can correspond to multiple MAC addresses, but a MAC address can only one interface.

Note: The MAC address of switch dynamic learning is only valid for 300S by default, and if there is no communication between the MAC addresses recorded in 300S, this record will be deleted.

Second, the ARP cache table detailed

Above we explain how the switch works, know that the switch is through the MAC address communication, but how do we get the target host MAC address it? At this point we need to use the ARP protocol, there is an ARP table in each host, it records the host's IP address and the corresponding relationship between the MAC address.

ARP protocol: The ARP protocol is the protocol that works at the network layer, and it is responsible for resolving IP addresses to MAC addresses.

Such as: detailed explanation of how ARP works.

1) If host a wants to send data to Host B, host a first checks its own ARP cache table to see if there is a corresponding relationship between the IP address and MAC address of Host B, and if so, the MAC address of Host B is encapsulated in the data frame as the source MAC address. If not, host A sends an ARP request message that the destination IP address of the request is the IP address of Host B, the destination MAC address is the broadcast frame of the MAC address (that is, ff-ff-ff-ff-ff-ff), and the source IP address and MAC address are the IP address and MAC address of host A.

2) When the switch accepts this data frame, it is found that this data frame is a broadcast frame, so this data frame is sent out of all interfaces that are not received.

3) When Host B receives this data frame, it will proofread whether the IP address is its own, and record the IP address of host A and the corresponding relationship of MAC address to its own ARP cache table, and send an ARP reply, including its own MAC address.

4) After receiving the data frame of this response, host A records the corresponding relationship between the IP address and the MAC address of Host B in its own ARP cache table. At this point, the switch has learned the MAC address of host A and Host B.

Detailed routing Table

Routers are responsible for communication between different networks, it is an important device in today's network, it can be said that there is no router on the internet today. There is also a table in the router, which is called the routing table and records information to different network segments. The information in the routing table is divided into direct-attached and non-direct-attached routes.

Direct Connect routing: is a network segment that is directly connected to the router interface and is automatically generated by the router.

Non-direct-connect routing: A network segment that is not directly connected to the router interface, which needs to be added manually or using dynamic routing.

Some of the entries recorded in the routing table need to be manually added (called Static routes), and some tests are dynamically acquired (called Dynamic routing). A direct-attached route belongs to a static route.

The router is working on the network layer, and the logical address can be identified at the network layer. When a router receives a packet on an interface, the router reads the network portion of the logical address of the corresponding destination in the package, and then finds it in the routing table. If a routing entry for the destination address is found in the routing table, the packet is forwarded to the corresponding interface of the router, if the route entry for the destination address is not found in the routing table, if the route configures the default route, the configuration of the Imperial examination default route is forwarded to the corresponding interface of the router, and if no default route is configured, and returns non-reachable information. This is the process of data routing.

For example: Detailed description of how the router works

1) hosta packets from the upper layer into an IP packet at the network level, where the source IP address is itself, the destination IP address is Hostb,hosta will use the native configuration of the 24-bit subnet mask and the destination address for "and" operation, the destination address is not the same network segment, So packets that send HOSTB need to be forwarded by Gateway route A.

2) Hosta obtains the MAC address of the E0 port of Gateway route A through ARP request, and encapsulates the MAC address of the router E0 interface as the destination MAC address at the link layer, 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 if there are any items in the routing table that match the destination IP address network segment (that is, the 192.168.2.2 network segment). According to the data recorded in the routing table to the 192.168.2.0 segment, send to the next hop address 10.1.1.2, so the data is repackaged at the E1 port of Router A, at which point the source MAC address is the MAC address of the E1 interface of Router A, and the destination MAC address of the package is the MAC address of the E1 interface of Router 2.

4) routing B from the E1 port to receive the data frame, the same will be the data link layer of the package removed, the target IP address detection, and the routing table to match, at this time found that the target address of the network segment is exactly the E0 of their own port directly connected network segment, Router B through the ARP broadcast, learned HostB MAC address, At this time the packet is encapsulated again on Router B's E0 interface, the source MAC address is the MAC address of Router B's E0 interface, and the destination MAC address is the MAC address of the HOSTB. The package is then sent directly from the router's E0 interface to HostB.

5) HostB will receive the data sent from Hosta at this time.

Summary: The routing table is responsible for documenting the path of one network to another, so the router works according to the routing table.

Transferred from the Greek network: http://www.educity.cn/net/1284034.html

MAC Address table, ARP cache table, and routing table

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.