A method, apparatus and device for data packet transmission in an FTTR scenario
By introducing an ARP hash table into the FTTR device, the ARP information table and the next-hop table are decoupled, which solves the problem of the rapid increase in the number of ARP entries in the FTTR scenario, improves resource utilization and network performance, and reduces design complexity and cost.
Patent Information
- Application Number
- CN202611618610.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-19
- Publication Date
- 2026-11-17
AI Technical Summary
In FTTR scenarios, as data centers and large enterprise networks expand, the number of ARP entries increases dramatically, leading to a waste of next-hop entry resources and severely impacting network performance and device access.
By introducing an ARP hash table into the FTTR device to record the mapping relationship between the destination IP address and the ARP identifier, the ARP information table and the next-hop table are decoupled, the number of next-hop table entries is reduced, and the ARP identifier is obtained by hash lookup mode instead of direct lookup.
It improves the utilization rate of next-hop entries in FTTR devices, reduces the number of next-hop entries, enhances the performance and scalability of network devices, and reduces design complexity and cost.
Smart Images

Figure CN123123256A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a data packet transmission method, apparatus and equipment in an FTTR (Fiber to the Room) scenario. Background Technology
[0002] After receiving a data packet, a network device (such as a switch or router) queries its routing table based on the destination IP address of the data packet to obtain the next-hop identifier (i.e., Next Hop ID). Using the next-hop identifier, it queries the next-hop table to obtain the path information required to complete the data link layer encapsulation. This path information includes the outgoing interface, VLAN (Virtual Local Area Network), and source MAC (Media Access Control) address, among other things.
[0003] In some scenarios, path information may include the destination MAC address. VLANs, source MAC addresses, and destination MAC addresses can be encapsulated in data packets, and the encapsulated data packets can be sent through the outgoing interface.
[0004] In some scenarios, path information may not include the destination MAC address. Instead, it may include an index pointing to a separate ARP (Address Resolution Protocol) entry, which can be denoted as an ARP identifier. In this case, the destination MAC address can be obtained by querying the ARP table using the ARP identifier in the path information. VLANs, source MAC addresses, and destination MAC addresses can be encapsulated in data packets, and the encapsulated data packets can be sent through the outgoing interface.
[0005] In scenarios where ARP identifiers exist, each ARP entry (also known as an ARP entry) in the ARP information table corresponds to an ARP identifier, and each ARP identifier corresponds to a next-hop entry. In this way, the number of next-hop entries in the next-hop table matches the number of ARP entries in the ARP information table.
[0006] However, with the continuous expansion of data centers, cloud networks, and large enterprise networks, the number of ARP entries that need to be maintained has increased dramatically. When each ARP entry corresponds to one next-hop entry, a large number of next-hop entries also need to be maintained, resulting in a serious waste of next-hop entry resources and low utilization of entry resources.
[0007] For example, with the rapid popularization of FTTR (Fiber to the Room) all-optical networking solutions, the network architecture of homes and small and medium-sized enterprises has undergone significant changes. In an FTTR scenario, a master FTTR device can connect to dozens or even hundreds of slave FTTR devices. The master FTTR device is used to connect to the incoming fiber and is the core device responsible for overall management and routing. Slave FTTR devices are connected to the master FTTR device through fiber optic cables and are extension devices responsible for signal coverage in each room. Each slave FTTR device may also be connected to multiple terminals such as smart TVs, smart home devices, and high-definition cameras.
[0008] In FTTR scenarios, this "multi-master, multi-slave, multi-terminal concurrent" topology leads to a dramatic increase in the number of ARP entries that a single FTTR device (such as a master or slave FTTR device) needs to maintain, which in turn causes a dramatic increase in the number of next-hop entries. When faced with the large demand for ARP entries in FTTR scenarios, the problem of next-hop entry exhaustion is highly likely, resulting in new devices being unable to join the network or network performance degrading. Therefore, how to support efficient ARP resolution and forwarding for a large number of terminals in FTTR scenarios with limited next-hop entry resources has become a key bottleneck restricting the performance of FTTR devices. Summary of the Invention
[0009] This application provides a data packet transmission method in a fiber-to-the-room (FTTR) scenario, applied to FTTR equipment in an FTTR scenario, the method comprising: The next-hop identifier is obtained by querying the routing table using the destination IP address of the received data packet; the next-hop identifier is then used to query the next-hop table to obtain the mode flag and path information. When the mode flag is set to a first value, which represents a hash lookup mode, the ARP identifier is obtained by querying the ARP hash table using the destination IP address. The destination MAC address is obtained by querying the ARP information table using the ARP identifier. The data packet is sent based on the path information and the destination MAC address.
[0010] This application provides a data packet transmission device for a fiber-to-the-room (FTTR) scenario, applicable to FTTR equipment in an FTTR scenario, the device comprising: The acquisition module is used to query the routing table using the destination IP address of the received data packet to obtain the next-hop identifier; query the next-hop table using the next-hop identifier to obtain the mode flag and path information; if the mode flag is a first value, the first value represents a hash lookup mode, then query the ARP hash table using the destination IP address to obtain the ARP identifier; query the ARP information table using the ARP identifier to obtain the destination MAC address. The sending module is used to send the data packet based on the path information and the destination MAC address.
[0011] This application provides a computer program product, which includes a computer program that, when executed by a processor, implements the data packet transmission method in the FTTR scenario described above.
[0012] This application provides an FTTR device, which includes a processor and a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the data packet transmission method in the FTTR scenario described above.
[0013] This application provides a machine-readable storage medium storing machine-executable instructions that can be executed by a processor; wherein the processor is used to execute the machine-executable instructions to implement the data packet transmission method in the FTTR scenario described above.
[0014] As can be seen from the above technical solutions, in this embodiment, after receiving a data packet, the routing table is queried using the destination IP address of the data packet to obtain the next-hop identifier; the next-hop table is queried using the next-hop identifier to obtain the mode flag and path information; if the mode flag is a first value, which represents a hash lookup mode, the ARP hash table is queried using the destination IP address to obtain the ARP identifier; the ARP information table is queried using the ARP identifier to obtain the destination MAC address; and the data packet is sent based on the path information and the destination MAC address. Based on this, by maintaining an ARP hash table and recording the mapping relationship between the destination IP address and the ARP identifier, it is not necessary to record the ARP identifier in the next-hop table, thus decoupling the ARP information table from the next-hop table. For each ARP entry in the ARP information table, the ARP entry does not need to correspond to a next-hop entry, thereby reducing the number of next-hop entries maintained by the FTTR device, saving the resources of the FTTR device's next-hop entries, and improving the resource utilization rate of the FTTR device's next-hop entries. Attached Figure Description
[0015] Figure 1This is a flowchart illustrating a data packet transmission method in an FTTR scenario according to one embodiment of this application. Figure 2 This is a schematic diagram of a data packet transmission process according to one embodiment of this application; Figure 3 This is a schematic diagram illustrating multiple ARP requests sharing a next-hop forwarding in one embodiment of this application; Figure 4 This is a flowchart illustrating a data packet transmission method in an FTTR scenario according to one embodiment of this application. Figure 5 This is a schematic diagram of the structure of a data packet transmission device in an FTTR scenario according to one embodiment of this application; Figure 6 This is a hardware structure diagram of an FTTR device according to one embodiment of this application. Detailed Implementation
[0016] This application proposes a data packet transmission method in an FTTR scenario. This method can be applied to FTTR devices in an FTTR scenario. See [link to relevant documentation]. Figure 1 The diagram shown illustrates a data packet transmission method in an FTTR scenario. This method may include: Step 101: Query the routing table using the destination IP address of the received data packet to obtain the next-hop identifier, that is, obtain the next-hop identifier corresponding to the destination IP address.
[0017] Step 102: Query the next-hop table using the next-hop identifier to obtain the pattern flag and path information. The pattern flag can be either a first value or a second value. The first value indicates a hash lookup mode, meaning the ARP identifier does not exist in the next-hop table. The second value indicates a next-hop lookup mode, meaning the ARP identifier exists in the next-hop table.
[0018] Step 103: If the mode flag is set to the first value, the ARP hash table is queried through the destination IP address to obtain the ARP identifier. The ARP identifier represents an index pointing to an independent ARP table entry.
[0019] Step 104: Query the ARP information table using the ARP identifier to obtain the destination MAC address.
[0020] Step 105: Send a data packet based on the path information and the destination MAC address.
[0021] In one example, after querying the next-hop table using the next-hop identifier to obtain the pattern flag and path information, if the pattern flag is at its second value, the ARP identifier corresponding to the next-hop identifier can be retrieved from the next-hop table. The destination MAC address is then obtained by querying the ARP information table using the ARP identifier. Data packets are then sent based on the path information and the destination MAC address.
[0022] For example, path information includes the outgoing interface, VLAN, and source MAC address; sending data packets based on path information and destination MAC address includes: encapsulating the data packet with VLAN, source MAC address, and destination MAC address to obtain the modified data packet; and sending the modified data packet through the outgoing interface.
[0023] In one example, the process of generating the ARP hash table and the ARP information table may include: after receiving an ARP packet (such as an ARP request packet or an ARP reply packet) sent by the sending device, obtaining the IP address and MAC address of the sending device from the ARP packet, and generating an ARP identifier corresponding to the IP address; recording the mapping relationship between the ARP identifier and the MAC address in the ARP information table; and recording the mapping relationship between the IP address and the ARP identifier in the ARP hash table.
[0024] In one example, recording the mapping relationship between an IP address and an ARP identifier in an ARP hash table can include: performing a hash operation on the IP address using a target hash algorithm to obtain a first hash value; determining a first hash table entry corresponding to the first hash value from the ARP hash table; and if there is no hash collision in the first hash table entry, recording the mapping relationship between the IP address and the ARP identifier in the first hash table entry.
[0025] In one example, after determining the first hash table entry corresponding to the first hash value from the ARP hash table, if the first hash table entry has a hash collision, then recording the mapping relationship between that IP address and that ARP identifier in the first hash table entry is prohibited. Here, a hash collision in the first hash table entry means that the first hash table entry has already recorded the mapping relationship between other IP addresses and ARP identifiers; no hash collision in the first hash table entry means that the first hash table entry has not recorded the mapping relationship between other IP addresses and ARP identifiers.
[0026] In one example, retrieving the ARP identifier from the ARP hash table using the destination IP address can include: performing a hash operation on the destination IP address using the target hash algorithm to obtain a second hash value; determining the second hash table entry corresponding to the second hash value from the ARP hash table; and retrieving the ARP identifier corresponding to the destination IP address from the second hash table entry. Specifically, if the second hash table entry includes a mapping relationship between the destination IP address and the ARP identifier, then the ARP identifier corresponding to the destination IP address is obtained from the second hash table entry.
[0027] In one example, the process of generating a next-hop table may include: obtaining the next-hop identifier, the destination IP address corresponding to the next-hop identifier, and the ARP identifier corresponding to the next-hop identifier; querying the ARP hash table using the destination IP address; if the ARP hash table contains an ARP identifier corresponding to the destination IP address, then the next-hop identifier, path information, and pattern flag are recorded in the next-hop table, with the pattern flag set to the first value; if the ARP hash table does not contain an ARP identifier corresponding to the destination IP address, then the next-hop identifier, path information, pattern flag, and ARP identifier are recorded in the next-hop table, with the pattern flag set to the second value.
[0028] As can be seen from the above technical solutions, in this embodiment, after receiving a data packet, the routing table is queried using the destination IP address of the data packet to obtain the next-hop identifier; the next-hop table is queried using the next-hop identifier to obtain the mode flag and path information; if the mode flag is a first value, which represents a hash lookup mode, the ARP hash table is queried using the destination IP address to obtain the ARP identifier; the ARP information table is queried using the ARP identifier to obtain the destination MAC address; and the data packet is sent based on the path information and the destination MAC address. Based on this, by maintaining an ARP hash table and recording the mapping relationship between the destination IP address and the ARP identifier, it is not necessary to record the ARP identifier in the next-hop table, thus decoupling the ARP information table from the next-hop table. For each ARP entry in the ARP information table, the ARP entry does not need to correspond to a next-hop entry, thereby reducing the number of next-hop entries maintained by the FTTR device, saving the resources of the FTTR device's next-hop entries, and improving the resource utilization rate of the FTTR device's next-hop entries.
[0029] The technical solutions described above in the embodiments of this application will be explained below in conjunction with specific application scenarios.
[0030] Packet forwarding based on destination IP address is a core function of network devices. After receiving a data packet, the network device queries the routing table based on the destination IP address of the data packet to obtain the next-hop identifier. Using the next-hop identifier, it then queries the next-hop table to obtain the path information required to complete data link layer encapsulation. This path information includes the outgoing interface, VLAN, and source MAC address, among other things.
[0031] Path information can include the destination MAC address. You can encapsulate a data packet with a VLAN, source MAC address, and destination MAC address, and then send the encapsulated data packet through the outgoing interface. Alternatively, the path information may not include the destination MAC address, but it can include an ARP identifier. In this case, you can also query the ARP table using the ARP identifier to obtain the destination MAC address. You can encapsulate a data packet with a VLAN, source MAC address, and destination MAC address, and then send the encapsulated data packet through the outgoing interface.
[0032] See Figure 2 The diagram illustrates the data packet transmission process. The network device queries its routing table based on the destination IP address of the data packet to obtain the next-hop identifier. It then queries the next-hop table using the next-hop identifier to obtain the path information. This path information includes the destination MAC address; alternatively, it may include an ARP identifier instead. The destination MAC address is then obtained by querying the ARP table using the ARP identifier. In summary, the destination MAC address can be determined.
[0033] For scenarios where path information includes ARP identifiers, each ARP entry in the ARP information table corresponds to one ARP identifier, and each ARP identifier corresponds to one next-hop entry. Therefore, the number of next-hop entries in the next-hop table matches the number of ARP entries in the ARP information table.
[0034] However, with the continuous expansion of data centers, cloud networks, and large enterprise networks, the number of ARP entries that need to be maintained has increased dramatically. When each ARP entry corresponds to one next-hop entry, a large number of next-hop entries also need to be maintained, resulting in a serious waste of next-hop entry resources and low utilization of entry resources.
[0035] For example, with the rapid popularization of FTTR all-optical networking solutions, the network architecture of homes and small and medium-sized enterprises has undergone significant changes. In an FTTR scenario, a master FTTR device (which can be the main gateway in an FTTR scenario) can connect to dozens or even hundreds of slave FTTR devices (which can be the slave gateways in an FTTR scenario). The master FTTR device is used to connect to the incoming fiber and is the core device responsible for overall management and routing. The slave FTTR devices are connected to the master FTTR device through fiber optic cables and are extension devices responsible for signal coverage in each room. Each slave FTTR device may also be connected to multiple terminals such as smart TVs, smart home devices, and high-definition cameras.
[0036] In FTTR scenarios, this "multi-master, multi-slave, multi-terminal concurrent" topology leads to a dramatic increase in the number of ARP entries that a single FTTR device (such as a master or slave FTTR device) needs to maintain, which in turn causes a dramatic increase in the number of next-hop entries. When faced with the large demand for ARP entries in FTTR scenarios, the problem of next-hop entry exhaustion is highly likely, resulting in new devices being unable to join the network or network performance degrading. Therefore, how to support efficient ARP resolution and forwarding for a large number of terminals in FTTR scenarios with limited next-hop entry resources has become a key bottleneck restricting the performance of FTTR devices.
[0037] In summary, when each ARP entry (also known as an ARP table entry, i.e., a unique IP address-MAC address mapping) corresponds to a next-hop entry, even if these ARP entries belong to the same subnet and have the exact same forwarding attributes such as outgoing interface, VLAN, source MAC address, and quality of service (e.g., DSCP (Differentiated Services Code Point)), and only the destination IP address and destination MAC address are different, these ARP entries cannot share the same next-hop entry.
[0038] In the above approach, next-hop table resources are severely wasted: a large number of next-hop table entries are occupied by duplicate ARP entries that differ only in destination IP address, consuming table resources that could be used for storing complex routing, tunnel encapsulation, and other advanced functions. Furthermore, the design challenges are significant: to achieve large-scale ARP support, the capacity of the next-hop table needs to be designed according to the maximum ARP size, which significantly increases memory (such as SRAM) area, power consumption, and cost, resulting in high design complexity and uneconomical practices. In addition, flexibility is poor: the resource allocation of next-hop table entries is fixed and cannot be dynamically adjusted according to actual network service requirements (such as the ratio of ARP, tunnels, and policy routing). In summary, this approach suffers from low resource utilization, poor scalability, and high cost.
[0039] To address the above findings, this application proposes a data packet transmission method for FTTR scenarios. This method can be applied to FTTR devices, which can be network devices such as switches or routers, or other types of devices. It supports data packet forwarding of large-scale ARP entries. In subsequent embodiments, a network device will be used as an example for illustration. In this embodiment, by decoupling ARP information from path information and introducing an independent, flexibly configurable outbound query phase, massive ARP entries no longer occupy the resources of next-hop entries, thereby greatly improving the utilization rate of entry resources, design flexibility, and support for large-scale networks.
[0040] In this embodiment, the actions of deciding how to forward (path information) and deciding who to encapsulate the data packet (destination MAC address) are separated in time and space. In the inbound direction, the route and next hop are looked up based on the destination IP address, only common forwarding attributes (egress interface, VLAN, source MAC address, etc.) are obtained, and the data packet is scheduled to the outbound queue. In the outbound direction, before the data packet leaves the network device, a separate outbound ARP information table designed specifically for massive ARP requests can be queried based on the destination IP address to obtain the final destination MAC address. With this architecture, a subnet (one route) only needs one next-hop entry to serve any number of hosts within that subnet.
[0041] In this embodiment, a routing table, a next-hop table, an ARP hash table, and an ARP information table may be involved. Each entry in the routing table can be called a routing table entry (or routing entry), each entry in the next-hop table can be called a next-hop table entry (or next-hop entry), each entry in the ARP hash table can be called a hash table entry (or hash entry), and each entry in the ARP information table can be called an ARP entry (or ARP entry). The contents and generation process of the routing table, next-hop table, ARP hash table, and ARP information table are described below.
[0042] The routing table, also known as the Routing Information Base (RIB), stores path information pointing to a specific network address, providing a basis for data packet forwarding decisions.
[0043] Each entry in the routing table can include one or more of the following fields: Destination / Mask: Contains the destination IP address and subnet mask, which together identify the destination network segment or specific host of the data packet. Next Hop Address: Indicates the next network device the data packet needs to be forwarded to in order to reach its destination network. Interface: Specifies the physical or logical interface from which the network device should send the data packet out. Preference: Determines which route is preferred when multiple routes reach the same destination address. Cost / Metric: Measures the cost of a path, such as hop count, bandwidth, and latency. When multiple routes have the same preference, the path with the lowest cost / metric becomes the optimal route. Additionally, it may involve Quality of Service (QoS), route filtering policies, etc.
[0044] Regarding the routing table generation process, directly connected routes are automatically discovered by the network device's own link-layer protocol. When a network device's interface is configured with an IP address and enabled, a route to the network containing that interface is automatically generated. Static routes are manually configured by the network administrator based on the network topology, using command lines or other methods. Static routes explicitly specify the path that data packets take to reach their destination address. Dynamic routes are automatically learned and generated by network devices running dynamic routing protocols (such as OSPF, BGP, RIP, etc.). Network devices exchange network topology information and calculate the best path to each destination address based on specific routing algorithms, thereby automatically building and updating the routing table.
[0045] The ARP Information Table is a data structure stored in the memory of a network device. It stores the mapping relationship between ARP identifiers (ARP IDs) and destination MAC addresses, providing address resolution for frame encapsulation at the data link layer. The ARP Information Table can be an SRAM (Static Random Access Memory) table.
[0046] The query key for the ARP information table is the ARP identifier. An ARP identifier is a specific index value assigned by a network device to the communication peer, used to uniquely identify an ARP entry within the device. By storing the mapping between ARP identifiers and destination MAC addresses in the ARP information table, the binding relationship between IP addresses and MAC addresses is decoupled. This facilitates fast indexing of MAC addresses using fixed identifiers in scenarios such as virtualization, multiple network planes, or dynamic address changes, rather than indexing MAC addresses using IP addresses.
[0047] Each ARP entry in the ARP information table can include one or more of the following fields: ARP Identifier: A unique internal index value assigned by the network device to the communication peer, serving as the primary key of this ARP entry. There is a one-to-one correspondence or mapping between ARP identifiers and IP addresses, but the ARP entry itself does not directly store IP addresses. Destination MAC Address: The physical address of the network device corresponding to the ARP identifier, used for frame encapsulation at the data link layer and Layer 2 forwarding. Entry Type: Indicates the source of this ARP entry, such as Dynamic or Static.
[0048] The ARP identifier is an internal index value maintained locally by a network device to uniquely identify an address resolution relationship. The ARP identifier acts as a key, allowing for quick retrieval of the corresponding destination MAC address. The ARP identifier is not the IP address itself, but rather a specific identifier assigned to a communication peer upon detection. The generation method of the ARP identifier depends on the specific implementation of the network device. For example, there are several methods: Incrementing numeric indexing: The network device maintains a globally incrementing counter. Each time a new communication peer is learned, the counter is incremented and the identifier is assigned to that peer as its ARP identifier. Hash value indexing: The network device performs a hash calculation on the communication peer's IP address (or a combination of the IP address and other parameters such as VLAN ID and interface index), and uses the resulting hash value as the ARP identifier. Hardware resource indexing: The network device directly uses the hardware resources associated with the communication peer (such as the network interface card receive queue number, DMA channel number, CPU core number, etc.) as the ARP identifier.
[0049] The generation process of the ARP information table can be achieved through dynamic learning. Network devices automatically learn and generate ARP entries based on ARP packets. For example, when a network device receives an ARP request packet, it assigns an ARP identifier to the destination IP address in the request packet and records the mapping between the ARP identifier and the destination MAC address in the request packet in the ARP table entry. Similarly, when a network device receives an ARP reply packet, it assigns an ARP identifier to the destination IP address and records the mapping between the ARP identifier and the destination MAC address in the reply packet. Finally, when a network device receives a gratuitous ARP packet, it assigns an ARP identifier to the destination IP address and records the mapping between the ARP identifier and the destination MAC address in the gratuitous ARP packet.
[0050] ARP information tables can be generated using static configuration, meaning that network administrators can manually specify the mapping relationship between ARP identifiers and destination MAC addresses through command lines, management interfaces, or configuration files.
[0051] ARP information tables can be generated by other protocols. That is, network devices indirectly obtain the destination IP address and destination MAC address of the communication peer through other protocols (such as NDP (Neighbor Discovery Protocol), DHCP (Dynamic Host Configuration Protocol), routing protocols, etc.), assign an ARP identifier to the destination IP address, and then record the mapping relationship between the ARP identifier and the destination MAC address in the ARP table entry.
[0052] In summary, after receiving an ARP packet from the sending device (i.e., the communication peer), the network device obtains the IP address and MAC address of the sending device from the ARP packet, generates an ARP identifier corresponding to the IP address, and records the mapping relationship between the ARP identifier and the MAC address in the ARP information table.
[0053] An ARP hash table is a data structure stored in the memory of a network device. It's a hash table-based structure for storing address resolution information. The ARP hash table stores the mapping between IP addresses (i.e., the destination IP address in an ARP packet) and ARP identifiers, providing network devices with efficient address resolution information retrieval capabilities.
[0054] For example, unlike the ARP information table, the ARP hash table determines the storage location of entries by performing hash operations on IP addresses, thereby achieving fast lookup, insertion and deletion operations with O(1) time complexity, significantly improving address resolution efficiency, and is especially suitable for high-throughput, large-scale network device scenarios.
[0055] For example, an ARP hash table can be an outbound ARP hash lookup engine located on each outbound interface or inbound processing pipeline. The key of the ARP hash table is the destination IP address in the ARP packet (corresponding to the destination IP address in the data packet), and the value of the ARP hash table is an ARP identifier. The ARP hash table uses a hash table structure, supports O(1) time complexity lookups, and is specifically designed for efficiently managing the mapping relationship between massive IP addresses and ARP identifiers, and for directly outputting the ARP identifier corresponding to an IP address.
[0056] In one example, a network device can pre-allocate a storage area, and the ARP hash table (this storage area) can be designed in a shared mode. When the demand for the ARP hash table is small, the storage area can be allocated to other entries, such as to the entries of tunnel services.
[0057] For example, a network device allocates a fixed-size storage area from system memory specifically for storing the ARP hash table. This storage area has contiguous physical addresses, and its size is set according to actual needs, such as 64KB, 128KB, 512KB, or 1MB. This storage area is designed in a shared mode, meaning it is not permanently dedicated to the ARP hash table. Instead, multiple service modules (such as ARP modules, tunneling modules, routing modules, ACL modules, etc.) are allowed to dynamically request and actively release part or all of the space in this storage area according to actual needs. Within this storage area, it is logically divided into multiple storage blocks, each with a fixed size (such as 64 bytes, 128 bytes, or 256 bytes), serving as the smallest unit of storage allocation. Each entry in the ARP hash table occupies one or more contiguous storage blocks.
[0058] When ARP demand is high, the storage area is allocated solely to the ARP hash table, meaning the ARP hash table completely or almost entirely occupies the storage area, ensuring address resolution performance and meeting high-concurrency communication requirements. When ARP demand is low, the storage area can be allocated to other services; that is, if the number of valid entries in the ARP hash table is far less than the hash table's capacity, other services can also occupy the storage area. Based on this, a portion of the storage area occupied by the ARP hash table can be proactively released and reallocated to other service modules. For example, it can be allocated to tunnel entries (used to store encapsulation information for VPN tunnels such as IPsec, GRE, and VXLAN); to routing entries (used to store newly added dynamic routing information); to ACL entries (used to store access control policy rules); and to session entries (used to store NAT sessions or firewall connection information).
[0059] In one example, each hash table entry in the ARP hash table may include one or more of the following fields: IP address: The IP address serves as the key of the hash table entry, i.e., the destination IP address of the sending device carried in the ARP message; ARP identifier: A unique internal index value assigned by the network device to each communication peer, which serves as the value of the hash table entry and forms a one-to-one mapping relationship with the IP address.
[0060] Regarding the generation process of the ARP hash table, a dynamic learning approach is adopted. Network devices automatically learn and generate ARP hash tables based on ARP packets. For example, when a network device receives an ARP request packet, it assigns an ARP identifier to the destination IP address in the ARP request packet and records the mapping relationship between the destination IP address and the ARP identifier in the ARP hash table. When a network device receives an ARP reply packet, it assigns an ARP identifier to the destination IP address in the ARP reply packet and records the mapping relationship between the destination IP address and the ARP identifier in the ARP hash table. When a network device receives a gratuitous ARP packet, it assigns an ARP identifier to the destination IP address in the gratuitous ARP packet and records the mapping relationship between the destination IP address and the ARP identifier in the ARP hash table.
[0061] ARP hash tables can be generated using static configuration. This means that network administrators can manually specify the mapping relationship between ARP identifiers and destination IP addresses through command lines, management interfaces, or configuration files, and then record the mapping relationship between the destination IP address and the ARP identifier in the ARP hash table.
[0062] ARP hash tables can be generated by other protocols. That is, network devices indirectly obtain the destination IP address and destination MAC address of the communication peer through other protocols, assign an ARP identifier to the destination IP address, and then record the mapping relationship between the destination IP address and the ARP identifier in the ARP hash table.
[0063] In summary, after receiving an ARP packet from the sending device (i.e., the communication peer), the network device obtains the IP address and MAC address of the sending device from the ARP packet, generates an ARP identifier corresponding to the IP address, and records the mapping relationship between the IP address and the ARP identifier in the ARP hash table.
[0064] In one example, when recording the mapping relationship between an IP address and an ARP identifier in the ARP hash table, the network device can use a target hash algorithm to hash the IP address to obtain a first hash value; then, it determines the first hash table entry corresponding to the first hash value from the ARP hash table. If the first hash table entry does not have a hash collision, the mapping relationship between the IP address and the ARP identifier can be recorded in the first hash table entry. If the first hash table entry has a hash collision, recording the mapping relationship between the IP address and the ARP identifier in the first hash table entry is prohibited. A hash collision in the first hash table entry means that the first hash table entry has already recorded the mapping relationship between other IP addresses and ARP identifiers; no hash collision in the first hash table entry means that the first hash table entry has not recorded the mapping relationship between other IP addresses and ARP identifiers.
[0065] For example, the target hash algorithm can be configured according to actual needs, such as CRC32 cyclic redundancy check algorithm, MurmurHash3 non-encryption hash algorithm, etc., and there is no restriction on the type of target hash algorithm.
[0066] For example, when a network device performs a modulo operation on the first hash value (i.e., takes the remainder of the number of buckets N in the ARP hash table), the result can be the position index of the first hash table entry in the ARP hash table. In other words, the hash table entry corresponding to this position index can be the first hash table entry corresponding to the first hash value.
[0067] For example, a network device can check the current state of the first hash table entry to determine if it is already in use. If the first hash table entry is empty, meaning it currently does not record a mapping between an IP address and an ARP identifier, then the first hash table entry is determined to have no hash collision. If the first hash table entry is already in use, meaning it currently records a mapping between an IP address and an ARP identifier, the network device further determines whether the recorded IP address is the same as the IP address to be recorded. If yes, it indicates that the IP address already has a corresponding ARP identifier. If no, it is determined that the first hash table entry has a hash collision.
[0068] The next hop table is a data structure stored in the memory of a network device. It stores the mapping relationship between the next hop identifier and path information, which may include VLAN, source MAC address, and outgoing interface. The next hop table directly determines the forwarding path of each data packet, providing a fast lookup capability for outgoing interface and next hop information for Layer 3 forwarding of data packets, thereby guiding the correct forwarding of data packets to the next hop device.
[0069] Each next-hop entry in the next-hop table can include one or more of the following fields: Next-hop ID: The next-hop ID serves as the index of the next-hop entry, representing the next hop required to reach the destination network. It uniquely identifies a next-hop forwarding record and acts as the primary key for queries. Source MAC Address: The source MAC address entered in the Layer 2 header when this network device sends a data packet to the next-hop device; this is the MAC address of the network device's outgoing interface. VLAN (VLAN ID): The VLAN to which the data packet belongs when this network device sends the data packet to the next-hop device. Outgoing Interface: The physical or logical interface used by this network device when sending the data packet to the next-hop device, such as GE0 / 0 / 1, VLAN interface, Tunnel interface, etc. Destination MAC Address: The MAC address corresponding to the next-hop device. The destination MAC address is optional; in this embodiment, the destination MAC address is not included in the next-hop entry.
[0070] The generation process of the next-hop table can be triggered by the routing table. Specifically, when a network device generates a route entry (routing table entry) in the routing table through a directly connected route, static configuration, or dynamic routing protocol, it obtains the destination IP address and next-hop identifier from that route entry, triggering the addition of a new entry (next-hop table entry) in the next-hop table.
[0071] Network devices can obtain the outgoing interface corresponding to the next-hop identifier and use the MAC address of that outgoing interface as the source MAC address in the next-hop table entry. The network device determines the corresponding VLAN identifier based on the VLAN configuration associated with that outgoing interface, and this VLAN identifier is used as the VLAN in the next-hop table entry.
[0072] Referring to the above embodiments, for the destination IP address in the routing entry, an ARP identifier can also be assigned to the destination IP address, and this ARP identifier can be used as the ARP identifier corresponding to the next-hop identifier. In summary, the network device can obtain the next-hop identifier, the destination IP address corresponding to the next-hop identifier, and the ARP identifier corresponding to the next-hop identifier.
[0073] Network devices can query the ARP hash table using the destination IP address. If an ARP identifier corresponding to the destination IP address already exists in the ARP hash table, the network device adds a next-hop entry to the next-hop table. This next-hop entry records the next-hop identifier, path information (source MAC address, VLAN, and outgoing interface), and a mode flag, with the mode flag set to its first value (e.g., 0). In the case of no ARP identifier, the next-hop entry does not record the ARP identifier; that is, the next-hop entry does not contain an ARP identifier.
[0074] If the ARP hash table does not contain an ARP identifier corresponding to the destination IP address (e.g., a hash collision occurs, resulting in the destination IP address and ARP identifier not being recorded in the ARP hash table), the network device adds a next-hop entry to the next-hop table. This next-hop entry records the next-hop identifier, path information (source MAC address, VLAN, and outgoing interface), a mode flag, and the ARP identifier (the ARP identifier corresponding to the next-hop identifier), with the mode flag set to the second value (e.g., 1). In this case, the ARP identifier is recorded in the next-hop entry, meaning the ARP identifier exists in the next-hop entry.
[0075] During the above process, a mode flag bit can be added to the next-hop table entry. This mode flag bit, also known as the ARP processing mode (arp_mode) flag bit (e.g., 1 bit), can be either the first value or the second value. If the mode flag bit is the first value (e.g., 0), then the first value indicates a hash lookup mode. The hash lookup mode indicates that the ARP identifier does not exist in the next-hop table, thus indicating that the ARP identifier needs to be obtained based on the ARP hash table, and the ARP identifier in the next-hop table is invalid (does not exist).
[0076] If the mode flag is the second value (e.g., 1), then the second value indicates the next-hop lookup mode. The next-hop lookup mode indicates that there is an ARP identifier in the next-hop table, thus indicating that the ARP identifier needs to be obtained based on the next-hop table. The ARP identifier in the next-hop table is valid and used to directly index the ARP information table.
[0077] In summary, network devices record the next-hop identifier, path information, and mode flag in the next-hop table entry, with the mode flag set to the first value. Alternatively, they record the next-hop identifier, path information, mode flag, and ARP identifier in the next-hop table entry, with the mode flag set to the second value.
[0078] Considering that multiple destination IP addresses in the routing table may correspond to the same next-hop identifier, meaning these destination IP addresses correspond to the same next-hop device, such as all destination IP addresses in the same subnet corresponding to the same next-hop device, it is sufficient for all destination IP addresses in the same subnet to correspond to the same next-hop entry, rather than each destination IP address corresponding to a separate next-hop entry. This reduces the number of next-hop entries and saves table entry resources.
[0079] For example, when generating a routing entry (routing table entry), the destination IP address and next-hop identifier are obtained from the routing entry. It is then determined whether a next-hop table entry corresponding to the next-hop identifier already exists. If so, a new entry is not added to the next-hop table, and the entry creation process ends. If not, a new entry is added to the next-hop table. The processing procedure is described in the above embodiment. Based on this, all destination IP addresses within the same subnet can correspond to the same next-hop table entry.
[0080] In summary, assuming the same subnet corresponds to 100 destination IP addresses, then all 100 destination IP addresses correspond to the same next-hop table entry, saving table entry resources. Although 100 destination IP addresses correspond to 100 hash table entries, hash table entries have fewer fields and occupy less storage space. The storage space occupied by 100 hash table entries is far less than the storage space occupied by 100 next-hop table entries.
[0081] The generation process of the next-hop table can be triggered by ARP resolution results. Specifically, when a network device successfully resolves the MAC address corresponding to an IP address via the ARP protocol, it obtains the next-hop identifier for that IP address (i.e., the destination IP address) and triggers the addition of a new entry (next-hop table entry) to the next-hop table. The network device can obtain the outgoing interface corresponding to the next-hop identifier and use its MAC address as the source MAC address in the next-hop table entry. The network device also determines the corresponding VLAN identifier based on the VLAN configuration associated with that outgoing interface, and this VLAN identifier becomes the VLAN in the next-hop table entry. Alternatively, the network device can obtain the ARP identifier corresponding to the destination IP address as the ARP identifier corresponding to the next-hop identifier.
[0082] Network devices query the ARP hash table based on the destination IP address. If an ARP identifier corresponding to the destination IP address already exists in the ARP hash table, a new entry is added to the next-hop table. This entry records the next-hop identifier, path information, and a mode flag, with the mode flag set to its first value (e.g., 0). If no ARP identifier corresponding to the destination IP address exists in the ARP hash table, a new entry is added to the next-hop table. This entry records the next-hop identifier, path information, mode flag, and the ARP identifier, with the mode flag set to its second value.
[0083] The generation process of the next-hop table can be done using static configuration. For example, the network administrator can manually specify the destination IP address, next-hop identifier, and ARP identifier via command line, management interface, or configuration file. The network device can obtain the outgoing interface corresponding to the next-hop identifier and use its MAC address as the source MAC address in the next-hop table entry. The network device then determines the corresponding VLAN identifier based on the VLAN configuration associated with that outgoing interface, and this VLAN identifier becomes the VLAN in the next-hop table entry. Based on this, a next-hop table entry can be generated.
[0084] The generation process of the next-hop table can be triggered by hash collisions. For example, when a network device records the mapping relationship between an IP address and an ARP identifier in its ARP hash table, if a hash collision occurs for that IP address (i.e., the first hash table entry corresponding to that IP address has a hash collision), a new entry (next-hop table entry) is added to the next-hop table. Based on this, the network device can obtain the next-hop identifier, the destination IP address corresponding to the next-hop identifier, and the ARP identifier corresponding to the next-hop identifier. The destination IP address refers to the IP address with the hash collision. The next-hop identifier can be obtained by querying the routing table using this destination IP address, and the ARP identifier corresponding to this destination IP address is used as the ARP identifier corresponding to the next-hop identifier.
[0085] Network devices can obtain the outgoing interface corresponding to the next-hop identifier and use the MAC address of that outgoing interface as the source MAC address in the next-hop table entry. The network device determines the corresponding VLAN identifier based on the VLAN configuration associated with that outgoing interface, and this VLAN identifier is used as the VLAN in the next-hop table entry.
[0086] Network devices query the ARP hash table based on the destination IP address. If an ARP identifier corresponding to the destination IP address already exists in the ARP hash table, a new entry is added to the next-hop table. This entry records the next-hop identifier, path information, and a mode flag, where the mode flag can have the first value. If no ARP identifier corresponding to the destination IP address exists in the ARP hash table, a new entry is added to the next-hop table. This entry records the next-hop identifier, path information, mode flag, and the ARP identifier, where the mode flag can have the second value.
[0087] See Figure 3 The diagram illustrates multiple ARP entries sharing a common next-hop for forwarding. For destination IP addresses in the routing table, such as 10.0.0.10, 10.0.0.11, 10.0.0.12, 10.0.0.13, and 10.0.0.14, these destination IP addresses correspond to the same next-hop table. In this next-hop table, the next-hop identifier is 100, the VLAN is 10, the source MAC address is 0-0-1, the outgoing interface (PORT) is 30, and the mode flag (ARPMODE) is 1. This mode flag indicates a hash lookup mode, meaning that an ARP identifier does not exist in the next-hop table. In addition to the above, the next-hop table may also include TTL information (TTL minus 1) and DSCP (e.g., 34).
[0088] The ARP hash table can record the ARP identifier corresponding to the destination IP address 10.0.0.10. Figure 3(Not shown in the image) ARP identifiers corresponding to destination IP address 10.0.0.11, 10.0.0.12, 10.0.0.13, and 10.0.0.14. Based on the ARP identifier corresponding to the destination IP address 10.0.0.10, the destination MAC address 0-0-10 is found in the ARP information table (denoted as the ARP ID table); based on the ARP identifier corresponding to the destination IP address 10.0.0.11, the destination MAC address 0-0-11 is found in the ARP information table; based on the ARP identifier corresponding to the destination IP address 10.0.0.12, the destination MAC address 0-0-12 is found in the ARP information table; based on the ARP identifier corresponding to the destination IP address 10.0.0.13, the destination MAC address 0-0-13 is found in the ARP information table; based on the ARP identifier corresponding to the destination IP address 10.0.0.14, the destination MAC address 0-0-15 is found in the ARP information table; in summary, the destination MAC address can be obtained.
[0089] At this point, path information can be obtained from the next-hop table and the destination MAC address from the ARP table, allowing data packets to be forwarded based on the path information and the destination MAC address. For example, path information may include: next-hop identifier 100, VLAN 10, TTL minus 1, DSCP 34, source MAC address 0-0-1, outgoing interface 30, and destination MAC address 0-0-XX.
[0090] Based on the aforementioned routing table, next-hop table, ARP hash table, and ARP information table, this application proposes a data packet transmission method for FTTR scenarios. This method can be applied to network devices (such as FTTR devices), such as routers or switches. See also... Figure 4 The diagram shown illustrates a data packet transmission method in an FTTR scenario. This method may include: Step 401: The network device receives the data packet and obtains the destination IP address of the data packet.
[0091] Step 402: The network device queries the routing table through the destination IP address to obtain the next-hop identifier, that is, the next-hop identifier corresponding to the destination IP address.
[0092] As mentioned above, each entry in the routing table can include fields such as the destination IP address and the next-hop identifier. Therefore, by querying the routing table using the destination IP address (Dst_IP), you can obtain the next-hop identifier (next_hop_id) corresponding to the destination IP address.
[0093] Step 403: The network device queries the next-hop table using the next-hop identifier to obtain the mode flag and path information. The path information includes the outgoing interface, VLAN, and source MAC address.
[0094] In one example, the mode flag can be either a first value or a second value. The first value indicates a hash lookup mode, meaning that the ARP identifier does not exist in the next-hop table. The second value indicates a next-hop lookup mode, meaning that the ARP identifier exists in the next-hop table.
[0095] As mentioned above, each entry in the next-hop table can include fields such as next-hop identifier, outgoing interface, VLAN, source MAC address, and mode flag. Therefore, by querying the next-hop table through the next-hop identifier, you can obtain the outgoing interface, VLAN, source MAC address (src_mac), and mode flag corresponding to the next-hop identifier.
[0096] Step 404: The network device determines whether the mode flag is the first value.
[0097] If so, that is, if the mode flag is at the first value, step 405 can be executed.
[0098] If not, that is, if the mode flag is the second value, step 406 can be executed.
[0099] Step 405: The network device queries the ARP hash table using the destination IP address of the data packet to obtain the ARP identifier. After obtaining the ARP identifier, step 407 is executed based on the ARP identifier.
[0100] Referring to the above, each hash entry in the ARP hash table can include the destination IP address and the ARP identifier. Therefore, by querying the ARP hash table using the destination IP address (Dst_IP), the ARP identifier corresponding to the destination IP address can be obtained. In summary, based on the pattern flag in the next-hop table, when the pattern flag indicates the hash lookup pattern, the network device can query the ARP hash table using the destination IP address as the key to obtain the ARP identifier corresponding to the destination IP address.
[0101] In one example, when a network device queries the ARP hash table for a destination IP address, it can use a target hash algorithm to hash the destination IP address to obtain a second hash value. It then determines the second hash table entry corresponding to the second hash value and retrieves the ARP identifier corresponding to the destination IP address from that entry. For instance, if the second hash table entry includes a mapping between destination IP addresses and ARP identifiers, the network device can obtain the ARP identifier corresponding to the destination IP address from the second hash table entry.
[0102] For example, the target hash algorithm can be configured according to actual needs, such as CRC32 cyclic redundancy check algorithm, MurmurHash3 non-encryption hash algorithm, etc., and there is no restriction on the type of target hash algorithm.
[0103] For example, when a network device performs a modulo operation on the second hash value (i.e., takes the remainder of the number of buckets N in the ARP hash table), the result can be the position index of the second hash table entry in the ARP hash table. In other words, the hash table entry corresponding to this position index can be the second hash table entry corresponding to the second hash value.
[0104] Step 406: The network device retrieves the ARP identifier corresponding to the next-hop identifier from the next-hop table. After obtaining the ARP identifier, step 407 can be executed based on the ARP identifier.
[0105] As mentioned above, in certain cases (such as hash collisions), the next-hop table can also include the ARP identifier corresponding to the next-hop identifier. Therefore, by querying the next-hop table using the next-hop identifier, you can obtain the ARP identifier corresponding to the next-hop identifier.
[0106] In summary, based on the pattern flag in the next hop table, when the pattern flag indicates the next hop lookup mode, the network device can also use the next hop identifier as the key to query the next hop table and obtain the ARP identifier corresponding to the next hop identifier.
[0107] Step 407: The network device queries the ARP information table using the ARP identifier to obtain the destination MAC address.
[0108] As mentioned above, each ARP entry in the ARP information table can include an ARP identifier and a destination MAC address. Therefore, network devices can obtain the destination MAC address (dst_mac) corresponding to the ARP identifier by querying the ARP information table through the ARP identifier.
[0109] Step 408: The network device sends a data packet based on the path information and the destination MAC address.
[0110] For example, network devices encapsulate VLANs, source MAC addresses, and destination MAC addresses into data packets to obtain modified data packets; the modified data packets are then sent through the outgoing interface.
[0111] As can be seen from the above technical solutions, by recording the mapping relationship between the destination IP address and the ARP identifier in the ARP hash table, it is not necessary to record the ARP identifier in the next-hop table. This decouples the ARP information table from the next-hop table. For each ARP entry in the ARP information table, it does not need to correspond to a next-hop table entry, thereby reducing the number of next-hop table entries, saving resources, and improving resource utilization. It saves table entry resources, achieving one next hop per subnet, reducing the demand on the next-hop table from massive ARP requests to a constant level. It enables unified query paths; the ARP identifiers in the ARP hash table and the ARP identifiers in the next-hop table are all merged into the same ARP information table. That is, querying the destination MAC address in the ARP information table results in the same number of read operations and latency, with no additional performance overhead. It achieves zero storage redundancy, without adding a new final MAC storage table, reusing the memory of the ARP information table. Multiple hardware components in the network device retrieve the ARP identifier from the ARP hash table based on the destination IP address of the data packet. This eliminates the bandwidth overhead of transmitting ARP identifiers between devices and removes the complex logic of globally synchronizing ARP identifiers. Smooth switching is achieved through mode flags, ensuring that entries remain fully available even in the event of hash collisions. The memory usage of the ARP hash table can be dynamically adjusted to adapt to different network sizes, improving overall resource utilization.
[0112] Based on the same application concept as the above method, this application proposes a data packet transmission device for an FTTR scenario. This data packet transmission device can be applied to FTTR equipment in an FTTR scenario. See [link to relevant documentation]. Figure 5 The diagram shown is a structural schematic of a data packet transmission device in the FTTR scenario. The device may include: The acquisition module 51 is used to query the routing table using the destination IP address of the received data packet to obtain the next-hop identifier; query the next-hop table using the next-hop identifier to obtain the mode flag and path information; if the mode flag is a first value, the first value represents a hash lookup mode, then query the ARP hash table using the destination IP address to obtain the ARP identifier; query the ARP information table using the ARP identifier to obtain the destination MAC address; the sending module 52 is used to send the data packet based on the path information and the destination MAC address.
[0113] In one example, the acquisition module 51 is further configured to, when the mode flag is a second value, where the second value represents a next-hop lookup mode, obtain the ARP identifier corresponding to the next-hop identifier from the next-hop table; query the ARP information table through the ARP identifier to obtain the destination MAC address; wherein, the hash lookup mode indicates that the ARP identifier does not exist in the next-hop table; wherein, the next-hop lookup mode indicates that the ARP identifier exists in the next-hop table.
[0114] In one example, the apparatus further includes (not shown in the figure): a generation module, configured to generate the ARP hash table and the ARP information table; specifically, when generating the ARP hash table and the ARP information table, the generation module is configured to: after receiving an ARP packet sent by a sending device, obtain the IP address and MAC address of the sending device from the ARP packet, and generate an ARP identifier corresponding to the IP address; record the mapping relationship between the ARP identifier and the MAC address in the ARP information table; and record the mapping relationship between the IP address and the ARP identifier in the ARP hash table.
[0115] In one example, when the generation module records the mapping relationship between the IP address and the ARP identifier in the ARP hash table, it is specifically used to: perform a hash operation on the IP address using a target hash algorithm to obtain a first hash value; determine a first hash table entry corresponding to the first hash value from the ARP hash table; if the first hash table entry does not have a hash collision, then record the mapping relationship between the IP address and the ARP identifier in the first hash table entry; the generation module is further used to prohibit recording the mapping relationship between the IP address and the ARP identifier in the first hash table entry if the first hash table entry has a hash collision.
[0116] When the acquisition module 51 obtains the ARP identifier by querying the ARP hash table through the destination IP address, it specifically performs the following steps: using the target hash algorithm to perform a hash operation on the destination IP address to obtain a second hash value; determining the second hash table entry corresponding to the second hash value from the ARP hash table; and querying the ARP identifier corresponding to the destination IP address from the second hash table entry.
[0117] In one example, the apparatus further includes (not shown in the figure): a generation module, configured to generate the next-hop table; wherein, when generating the next-hop table, the generation module specifically performs the following steps: obtaining a next-hop identifier, a destination IP address corresponding to the next-hop identifier, and an ARP identifier corresponding to the next-hop identifier; querying an ARP hash table using the destination IP address; if an ARP identifier corresponding to the destination IP address exists in the ARP hash table, then recording the next-hop identifier, path information, and a pattern flag in the next-hop table, wherein the pattern flag is a first value; if an ARP identifier corresponding to the destination IP address does not exist in the ARP hash table, then recording the next-hop identifier, path information, pattern flag, and the ARP identifier in the next-hop table, wherein the pattern flag is a second value.
[0118] Based on the same application concept as the above method, this application proposes an FTTR device, see [link to relevant documentation]. Figure 6 As shown, the FTTR device includes a processor 61 and a machine-readable storage medium 62, the machine-readable storage medium 62 storing machine-executable instructions that can be executed by the processor 61; the processor 61 is used to execute the machine-executable instructions to implement the data packet transmission method in the FTTR scenario disclosed in the above example of this application.
[0119] Based on the same concept as the above method, this application also provides a machine-readable storage medium storing a plurality of computer instructions. When the computer instructions are executed by a processor, they can implement the data packet transmission method in the FTTR scenario disclosed in the above examples of this application.
[0120] The aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.
[0121] Based on the same concept as the methods described above, this application also provides a computer program product, which may include a computer program. When executed by a processor, the computer program implements the data packet transmission method in the FTTR scenario disclosed in the examples above.
[0122] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A data packet transmission method in a fiber-to-the-room (FTTR) scenario, characterized in that, The method, applied to FTTR devices in FTTR scenarios, includes: The next-hop identifier is obtained by querying the routing table using the destination IP address of the received data packet; the next-hop identifier is then used to query the next-hop table to obtain the mode flag and path information. When the mode flag is set to a first value, which represents a hash lookup mode, the ARP identifier is obtained by querying the ARP hash table using the destination IP address. The destination MAC address is obtained by querying the ARP information table using the ARP identifier. The data packet is sent based on the path information and the destination MAC address.
2. The method according to claim 1, characterized in that, After obtaining the pattern flag and path information by querying the next-hop table using the next-hop identifier, the method further includes: When the mode flag is set to a second value, which indicates a next-hop lookup mode, the ARP identifier corresponding to the next-hop identifier is retrieved from the next-hop table. The destination MAC address is obtained by querying the ARP information table using the ARP identifier. The hash lookup pattern indicates that there is no ARP identifier in the next hop table; The next-hop lookup pattern indicates that an ARP identifier exists in the next-hop table.
3. The method according to claim 1 or 2, characterized in that, The generation process of the ARP hash table and the ARP information table specifically includes: Upon receiving an ARP packet from the sending device, the IP address and MAC address of the sending device are obtained from the ARP packet, and an ARP identifier corresponding to the IP address is generated. The mapping relationship between the ARP identifier and the MAC address is recorded in the ARP information table; The mapping relationship between the IP address and the ARP identifier is recorded in the ARP hash table.
4. The method according to claim 3, characterized in that, The step of recording the mapping relationship between the IP address and the ARP identifier in the ARP hash table includes: performing a hash operation on the IP address using a target hash algorithm to obtain a first hash value; determining a first hash table entry corresponding to the first hash value from the ARP hash table; and if there is no hash collision in the first hash table entry, recording the mapping relationship between the IP address and the ARP identifier in the first hash table entry. The method further includes: if a hash collision occurs in the first hash table entry, then prohibiting the recording of the mapping relationship between the IP address and the ARP identifier in the first hash table entry; The step of querying the ARP hash table through the destination IP address to obtain the ARP identifier includes: The destination IP address is hashed using the target hash algorithm to obtain a second hash value; a second hash table entry corresponding to the second hash value is determined from the ARP hash table, and the ARP identifier corresponding to the destination IP address is queried from the second hash table entry.
5. The method according to claim 1 or 2, characterized in that, The process of generating the next-hop list specifically includes: Obtain the next-hop identifier, the destination IP address corresponding to the next-hop identifier, and the ARP identifier corresponding to the next-hop identifier; If the destination IP address is used to query the ARP hash table, and an ARP identifier corresponding to the destination IP address exists in the ARP hash table, then the next hop identifier, path information, and mode flag are recorded in the next hop table, and the mode flag is set to the first value. If there is no ARP identifier corresponding to the destination IP address in the ARP hash table, then the next-hop identifier, path information, mode flag, and ARP identifier are recorded in the next-hop table, and the mode flag is a second value.
6. A data packet transmission device for a fiber-to-the-room (FTTR) scenario, characterized in that, An FTTR device applied in FTTR scenarios, the device comprising: The acquisition module is used to query the routing table using the destination IP address of the received data packet to obtain the next-hop identifier; query the next-hop table using the next-hop identifier to obtain the mode flag and path information; if the mode flag is a first value, the first value represents a hash lookup mode, then query the ARP hash table using the destination IP address to obtain the ARP identifier; query the ARP information table using the ARP identifier to obtain the destination MAC address. The sending module is used to send the data packet based on the path information and the destination MAC address.
7. The apparatus according to claim 6, characterized in that, The acquisition module is further configured to, when the mode flag is a second value, where the second value represents a next-hop lookup mode, obtain the ARP identifier corresponding to the next-hop identifier from the next-hop table; The destination MAC address is obtained by querying the ARP information table using the ARP identifier. The hash lookup pattern indicates that there is no ARP identifier in the next hop table; The next-hop lookup pattern indicates that an ARP identifier exists in the next-hop table.
8. The apparatus according to claim 6 or 7, characterized in that, The device further includes: A generation module is used to generate the ARP hash table and the ARP information table; The generation module generates the ARP hash table and the ARP information table specifically for the following purposes: Upon receiving an ARP packet from the sending device, the IP address and MAC address of the sending device are obtained from the ARP packet, and an ARP identifier corresponding to the IP address is generated. The mapping relationship between the ARP identifier and the MAC address is recorded in the ARP information table; The mapping relationship between the IP address and the ARP identifier is recorded in the ARP hash table.
9. The apparatus according to claim 8, characterized in that, When the generation module records the mapping relationship between the IP address and the ARP identifier in the ARP hash table, it specifically performs the following steps: performs a hash operation on the IP address using a target hash algorithm to obtain a first hash value; determines a first hash table entry corresponding to the first hash value from the ARP hash table; if there is no hash collision in the first hash table entry, then records the mapping relationship between the IP address and the ARP identifier in the first hash table entry. The generation module is further configured to prohibit recording the mapping relationship between the IP address and the ARP identifier in the first hash table entry if a hash collision exists in the first hash table entry; When the acquisition module queries the ARP hash table through the destination IP address to obtain the ARP identifier, it specifically performs the following steps: hashing the destination IP address using the target hash algorithm to obtain a second hash value; determining the second hash table entry corresponding to the second hash value from the ARP hash table; and querying the ARP identifier corresponding to the destination IP address from the second hash table entry.
10. The apparatus according to claim 6 or 7, characterized in that, The apparatus further includes: a generation module, configured to generate the next-hop list; the generation module specifically performs the following when generating the next-hop list: Obtain the next-hop identifier, the destination IP address corresponding to the next-hop identifier, and the ARP identifier corresponding to the next-hop identifier; If the destination IP address is used to query the ARP hash table, and an ARP identifier corresponding to the destination IP address exists in the ARP hash table, then the next hop identifier, path information, and mode flag are recorded in the next hop table, and the mode flag is set to the first value. If there is no ARP identifier corresponding to the destination IP address in the ARP hash table, then the next-hop identifier, path information, mode flag, and ARP identifier are recorded in the next-hop table, and the mode flag is a second value.
11. An FTTR device, characterized in that, include: A processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; The processor is configured to execute machine-executable instructions to implement the method of any one of claims 1-5.
