A method and device for updating a static forwarding table of a switch

By dynamically learning and saving dynamic forwarding table entries as static forwarding tables in the switch, the problem of quickly generating a layer 3 forwarding table after the switch restarts is solved, achieving millisecond-level recovery of service traffic and high reliability of the switching network.

CN116389343BActive Publication Date: 2025-09-09北京东土军悦科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211707068.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2025-09-09
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

Existing switches have difficulty quickly generating Layer 3 forwarding entries after a restart, resulting in a long recovery time for service traffic and failing to meet the high reliability and stability requirements of network application scenarios such as ships and aircraft.

Method used

Dynamic forwarding table entries are obtained through dynamic learning and saved as static forwarding table entries before the switch restarts. This ensures that the static forwarding table is used directly for service traffic forwarding after the switch restarts.

Benefits of technology

After the switch is restarted, the service traffic can be restored to normal forwarding within milliseconds, ensuring the high reliability of the switching network and the flexibility of network activation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116389343B_ABST
    Figure CN116389343B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a method and apparatus for updating a switch's static forwarding table. The method comprises: obtaining dynamic forwarding table entries through dynamic learning from the switch's network interaction information according to a network protocol, and saving the entries to the forwarding work table of layer 3 of the switch; and when a dynamic-to-static conversion enable switch is turned on, saving the dynamic forwarding table entries to the static forwarding table, so that the static forwarding table is used as the forwarding work table the next time the switch is restarted. The static forwarding table obtained in the embodiment of the present invention is directly used as the forwarding work table after the switch is restarted. This ensures that normal service traffic forwarding can be restored within milliseconds after service deployment and switch restart, ensuring high reliability of the switching network and flexibility in network provisioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Ethernet communications, and in particular relates to a method and device for updating a static forwarding table of a switch. Background Art

[0002] Existing switches generally generate Layer 3 forwarding table entries in two ways: dynamic learning through protocols and static user configuration. For example, Layer 3 multicast can be dynamically learned through protocols such as PIM-SM or PIM-DM, or static Layer 3 multicast tables can be configured by users.

[0003] In network application scenarios such as ships and airplanes, the networking is relatively fixed, and there are high requirements for reliability, stability, and security. Generally, there are high requirements for restarting and restoring communications, requiring that business traffic can be forwarded normally as soon as possible after the device is restarted. This requires the switch to be able to quickly generate forwarding entries.

[0004] Network deployment involves connecting switches to the network based on the application network, configuring the switches, and ensuring normal forwarding of service traffic to meet actual service communication needs.

[0005] If the Layer 3 forwarding table is generated through manual static configuration by the user, the switch can directly read the saved static configuration to generate the Layer 3 forwarding table after power-on, which can restore normal service traffic forwarding in milliseconds. However, manually configuring the static table is labor-intensive and error-prone, increasing the difficulty of network deployment, requiring high technical skills from network administrators, and is not conducive to user use and maintenance.

[0006] If the forwarding table is dynamically learned through the protocol, network deployment is easy and convenient for users to use and maintain. A dynamic layer 3 forwarding table can only be generated after sufficient message interactions are processed through the protocol. The speed of protocol optimization is limited. After the switch is restarted, it often takes seconds for business traffic to enter normal forwarding, which does not meet the requirements of fast forwarding. Summary of the Invention

[0007] In light of this, embodiments of the present invention provide a method and apparatus for updating a switch's static forwarding table. The method comprises: obtaining dynamic forwarding table entries through dynamic learning from the switch's network interaction information according to a network protocol, and storing the entries in the forwarding work table of layer 3 of the switch; and when the dynamic-to-static conversion enable switch is turned on, saving the dynamic forwarding table entries to the static forwarding table, so that the static forwarding table serves as the forwarding work table the next time the switch is restarted. The static forwarding table obtained in the embodiments of the present invention is directly used as the forwarding work table after the switch is restarted. This ensures that service traffic can resume normal forwarding within milliseconds after service deployment and switch restart, ensuring the high reliability of the switching network and the flexibility of network provisioning.

[0008] In a first aspect, an embodiment of the present invention provides a method for updating a static forwarding table of a switch, comprising: obtaining dynamic forwarding table entries from network interaction information of the switch through dynamic learning according to a network protocol, and saving the entries in a forwarding work table at layer 3 of the switch; when a dynamic-static conversion enable switch is turned on, saving the dynamic forwarding table entries to the static forwarding table, so that the static forwarding table can be used as the forwarding work table when the switch is started next time.

