MAC address table, ARP table, routing table (RIB table/FIB table)
MAC address table
The MAC address table is a network device such as a switch that records the mapping relationship between a MAC address and a port. It represents the port from which the switch has learned a certain MAC address. The switch records this information. When the subsequent switch needs to forward data, it can destination MAC address to forward data according to the MAC address table.
ARP table
The ARP table is a table entry for routers and other network devices to record the correspondence between IP addresses and MAC addresses.
When we need to forward data, we need to know the destination IP address of the other party and also the MAC address of the other party. Under normal circumstances, we will first use the local Check whether there is a MAC address corresponding to the destination IP in the ARP table.
Relationship between RIB and FIB tables
In each router device, two similar tables are usually maintained, which are:
-
Routing Information Base (RIB table, routing table for short)
The routing table is a table generated by the network device according to the routing protocol
-
Forwarding Information Base (Forwarding Information Base), referred to as FIB table, forwarding table
The fib table is a forwarding table generated by a network device based on the routing table
The relationship between RIB and FIB tables:
- The routing table (RIB table) is used to decide routing; the forwarding table is used to forward packets
- Because the core job of a router is to find the best path for each data packet passing through the router. Choose the fastest, best quality, shortest path, ... and other indicators among many paths to select the optimal path, and form a new table with the routes corresponding to the optimal paths to different networks, namely the FIB table (forwarding table) .
- The difference between the fib table and the routing table is that the next hop may not be directly connected in the routing table, but the fib table does not. The fib table iterates through the next hop, avoiding the situation that the next hop is not directly connected.
- The router selects routes through the routing table, and guides the forwarding of packets through the FIB table.
- Each router maintains a local core routing table (that is, the IP routing table of the device), and each routing protocol also maintains its own routing table. The router uses the local core routing table to save the optimal route for decision-making, and is responsible for sending the optimal route to the FIB table, and guides the forwarding of packets through the FIB table. This routing table selects routes based on the priority and metric values of various routing protocols.
- The router uses the local core routing table to save the optimal route for decision-making, and is responsible for sending the optimal route to the FIB table, and guides the forwarding of packets through the FIB table. This routing table selects routes based on the priority and metric values of various routing protocols.
- FIB emphasizes the forwarding routing table, and RIB is used for routing management. This problem is usually understood only with the involvement of dynamic routing protocols. RIP, OSPF, BGP, and ISIS are all dynamic routing protocols. The routes learned by them must first be notified to the RIB table. The RIB table summarizes the routes learned by all routing protocols, and after optimization, the route of the optimal result is added to the FIB table for forwarding. So FIB is a subset of RIB.
Routing table (RIB table)
The routing table is the table entry used by the router to guide how the data packet is forwarded, and records where the next hop to the destination IP goes
Forwarding table (FIB table)
-
After the routing table selects a route, the routing table will deliver the active route to the FIB table. When the packet arrives at the router, it will forward it by looking up the FIB table.
-
Each forwarding item in the FIB table indicates which physical interface or logical interface of the router should be used to send the message to a certain network segment or a certain host, and then it can reach the next router on the path, or no longer go through other routers Delivered to the destination host on the directly connected network.
-
The matching of the FIB table follows the longest matching principle. When searching the FIB table, the destination address of the message and the mask of each entry in the FIB are subjected to a bitwise "logical AND", and the obtained address matches the network address in the FIB entry. Finally, a FIB entry with the longest match is selected to forward the message.
Linux RIB table and FIB table
Note: When there is no multipath for the same route, the RIB table and FIB table are almost equal
RIB table
[luzejia@localhost ~]$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 100 0 0 ens192
10.10.10.0 0.0.0.0 255.255.254.0 U 100 0 0 ens192
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-d84b5901962a
FIB table
[luzejia@localhost ~]$ route -F
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 100 0 0 ens192
10.10.10.0 0.0.0.0 255.255.254.0 U 100 0 0 ens192
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-d84b5901962a