[0009] As described above, the static forwarding table obtained by the above method is directly used as the forwarding work table after the switch restarts, so that the service traffic can be restored to normal forwarding in milliseconds after the switch restarts after the service is started, ensuring the high reliability of the switching network and the flexibility of compatible network opening.

[0010] In a possible implementation of the first aspect, each entry in the forwarding work table, each entry in the static forwarding table, and each dynamic forwarding table entry include outgoing address information, which includes routing address information and ARP address information of the corresponding entry; each entry in the forwarding work table also includes: a routing dynamic identifier and an ARP dynamic identifier, which are respectively used to identify whether the routing address information of the entry is statically configured or obtained through the dynamic learning and whether the ARP address information of the entry is statically configured or obtained through the dynamic learning.

[0011] As described above, the routing dynamic identifier and the ARP dynamic identifier are used to distinguish whether the forwarding table entries come from static configuration or dynamic learning, so that only the dynamically learned entries are saved, simplifying system work.

[0012] In a possible implementation of the first aspect, saving the dynamic forwarding entry to the static forwarding table specifically includes: when the outgoing address information of the dynamic forwarding entry and any entry in the static forwarding table are not repeated, saving the forwarding address information of the dynamic forwarding entry to the static forwarding table.

[0013] From the above, only the entries with different address information are saved to avoid redundant entries in the static work table.

[0014] In a possible implementation of the first aspect, the routing dynamic identifier of each dynamic table entry in the forwarding work table is also used to identify whether the routing address information of the table entry has been saved in the static forwarding table, and the ARP dynamic identifier of each dynamic table entry is also used to identify whether the ARP address information of the table entry has been saved in the static forwarding table, and the dynamic table entry is an entry from the dynamic forwarding table entry in the forwarding work table.

[0015] As described above, the dynamic routing identifier and the ARP dynamic identifier are used to distinguish whether the dynamic table entries of the forwarding work table are saved, thereby reducing the workload.

[0016] In a possible implementation of the first aspect, each of the outgoing address information includes its corresponding port, and the method further includes: when the corresponding ports change from port N to port M in batches, changing the corresponding port of the corresponding entry in the dynamic forwarding table from port N to port M;

[0017] Replaced with port M.

[0018] As described above, by batch changing the ports in the corresponding entries in the forwarding work table from port N to port M, there is no need to gradually update through dynamic learning, so the impact on switch performance is minimized when the switch port is replaced. At the same time, by batch changing the ports in the corresponding entries in the static forwarding table from port N to port M, the update efficiency of the static forwarding table is improved.

[0019] In a possible implementation of the first aspect, the network protocol is set according to service requirements of the switch.

[0020] From the above, the network protocol is selected according to the business needs, so as to generate dynamic forwarding entries more efficiently.

[0021] In the second aspect, an embodiment of the present invention provides a device for updating the static forwarding table of a switch, comprising: a dynamic learning module for obtaining dynamic forwarding table entries from the network interaction information of the switch through dynamic learning according to the network protocol, and saving them in the forwarding work table of the switch layer 3; a static saving module for saving the dynamic forwarding table entries to the static forwarding table when the dynamic-static conversion enable switch is turned on, so that the static forwarding table can be used as the forwarding work table when the switch is started next time.

[0022] As described above, the static forwarding table obtained by the above method is directly used as the forwarding work table after the switch restarts, so that the service traffic can be restored to normal forwarding in milliseconds after the switch restarts after the service is started, ensuring the high reliability of the switching network and the flexibility of compatible network opening.

[0023] In a possible implementation of the second aspect, each entry in the forwarding work table, each entry in the static forwarding table, and each dynamic forwarding table entry include outgoing address information, which includes routing address information and ARP address information of the corresponding entry; each entry in the forwarding work table also includes: a routing dynamic identifier and an ARP dynamic identifier, which are used to identify whether the routing address information of the entry is statically configured or obtained through the dynamic learning and whether the ARP address information of the entry is statically configured or obtained through the dynamic learning.

[0024] As described above, the routing dynamic identifier and the ARP dynamic identifier are used to distinguish whether the forwarding table entries come from static configuration or dynamic learning, so that only the dynamically learned entries are saved, simplifying system work.

[0025] In a possible implementation of the second aspect, saving the dynamic forwarding table entry to the static forwarding table specifically includes: when the outgoing address information of the dynamic forwarding table entry and any entry in the static forwarding table are not repeated, saving the forwarding address information of the dynamic forwarding table entry to the static forwarding table.

[0026] From the above, only the entries with different address information are saved to avoid redundant entries in the static work table.

[0027] In a possible implementation of the second aspect, the routing dynamic identifier of each dynamic table entry in the forwarding work table is also used to identify whether the routing address information of the table entry has been saved in the static forwarding table, and the ARP dynamic identifier of each dynamic table entry is also used to identify whether the ARP address information of the table entry has been saved in the static forwarding table, and the dynamic table entry is an entry from the dynamic forwarding table entry in the forwarding work table.

[0028] As described above, the dynamic routing identifier and the ARP dynamic identifier are used to distinguish whether the dynamic table entries of the forwarding work table are saved, thereby reducing the workload.

[0029] In a possible implementation of the second aspect, each of the outgoing address information includes its corresponding port, and the method further includes: when the corresponding ports change from port N to port M in batches, changing the corresponding ports of the corresponding entries in the dynamic forwarding table from port N to port M.

[0030] As described above, by batch changing the ports in the corresponding entries in the forwarding work table from port N to port M, there is no need to gradually update through dynamic learning, so the impact on switch performance is minimized when the switch port is replaced. At the same time, by batch changing the ports in the corresponding entries in the static forwarding table from port N to port M, the update efficiency of the static forwarding table is improved.

[0031] In a possible implementation of the second aspect, the network protocol is set according to service requirements of the switch.

[0032] From the above, the network protocol is selected according to the business needs, so as to generate dynamic forwarding entries more efficiently.

[0033] In a third aspect, an embodiment of the present invention provides a switch that updates a static forwarding table using any implementation of the first aspect.

[0034] In a fourth aspect, an embodiment of the present invention provides a computing device, comprising: a bus; a communication interface connected to the bus; at least one processor connected to the bus; and at least one memory connected to the bus and storing program instructions, wherein when the program instructions are executed by the at least one processor, the at least one processor executes any implementation method described in the first aspect of the present invention.

[0035] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium having program instructions stored thereon, wherein the program instructions, when executed by a computer, enable the computer to execute any of the implementations described in the first aspect of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 1 is a flow chart of a first embodiment of a method for updating a static forwarding table of a switch according to the present invention;

[0037] Figure 2 A schematic diagram of the table entry structure of a forwarding work table in a second embodiment of a method for updating a static forwarding table of a switch according to the present invention;

[0038] Figure 3 This is a flow chart of a second embodiment of a method for updating a static forwarding table of a switch according to the present invention;

[0039] Figure 4 1 is a flow chart of a third embodiment of a method for updating a static forwarding table of a switch according to the present invention;

[0040] Figure 5 This is a structural diagram of a first embodiment of a device for updating a static forwarding table of a switch according to the present invention;

[0041] Figure 6 This is a structural diagram of a second embodiment of a device for updating a static forwarding table of a switch according to the present invention;

[0042] Figure 7 This is a structural diagram of a third embodiment of a device for updating a static forwarding table of a switch according to the present invention;

[0043] Figure 8 Schematic diagram of the structure of the computing device according to various embodiments of the present invention. DETAILED DESCRIPTION

[0044] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0045] In the following description, the terms "first\second\third, etc." or module A, module B, module C, etc. are only used to distinguish similar objects, or to distinguish different embodiments, and do not represent a specific ordering of the objects. It can be understood that the specific order or sequence can be interchanged where permitted, so that the embodiments of the present invention described herein can be implemented in an order other than that illustrated or described herein.

[0046] In the following description, the numbers representing the steps, such as S110, S120, etc., do not necessarily mean that the steps must be executed in this manner. If permitted, the order of the steps can be interchanged or they can be executed simultaneously.

[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention pertains. The terms used herein are for the purpose of describing embodiments of the present invention only and are not intended to limit the present invention.

[0048] An embodiment of the present invention provides a method and apparatus for updating a switch's static forwarding table. The method comprises: obtaining dynamic forwarding table entries through dynamic learning from the switch's network interaction information according to a network protocol, and storing them in a forwarding work table at layer 3 of the switch; and when a dynamic-to-static conversion enable switch is turned on, saving the dynamic forwarding table entries to the static forwarding table, so that the static forwarding table serves as the forwarding work table the next time the switch is restarted. The static forwarding table obtained in the embodiment of the present invention is directly used as the forwarding work table after the switch is restarted. This ensures that service traffic can resume normal forwarding within milliseconds after service deployment and switch restart, ensuring high reliability of the switching network and the flexibility of network provisioning.

[0049] The following describes various embodiments of the present invention with reference to the accompanying drawings.

[0050] First combine Figure 1 A first embodiment of a method for updating a static forwarding table of a switch according to the present invention is introduced.

[0051] In a first embodiment of a method for updating a static forwarding table of a switch, a dynamic forwarding table entry is obtained through dynamic learning according to a network protocol; when a dynamic-to-static conversion enable switch is turned on, the dynamic forwarding table entry is saved to a static forwarding table so that when the switch is started, the latest static forwarding table is used as the forwarding work table of the switch.

[0052] Figure 1 The flowchart of a method for updating a static forwarding table of a switch is shown, which includes steps S110 to S120.

[0053] S110: Obtain dynamic forwarding table entries from the network interaction information of the switch through dynamic learning according to the network protocol, and save them in the forwarding work table of the switch layer 3.

[0054] The forwarding table at switch layer 3 is used to forward packets at switch layer 3 and includes various dynamic forwarding table entries. If the configuration file at the time of switch startup includes a static forwarding table, the forwarding table also includes various entries in the static forwarding table. The static forwarding table can be manually configured during switch startup. After the switch is started, the static forwarding table is obtained using the method of this embodiment.

[0055] In some embodiments, each entry in the forwarding work table, each entry in the static forwarding table, and each entry in the dynamic forwarding table include outgoing address information, which includes the routing address information and ARP address information of the corresponding entry; each entry in the forwarding work table also includes: a routing dynamic identifier and an ARP dynamic identifier, which are used to identify whether the routing address information of the entry is statically configured or obtained through dynamic learning and whether the ARP address information of the entry is statically configured or obtained through dynamic learning.

[0056] In some embodiments, routing address information is dynamically learned from the network interaction information of the switch through network protocols such as RIP or OSFP, and ARP address information is dynamically learned from the network interaction information of the switch through the ARP network protocol. The network protocol is configured according to business needs when the interactive machine is started.

[0057] S120: When the dynamic-static conversion enabling switch is turned on, the dynamic forwarding table entry is saved in the static forwarding table.

[0058] The static-dynamic translation enable (Static_Translate) is a flag added in the embodiment of the present invention. When it is turned on, the dynamic forwarding table entries are saved in the static forwarding table.

[0059] In some embodiments, the switch saves each dynamic forwarding entry obtained into the static forwarding table. In other embodiments, the switch saves the dynamic forwarding entries obtained during a period of time into the static forwarding table at regular intervals.

[0060] In some embodiments, when the outgoing address information of the dynamic forwarding entry is not repeated with that of any entry in the static forwarding table, the outgoing address information of the dynamic forwarding entry is saved in the static forwarding table.

[0061] In some embodiments, the switch saves the dynamic forwarding entries obtained during this period into the static forwarding table at regular intervals. The routing dynamic identifier of each dynamic table entry in the forwarding work table is also used to identify whether the routing address information of the table entry has been saved in the static forwarding table. The ARP dynamic identifier of each dynamic table entry is also used to identify whether the ARP address information of the table entry has been saved in the static forwarding table. The dynamic table entry is the table entry from the dynamic forwarding table entry in the forwarding work table.

[0062] In summary, an embodiment of a method for updating a static forwarding table of a switch saves dynamic forwarding table entries obtained through dynamic learning into a static forwarding table. After the switch is restarted, the static forwarding table is directly used as a forwarding work table, thereby enabling service traffic to resume normal forwarding within milliseconds after the switch is restarted after service start, thereby ensuring high reliability of the switching network and flexibility of compatible network opening.

[0063] The following combination Figures 2 to 3 A second embodiment of a method for updating a static forwarding table of a switch according to the present invention is introduced.

[0064] A second embodiment of a method for updating a static forwarding table of a switch is a specific implementation method of the first embodiment of a method for updating a static forwarding table of a switch during unicast, and has all the advantages of the first embodiment of a method for updating a static forwarding table of a switch. Only when it is determined that the outgoing address information of the dynamic forwarding table entry and any table entry in the static forwarding table are not repeated, the dynamic forwarding table entry is saved in the static forwarding table to avoid redundancy and maintain an indirect static forwarding table.

[0065] Figure 2 The table entry structure of a switch forwarding work table in unicast mode is shown, including routing table entries and ARP table entries.

[0066] The forwarding table for multicast or broadcast also includes routing table items and ARP table items, but the structure of its ARP table items is different from that for unicast. It has been packaged into multicast groups or broadcast groups. In other aspects, it is the same as unicast. The description of this embodiment using unicast as an example is also suitable for multicast or broadcast. For the sake of brevity, the forwarding table, static forwarding table, and dynamic forwarding table items described later in this embodiment are all forwarding table, static forwarding table, and dynamic forwarding table items for unicast, and will not be repeated here.

[0067] The routing table entries in the forwarding work table include at least the routing dynamic identifier, routing target IP address, routing target IP mask and next hop IP address. The routing target IP address is the IP address that the data packet will eventually reach in the IP network, and the next hop IP address is the IP address of the next hop of the switch.

[0068] An ARP entry contains at least the following: an ARP dynamic identifier, a destination IP address, a destination MAC address, and a port number. The destination IP address is the next-hop IP address of the switch, the destination MAC address is the MAC address of the corresponding outbound port on the switch, and the port number is the port number of the corresponding outbound port on the switch. A multicast or broadcast forwarding table also includes routing and ARP entries, but unlike unicast, these ARP entries represent a collection of multicast or broadcast groups.

[0069] The next hop IP address and the destination IP address in each entry of the forwarding work table are the same IP address.

[0070] Among them, the routing target IP address, routing target IP mask, next hop IP address, destination MAC address and port number constitute the outgoing address information, the routing target IP address, routing target IP mask and next hop IP address constitute the routing address information in the outgoing address information, and the destination IP address, destination MAC address and port number constitute the ARP address information in the outgoing address information.

[0071] The routing target IP address and routing target IP mask of each entry in the forwarding work table constitute the key information of the entry.

[0072] Each entry in the static forwarding table has the same structure as an entry in the dynamic forwarding table, including outgoing address information. The structure of the outgoing address information is the same as that of the outgoing address information in the forwarding work table.

[0073] In this embodiment, the switch saves the dynamic entries in the forwarding table to the static forwarding table at regular intervals. The dynamic entries are entries from the dynamic forwarding table in the forwarding work table. That is, the switch saves the dynamic forwarding entries to the static forwarding table at regular intervals.

[0074] Among them, the routing dynamic identifier of each table item in the forwarding work table is not only used to identify whether the routing address information of the routing table item comes from static configuration or is obtained through dynamic learning, but also used to distinguish whether the routing address information is saved in the static work table. For example, the routing dynamic identifier is 1, which indicates that the routing address information of the routing table item comes from static configuration; the routing dynamic identifier is 2, which indicates that the routing address information of the routing table item comes from dynamic learning but has not yet been saved in the static work table; the routing dynamic identifier is 3, which indicates that the routing address information of the routing table item comes from dynamic learning and has been saved in the static work table.

[0075] Among them, the ARP dynamic identifier of each table entry in the forwarding work table is not only used to identify whether the ARP address information from the ARP table entry comes from static configuration or dynamic learning, but also to distinguish whether the ARP address information is saved in the static work table. For example, the ARP dynamic identifier is 1, indicating that the ARP address information from the ARP table entry comes from static configuration, the routing dynamic identifier is 2, indicating that the ARP address information from the ARP table entry comes from dynamic learning but has not yet been saved in the static work table, and the routing dynamic identifier is 3, indicating that the routing address information from the routing table entry comes from dynamic learning and has been saved in the static work table.

[0076] Figure 3 The flowchart of the second embodiment of a method for updating a static forwarding table of a switch is shown, including steps S210 to S290.

[0077] S210: The switch reads the configuration file after the system is powered on and started.

[0078] If a static forwarding table already exists, it is included in the configuration file.

[0079] S220: Determine whether the configuration file includes a static forwarding table.

[0080] If the configuration file includes a static forwarding table, step S230 is executed; otherwise, step S240 is executed.

[0081] When the switch is started, the static forwarding table may be manually configured or not configured. After the switch is restarted after the start-up, the static forwarding table can be obtained using this embodiment.

[0082] S230: Use the static forwarding table as the forwarding work table of the switch layer 3 for normal forwarding of the switch layer 3 data packets.

[0083] S240: Obtain a dynamic forwarding table entry from the network interaction information of the switch through dynamic learning according to the network protocol, and save it in the current forwarding work table.

[0084] For the method and advantages of this step, please refer to step S110 of an embodiment of a method for updating a static forwarding table of a switch.

[0085] In addition, in the forwarding work table, the ARP dynamic identifier and routing dynamic identifier of the table items obtained through the static forwarding table are 1, the ARP dynamic identifier and routing dynamic identifier of the dynamic forwarding table items obtained through dynamic learning and not saved in the current static forwarding table are 2, and the ARP dynamic identifier and routing dynamic identifier of the dynamic forwarding table items obtained through dynamic learning and saved in the current static forwarding table are 3.

[0086] S250: Determine whether the dynamic-static conversion enabling switch is turned on.

[0087] In this embodiment, the dynamic forwarding table entries are saved in the static forwarding table at regular intervals, so it is determined at regular intervals whether the dynamic-static conversion enable is turned on.

[0088] When the dynamic-static conversion enabling switch is turned on, step S260 is executed; otherwise, the saving process of the dynamic entry is terminated.

[0089] S260: Set the routing identifier and the ARP identifier of the dynamic entry to be saved in the current forwarding work table to 3.

[0090] Among them, the dynamic table entry with a routing identifier or ARP identifier of 2 is a dynamic table entry to be saved, that is, the table entry in the forwarding work table obtained through dynamic learning but not saved in the static forwarding table. The dynamic table entry with a routing identifier and ARP identifier of 3 is the dynamic table entry obtained through dynamic learning but saved in the static forwarding table.

[0091] S270: Determine whether the static forwarding table contains an entry corresponding to the dynamic entry to be saved.

[0092] If the static forwarding table has an entry corresponding to the dynamic entry to be saved, step S280 is executed; otherwise, step S290 is executed.

[0093] According to whether the routing key information of the dynamic entry to be saved is the same as that of any entry in the static forwarding table, it is determined whether the static forwarding table has an entry corresponding to the dynamic entry to be saved.

[0094] S280: Determine whether the corresponding entry in the static forwarding table has the same outgoing address information as the dynamic entry to be saved.

[0095] When the outgoing address information of the corresponding entry in the static forwarding table is different from that of the dynamic entry to be saved, step S290 is executed; otherwise, the saving process of the dynamic entry is terminated.

[0096] Among them, let the corresponding table entry of the static forwarding table be table entry i. When the next-hop IP address of table entry i is different from the next-hop IP address of the dynamic table entry to be saved, step S290 is executed; when the next-hop IP address of table entry i is the same as the next-hop IP address of the dynamic table entry to be saved, but the MAC address and / or port number of table entry i and the dynamic table entry to be saved are different, step S290 is executed.

[0097] S290: Save the outgoing address information of the dynamic entry to be saved into the static forwarding table.

[0098] In summary, the second embodiment of a method for updating a static forwarding table of a switch saves a dynamic forwarding entry into the static forwarding table only when it is determined that the outgoing address information of the dynamic forwarding entry is not repeated with that of any entry in the static forwarding table, so as to avoid redundancy and maintain an indirect static forwarding table.

[0099] The following combination Figure 4 A third embodiment of a method for updating a static forwarding table of a switch according to the present invention is introduced.

[0100] A third embodiment of a method for updating a static forwarding table of a switch inherits the method of the first embodiment of a method for updating a static forwarding table of a switch and has all the advantages of the first embodiment of a method for updating a static forwarding table of a switch. When the switch port transmission changes, the switch port numbers of the corresponding entries in the forwarding work table and the static forwarding table are replaced, thereby quickly generating a new static forwarding table and improving the service smoothness of the switch when the port is replaced.

[0101] Figure 4 The flowchart of the second embodiment of a method for updating a static forwarding table of a switch is shown, including steps S310 to S340.

[0102] S310: Obtain a dynamic forwarding table entry from the network interaction information of the switch through dynamic learning according to the network protocol, and save it in the current forwarding work table.

[0103] For the method and advantages of this step, please refer to step S110 of an embodiment of a method for updating a static forwarding table of a switch.

[0104] S320: When the dynamic-static conversion enabling switch is turned on, the dynamic forwarding table entry is saved in the static forwarding table.

[0105] For the method and advantages of this step, please refer to step S120 of an embodiment of a method for updating a static forwarding table of a switch.

[0106] S330: When port N of the switch changes to port M, the ports in the corresponding entries in the forwarding work table and the static forwarding table are changed from port N to port M in batches.

[0107] The corresponding entry in the forwarding work table is the entry in which the port included in the outgoing address information is port N. The corresponding entry in the static forwarding table is the entry in which the port included in the outgoing address information is port N.

[0108] For example, for the unicast scenario, when port N of the switch changes to port M, the port N of the ARP table entry of the corresponding entry in the unicast static forwarding table is replaced with port M, and the port N of the ARP table entry of the corresponding entry in the unicast forwarding work table is replaced with port M.

[0109] In some embodiments, the ports of the entries from the dynamic forwarding table that are already stored in the static forwarding table in the forwarding work table are batch-changed from port N to port M, and the ports of the entries corresponding to these entries in the static table are updated.

[0110] As described above, by batch changing the ports in the corresponding entries in the forwarding work table from port N to port M, there is no need to gradually update through dynamic learning, so the impact on switch performance is minimized when the switch port is replaced. At the same time, by batch changing the ports in the corresponding entries in the static forwarding table from port N to port M, the update efficiency of the static forwarding table is improved.

[0111] S340: When the switch starts, the latest static forwarding table is used as the forwarding work table of the switch.

[0112] In summary, in a third embodiment of a method for updating a static forwarding table of a switch, when a switch port transmission changes, the switch port numbers of the corresponding entries in the forwarding work table and the static forwarding table are replaced in batches, thereby quickly generating a new forwarding work table and static forwarding table, and improving the service smoothness of the switch during port replacement.

[0113] The following combination Figures 5 to 7 An embodiment of a device for updating a static forwarding table of a switch according to the present invention is introduced.

[0114] Figure 5 The structure of a first embodiment of a device for updating a static forwarding table of a switch is shown, which includes: a dynamic learning module 510 and a static storage module 520 .

[0115] The dynamic learning module 510 is used to obtain dynamic forwarding table entries from the network interaction information of the switch through dynamic learning according to the network protocol, and save the dynamic forwarding table entries into the forwarding work table of the switch layer 3.

[0116] The static storage module 520 is used to save the dynamic forwarding table entries into the static forwarding table when the dynamic-static conversion enabling switch is turned on.

[0117] Figure 6 The structure of a second embodiment of a device for updating a static forwarding table of a switch is shown, which includes: a switch startup module 610 , a dynamic learning module 620 and a static storage module 630 .

[0118] Switch startup module 610 is used to read the configuration file after the switch is powered on and the system is started. It is also used to determine whether the configuration file includes a static forwarding table. If the configuration file includes a static forwarding table, it is further used to use the static forwarding table as the switch layer 3 forwarding table for normal switch layer 3 packet forwarding. For its operating principles and advantages, please refer to steps S210 to S230 of Example 2 of a method for updating a switch static forwarding table.

[0119] The dynamic learning module 620 is used to obtain dynamic forwarding table entries from the network interaction information of the switch through dynamic learning according to the network protocol and save them in the current forwarding work table. Its working principle and advantages can be seen in step S240 of the second embodiment of a method for updating the static forwarding table of a switch.

[0120] Static storage module 630 is used to determine whether the dynamic-static conversion enable switch is on; set the route identifier and ARP identifier of the dynamic entry to be saved in the current forwarding work table to 3; determine whether the static forwarding table contains an entry corresponding to the dynamic entry to be saved; determine whether the corresponding entry in the static forwarding table duplicates the outgoing address information of the dynamic entry to be saved; and save the outgoing address information of the dynamic entry to be saved in the static forwarding table. For its operating principle and advantages, please refer to steps S250 to S290 of Example 2 of a method for updating a static forwarding table of a switch.

[0121] Figure 7 The structure of a second embodiment of a device for updating a static forwarding table of a switch is shown, which includes: a dynamic learning module 710 , a static storage module 720 , a port replacement module 730 and a work table acquisition module 740 .

[0122] The dynamic learning module 710 is used to obtain dynamic forwarding table entries from the network interaction information of the switch through dynamic learning according to the network protocol and save them in the current forwarding work table. Its working principle and advantages can be seen in step S310 of the third embodiment of a method for updating the static forwarding table of a switch.

[0123] The static storage module 720 is used to save the dynamic forwarding table entries to the static forwarding table when the dynamic-static conversion enable switch is turned on. For its working principle and advantages, please refer to step S320 of the third embodiment of a method for updating the static forwarding table of a switch.

[0124] The port replacement module 730 is used to batch replace the ports in the corresponding entries in the forwarding table and the static forwarding table from port N to port M when port N of the switch changes to port M. For its working principle and advantages, please refer to step S330 of the third embodiment of a method for updating the static forwarding table of a switch.

[0125] The working table acquisition module 740 is used to use the latest static forwarding table as the forwarding working table of the switch when the switch starts. For its working principle and advantages, please refer to step S340 of the third embodiment of a method for updating the static forwarding table of a switch.

[0126] An embodiment of the present invention further provides a switch that updates a static forwarding table using the method described in Embodiment 1, Embodiment 2, or Embodiment 3 of a method for updating a static forwarding table of a switch.

[0127] The embodiment of the present invention further provides a computing device, Figure 8 Detailed introduction.

[0128] The computing device 800 includes a processor 810 , a memory 820 , a communication interface 830 , and a bus 840 .

[0129] It should be understood that the communication interface 830 in the computing device 800 shown in this figure can be used to communicate with other devices.

[0130] The processor 810 may be connected to a memory 820. The memory 820 may be used to store the program code and data. Therefore, the memory 820 may be a storage unit within the processor 810, an external storage unit independent of the processor 810, or a component including both a storage unit within the processor 810 and an external storage unit independent of the processor 810.

[0131] Optionally, computing device 800 may further include a bus 840. Memory 820 and communication interface 830 may be connected to processor 810 via bus 840. Bus 840 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, for example. Bus 840 may be classified as an address bus, a data bus, a control bus, and the like. For ease of illustration, the figure uses only one line, but this does not imply that there is only one bus or only one type of bus.

[0132] It should be understood that in the embodiment of the present invention, the processor 810 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 810 may be one or more integrated circuits for executing relevant programs to implement the technical solutions provided in the embodiment of the present invention.

[0133] The memory 820 may include a read-only memory and a random access memory, and provides instructions and data to the processor 810. A portion of the processor 810 may also include a non-volatile random access memory. For example, the processor 810 may also store information about the device type.

[0134] When the computing device 800 is running, the processor 810 executes the computer-executable instructions in the memory 820 to perform the operating steps of each method embodiment.

[0135] It should be understood that the computing device 800 according to an embodiment of the present invention can correspond to the corresponding subjects in the methods according to various embodiments of the present invention, and the above-mentioned and other operations and / or functions of each module in the computing device 800 are respectively for implementing the corresponding processes of each method of the embodiment of the present method. For the sake of brevity, they will not be repeated here.

[0136] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0137] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0138] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0139] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present method.

[0140] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0141] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the decoding method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0142] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which is used to execute the operating steps of each method embodiment when the program is executed by a processor.

[0143] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include, an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0144] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0145] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0146] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0147] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of protection of the present invention.

Claims

1. A method for updating a static forwarding table of a switch, characterized in that: include: Obtaining dynamic forwarding table entries from the network interaction information of the switch through dynamic learning according to the network protocol, and saving the entries to the forwarding work table of the switch layer 3; When the dynamic-static conversion enabling switch is turned on, the dynamic forwarding table entry is saved in the static forwarding table, so that the static forwarding table is used as the forwarding working table when the switch is started next time; Each entry in the forwarding work table, each entry in the static forwarding table, and each dynamic forwarding table entry includes outgoing address information, and the outgoing address information includes routing address information and ARP address information of the corresponding entry; Among them, each table entry in the forwarding work table also includes: a routing dynamic identifier and an ARP dynamic identifier, which are respectively used to identify whether the routing address information of the table entry is statically configured or obtained through the dynamic learning and whether the ARP address information of the table entry is statically configured or obtained through the dynamic learning.

2. The method according to claim 1, characterized in that The step of storing the dynamic forwarding table entry in the static forwarding table specifically includes: When the outgoing address information of the dynamic forwarding entry is not repeated with that of any entry in the static forwarding table, the forwarding address information of the dynamic forwarding entry is saved in the static forwarding table.

3. The method according to claim 1, characterized in that The routing dynamic identifier of each dynamic table entry in the forwarding work table is also used to identify whether the routing address information of the table entry has been saved in the static forwarding table, and the ARP dynamic identifier of each dynamic table entry is also used to identify whether the ARP address information of the table entry has been saved in the static forwarding table. The dynamic table entry is an entry from the dynamic forwarding table entry in the forwarding work table.

4. The method according to claim 1, characterized in that Each of the outgoing address information includes its corresponding port; The method further includes: when the corresponding port changes from port N to port M, changing the corresponding ports of corresponding entries in the dynamic forwarding table from port N to port M in batches.

5. The method according to claim 1, characterized in that: The network protocol is set according to the business requirements of the switch.

6. A device for updating a static forwarding table of a switch, characterized in that: include: A dynamic learning module, configured to obtain dynamic forwarding table entries from the network interaction information of the switch through dynamic learning according to the network protocol, and save the entries to the forwarding work table of the switch layer 3; a static storage module for saving the dynamic forwarding table entries to the static forwarding table when the dynamic / static conversion enabling switch is turned on, so that the static forwarding table is used as the forwarding work table when the switch is started next time; Each entry in the forwarding work table, each entry in the static forwarding table, and each dynamic forwarding table entry includes outgoing address information, and the outgoing address information includes routing address information and ARP address information of the corresponding entry; Among them, each table entry in the forwarding work table also includes: a routing dynamic identifier and an ARP dynamic identifier, which are respectively used to identify whether the routing address information of the table entry is statically configured or obtained through the dynamic learning and whether the ARP address information of the table entry is statically configured or obtained through the dynamic learning.

7. A switch, characterized in that: include: The device according to claim 6.

8. A computing device, characterized in that include, bus; a communication interface connected to the bus; at least one processor connected to the bus; as well as At least one memory is connected to the bus and stores program instructions, and when the program instructions are executed by the at least one processor, the at least one processor executes the method according to any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that Program instructions are stored thereon, and when the program instructions are executed by a computer, the computer is caused to perform the method according to any one of claims 1 to 5.