Network equipment upgrading method and system, electronic equipment and storage medium
By automatically obtaining and detecting the IP address of network equipment, determining the upgrade server based on the device type and network segment priority, solving the problem of low upgrade efficiency caused by manual configuration of IP addresses, and realizing the automated software upgrade process.
Patent Information
- Application Number
- CN202411518859.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, software upgrade of network equipment relies on manually configuring IP addresses and entering the upgrade server IP addresses, resulting in IP addresses conflicts and input errors, reducing the efficiency of software upgrades.
Determine the target file name of the software to be upgraded based on the device type or specified characteristics of the network device, and obtain the neighbor IP address from the data packet and the specified network segment through detection priority, and automatically send the request message to obtain the upgrade file. If an error is received, it will be obtained. The message re-probes the IP address.
It realizes automatic acquisition and detection of IP addresses, improves the efficiency of software upgrades, reduces the time for manual configuration and adjustment, and simplifies the upgrade process.
Smart Images

Figure CN119135532A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a network device upgrading method, system, electronic device and storage medium. Background Art
[0002] Network devices usually have the need to upgrade their software. Currently, they still rely on technicians to manually upgrade the software for network devices. Specifically, the technicians manually configure the IP address of the network device and manually enter the IP address of the upgrade server to upgrade the software of the network device.
[0003] However, on the one hand, when manually configuring the IP address of the network device, there is no way to ensure that the configured IP address is not occupied by other devices; on the other hand, manually entering the IP address of the upgrade server is prone to input errors; when the above two problems occur, it takes time to adjust and troubleshoot, and the software upgrade efficiency is low. Summary of the invention
[0004] In view of this, the embodiments of the present invention provide a network device upgrade method, system, electronic device and storage medium to solve the problem of low software upgrade efficiency when technicians manually upgrade the software of network devices.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] A first aspect of an embodiment of the present invention discloses a network device upgrade method, which is applied to a network device and includes:
[0007] Determining the target file name of the software to be upgraded according to the device type or specified characteristics of the network device;
[0008] In response to the upgrade command, a plurality of neighbor IP addresses are acquired, wherein the plurality of neighbor IP addresses are derived from the data packets received by the network device and at least one designated network segment;
[0009] Determine the IP address to be detected from the plurality of neighbor IP addresses according to the detection priority, wherein the detection priority of the neighbor IP address originating from the data packet is higher than the detection priority of the neighbor IP address originating from the designated network segment;
[0010] Sending a request message carrying at least the target file name to the IP address to be detected;
[0011] If an upgrade file related to the target file name is returned by the device corresponding to the IP address to be detected, the software to be upgraded is upgraded according to the upgrade file;
[0012] If an error message returned by the device corresponding to the IP address to be detected is received, the IP address to be detected is excluded, and the process returns to the step of determining the IP address to be detected from the plurality of neighbor IP addresses according to the detection priority.
[0013] Preferably, in response to the upgrade command, obtaining multiple neighbor IP addresses includes:
[0014] In response to the upgrade command, extracting a source IP address from a data packet received by the network device to obtain a neighbor IP address;
[0015] An Address Resolution Protocol (ARP) probe is sent to each IP address in a specified network segment to determine that an IP address in the specified network segment that returns an ARP reply message is a neighbor IP address.
[0016] Preferably, determining the target file name of the software to be upgraded according to the device type or specified characteristics of the network device includes:
[0017] Searching for a file name corresponding to a device type or a specified feature of the network device from a preset naming table to obtain a target file name of the software to be upgraded;
[0018] The naming table at least includes: the correspondence between the device type and the file name, the correspondence between the specified feature and the file name; the specified feature includes one or a combination of device version, product identification, company name and software type.
[0019] Preferably, at least one designated network segment includes: network segment 192, network segment 10 and network segment 172; the detection priority of the neighbor IP address originating from the network segment 192 is higher than the detection priority of the neighbor IP address originating from the network segment 10, and the detection priority of the neighbor IP address originating from the network segment 10 is higher than the detection priority of the neighbor IP address originating from the network segment 172.
[0020] A second aspect of an embodiment of the present invention discloses a network device upgrade system, the system being applied to a network device, the system comprising:
[0021] A first determining unit, configured to determine a target file name of the software to be upgraded according to a device type or a specified feature of the network device;
[0022] An acquisition unit, configured to acquire a plurality of neighbor IP addresses in response to an upgrade command, wherein the plurality of neighbor IP addresses are derived from data packets received by the network device and at least one designated network segment;
[0023] A second determining unit, configured to determine the IP address to be detected from the plurality of neighbor IP addresses according to the detection priority, wherein the detection priority of the neighbor IP address originating from the data packet is higher than the detection priority of the neighbor IP address originating from the specified network segment;
[0024] A sending unit, configured to send a request message carrying at least the target file name to the IP address to be detected in response to the upgrade command;
[0025] An upgrading unit, configured to upgrade the software to be upgraded according to the upgrading file if an upgrading file related to the target file name is received and returned by the device corresponding to the IP address to be detected;
[0026] The exclusion unit is used to exclude the IP address to be detected if an error message returned by the device corresponding to the IP address to be detected is received, and return to execute the second determination unit.
[0027] Preferably, the acquisition unit includes:
[0028] An extraction module, used for extracting a source IP address from a data packet received by the network device to obtain a neighbor IP address;
[0029] The probe module is used to send an Address Resolution Protocol (ARP) probe to each IP address in a specified network segment, and determine that the IP address that returns an ARP reply message in the specified network segment is a neighbor IP address.
[0030] Preferably, the first determining unit is specifically used to: search for a file name corresponding to a device type or a specified feature of the network device from a preset naming table to obtain a target file name of the software to be upgraded;
[0031] The naming table at least includes: the correspondence between the device type and the file name, the correspondence between the specified feature and the file name; the specified feature includes one or a combination of device version, product identification, company name and software type.
[0032] Preferably, at least one designated network segment includes: network segment 192, network segment 10 and network segment 172; the detection priority of the neighbor IP address originating from the network segment 192 is higher than the detection priority of the neighbor IP address originating from the network segment 10, and the detection priority of the neighbor IP address originating from the network segment 10 is higher than the detection priority of the neighbor IP address originating from the network segment 172.
[0033] A third aspect of an embodiment of the present invention discloses an electronic device, comprising: a processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; and the memory is used to store a program, wherein the program is used to implement the network device upgrade method disclosed in the first aspect of the embodiment of the present invention.
[0034] A fourth aspect of an embodiment of the present invention discloses a computer-readable storage medium, in which computer-executable instructions are stored. The computer-executable instructions are used to execute the network device upgrading method disclosed in the first aspect of the embodiment of the present invention.
[0035] Based on the above-mentioned embodiment of the present invention, a network device upgrade method, system, electronic device and storage medium are provided. The method is as follows: according to the device type or specified characteristics of the network device, determine the target file name of the software to be upgraded; in response to the upgrade command, obtain multiple neighbor IP addresses, and the multiple neighbor IP addresses are derived from the data packets received by the network device and at least one specified network segment; determine the IP address to be detected from the multiple neighbor IP addresses according to the detection priority; send a request message carrying at least the target file name to the IP address to be detected; if the upgrade file returned by the device corresponding to the IP address to be detected is received, upgrade the software to be upgraded according to the upgrade file; if the error message returned by the device corresponding to the IP address to be detected is received, exclude the IP address to be detected, and return to execute the step of determining the IP address to be detected from the multiple neighbor IP addresses according to the detection priority. In this scheme, the target file name of the software to be upgraded is obtained according to the device type or specified characteristics of the network device. According to the detection priority, the IP address to be detected is determined from the neighbor IP addresses obtained from the data packet and at least one specified network segment. A request message carrying at least the target file name is sent to the IP address to be detected. If an upgrade file is received, the software to be upgraded is upgraded according to the upgrade file. If an error message is received, the IP address to be detected is re-determined according to the detection priority, thereby realizing automatic acquisition and detection of the IP address and improving the efficiency of software upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0037] Figure 1 A flowchart of a network device upgrade method provided by an embodiment of the present invention;
[0038] Figure 2 An example diagram of part of the contents of a naming table provided in an embodiment of the present invention;
[0039] Figure 3 An example diagram of the contents of an ARP probe provided in an embodiment of the present invention;
[0040] Figure 4 An example diagram of detection priority provided by an embodiment of the present invention;
[0041] Figure 5 An example diagram of data interaction between a network device and a TFTP upgrade server provided in an embodiment of the present invention;
[0042] Figure 6 An example diagram of the TFTP protocol message format provided by an embodiment of the present invention;
[0043] Figure 7 Another flow chart of a network device upgrading method provided by an embodiment of the present invention;
[0044] Figure 8 A structural block diagram of a network device upgrading system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0047] Network devices (such as switches, storage devices, and other devices with network communication capabilities) usually need to upgrade their software. For example, when the current functions of the network device do not meet the requirements, the software needs to be upgraded. Another example is when the software of the network device has a bug. At present, it still depends on technicians to manually upgrade the software of network devices. The existing methods for upgrading network devices are as follows:
[0048] Connect the network device and the upgrade server (a device capable of running service software, usually a computer with an operating system) through a network cable; the technician starts the service software required for the upgrade on the upgrade server and configures the user, password and directory for storing the upgrade file, wherein the service software may be a Trivial File Transfer Protocol (TFTP) software;
[0049] The technician checks and records the Internet Protocol (IP) address of the upgrade server and copies the upgrade file to the directory of the upgrade server;
[0050] The technician configures the IP address of the network device to connect the network device to the upgrade server, and enters a character string on the network device, which includes the IP address of the upgrade server, user name, password and name of the upgrade file. At this time, the network device connects to the upgrade server and starts downloading the upgrade file. After the download is complete, the upgrade file is used to upgrade the software.
[0051] However, the above existing methods for upgrading network devices have the following problems:
[0052] Problem 1: You need to manually configure the IP address of the network device and check whether the network device and the upgrade server are connected;
[0053] Problem 2: When configuring the IP address of a network device, it is not possible to ensure that the configured IP address cannot be used by other devices, otherwise it will affect the upgrade and affect the normal use of other devices;
[0054] Problem 3: After the network device is connected to the upgrade server, you still need to manually enter the IP address of the upgrade server and the name of the upgrade file during the upgrade process, which is prone to input errors;
[0055] The aforementioned problems all require time-consuming adjustments and troubleshooting, and the software upgrade efficiency is low.
[0056] To solve the above problems, the embodiments of the present invention provide a network device upgrade method, system, electronic device and storage medium, which obtain the target file name of the software to be upgraded according to the device type or specified characteristics of the network device. According to the detection priority, the IP address to be detected is determined from the neighbor IP addresses obtained from the data packet and at least one specified network segment. A request message carrying at least the target file name is sent to the IP address to be detected. If an upgrade file is received, the software to be upgraded is upgraded according to the upgrade file. If an error message is received, the IP address to be detected is re-determined according to the detection priority, so as to realize automatic acquisition and detection of the IP address, thereby improving the efficiency of software upgrade.
[0057] See also Figure 1, shows a flow chart of a network device upgrade method provided by an embodiment of the present invention, the network device upgrade method is applied to a network device, and the network device upgrade method includes:
[0058] Step S101: Determine the target file name of the software to be upgraded according to the device type or specified characteristics of the network device.
[0059] It should be noted that the software of network devices is usually provided by the device manufacturer. In order to distinguish various types of software from each other, the software and the corresponding file names are named in advance according to a preset naming method, and a naming table is constructed based on these file names.
[0060] In the specific implementation of step S101, when the network device is started, the target file name of the software to be upgraded is determined according to the device type or specified characteristics of the network device.
[0061] Specifically, the file name corresponding to the device type or specified feature of the network device is searched from the preset naming table to obtain the target file name of the software to be upgraded. The target file name is "the file name corresponding to the device type or specified feature of the network device".
[0062] The naming table at least includes: the correspondence between device type and file name, and the correspondence between specified features and file name; the specified features include one or a combination of device version, product identification, company name and software type.
[0063] That is, in the naming table, the file name is uniquely identified by the device type, and the file name is uniquely identified by the specified characteristics.
[0064] For example Figure 2 As can be seen from the example diagram of part of the content of the naming table, the file name corresponding to the device type "cp2481" is "cp2481.bin"; the file name corresponding to the device type "st2291" is "st2291.bin".
[0065] For another example: a file name is uniquely identified by only the product ID (such as sw1001), or a combination of the product ID and the device version (such as sw1001_v2) is used to uniquely identify the file name, or a combination of the product ID, device version and software type (such as sw1001_v2.bin) is used to uniquely identify the file name.
[0066] Step S102: In response to the upgrade command, a plurality of neighbor IP addresses are obtained, where the plurality of neighbor IP addresses are derived from data packets received by the network device and at least one designated network segment.
[0067] In the specific implementation of step S102, in response to an upgrade command input by a user (such as the upgrade command input by the user), the neighbor IP address detection is started. Specifically, in response to the upgrade command, the source IP address is extracted from the data packet received by the network device to obtain the neighbor IP address;
[0068] And send an Address Resolution Protocol (ARP) probe to each IP address in the specified network segment to determine that the IP address that returns an ARP reply message (ARP reply) in the specified network segment is the neighbor IP address.
[0069] In some embodiments, the at least one designated network segment includes commonly used network segments such as network segment 192, network segment 10, and network segment 172, as well as other uncommonly used network segments.
[0070] That is, in response to the upgrade command input by the user, the data packets passively received by the network device are monitored, and the source IP address is extracted from the monitored data packets as the neighbor IP address, and the neighbor IP address extracted from the data packets passively received by the network device is called the "monitored neighbor IP address";
[0071] ARP probes are sent to the IP addresses in each specified network segment to determine that the IP addresses that return ARP reply messages in these specified network segments are neighbor IP addresses (for example, 192.168.0.1 or 10.1.1.1). The IP addresses that return ARP reply messages in the specified network segment are called "not monitored neighbor IP addresses."
[0072] It should be noted that the ARP probe specifically refers to an ARP request message, the destination address in the ARP request message is a legal IP address, and the source IP address of the ARP request message is 0.0.0.0;
[0073] If there is an IP address in the specified network segment that is the same as the destination IP address in the ARP probe, then the IP address will send an ARP reply message (ARP reply) to the network device. The ARP reply message (ARP reply) is used to indicate that the IP address has been occupied. In this way, the network device knows the IP address and then determines that the IP address is a neighbor IP address.
[0074] When a network device sends an ARP probe to an IP address of a specified network segment, the network device determines how many ARP probes to send at one time based on its own performance. For example, the network device sends 100 ARP probes at one time to detect the neighbor's IP address.
[0075] For example: A network device sends a message to a specified network segment. Figure 3The ARP probe shown determines that the IP address that returns the ARP reply message in the specified network segment is the neighbor IP address, where: Figure 3 The senderIP in the MAC field is all 0, the Target MAC field is all 0, and the Target IP is the IP address of the device itself.
[0076] Step S103: Determine the IP address to be detected from multiple neighbor IP addresses according to the detection priority.
[0077] It should be noted that the at least one designated network segment includes commonly used network segments such as network segment 192, network segment 10 and network segment 172, as well as other uncommon network segments; a detection priority is pre-set, and the detection priority specifies the detection order of neighbor IP addresses from different sources;
[0078] The specific contents of the detection priority are as follows: Figure 4 As shown, the detection priority of the neighbor IP address originating from the data packet is higher than the detection priority of the neighbor IP address originating from the specified network segment, the detection priority of the neighbor IP address originating from the network segment 192 is higher than the detection priority of the neighbor IP address originating from the network segment 10, the detection priority of the neighbor IP address originating from the network segment 10 is higher than the detection priority of the neighbor IP address originating from the network segment 172, and the detection priority of the neighbor IP address originating from the network segment 172 is higher than the neighbor IP addresses originating from other uncommon network segments.
[0079] That is to say, for the data packets received by the monitored network device, the source IP address contained in the data packet (that is, the neighbor IP address extracted from the data packet) is likely to be the address of the upgrade server (such as the TFTP upgrade server). Therefore, the neighbor IP address from the data packet is detected first, and then the neighbor IP address from the 192 network segment (such as the 192.168.0.0 / 16 network segment address) is detected, and then the neighbor IP address from the 10 network segment (such as the 10.0.0.0 / 8 network segment address) is detected, and then the neighbor IP address from the 172 network segment (such as the 172.0.0.0 / 8 network segment address) is detected, and finally the neighbor IP address from other uncommon network segments is detected.
[0080] In the specific implementation of step S103, the IP address to be detected is determined from the multiple neighbor IP addresses according to the detection priority, specifically, the IP address to be detected is determined from the multiple neighbor IP addresses according to the detection priority described above.
[0081] For example: when determining the IP address to be detected for the first time, first determine the neighbor IP address from the data packet as the IP address to be detected and perform the detection of the following steps S104-S106; if the neighbor IP address from the data packet is detected and the upgrade server is still not found, continue to determine the neighbor IP address from the 192 network segment as the IP address to be detected and perform the detection of the following steps S104-S106, and so on, until the upgrade server is found or all neighbor IP addresses are detected or the detection process is interrupted manually.
[0082] Step S104: Send a request message carrying at least the target file name to the IP address to be detected.
[0083] In the specific implementation of step S104, after the IP address to be detected is determined, a request message (such as a TFTP request message) carrying at least the target file name is sent to the IP address to be detected to detect whether the upgrade server exists.
[0084] Specifically, the network device sends a TFTP request message carrying at least the target file name to the IP address to be detected. If the device corresponding to the IP address to be detected supports the TFTP protocol and has enabled the TFTP service, and if the device corresponding to the IP address to be detected contains an upgrade file related to the target file name, then it means that the device corresponding to the IP address to be detected is an upgrade server. At this time, the device corresponding to the IP address to be detected will respond with the content of the upgrade file of the network device. The network device then knows the address of the upgrade server and downloads the upgrade file related to the target file name from the upgrade server.
[0085] On the contrary, if the device corresponding to the IP address to be detected does not have an upgrade file related to the target file name, then the device corresponding to the IP address to be detected will respond to the network device with an error message (error message), which indicates that the device corresponding to the IP address to be detected does not have the upgrade file.
[0086] Step S105: If an upgrade file related to the target file name is received and returned by the device corresponding to the IP address to be detected, the software to be upgraded is upgraded according to the upgrade file.
[0087] In the process of implementing step S105, after the network device sends a request message carrying at least the target file name to the device corresponding to the IP address to be detected, if an upgrade file related to the target file name is returned by the device corresponding to the IP address to be detected (indicating that the device corresponding to the IP address to be detected is an upgrade server), the upgrade file is downloaded. After the download is successful, the upgrade file is used to upgrade the local software to be upgraded; after completing the upgrade of the software to be upgraded, stop ARP detection and detection of the upgrade server.
[0088] It should be noted that the interaction process between the network device and the device corresponding to the IP address to be detected is: the network device sends a request message carrying at least the target file name to the device corresponding to the IP address to be detected. If the device corresponding to the IP address to be detected has an upgrade file corresponding to the target file name, then the device corresponding to the IP address to be detected (upgrade server) will send part of the content of the upgrade file to the network device. After receiving this part of the content, the network device will feedback an acknowledgement character (ACK) message to indicate that this part of the content has been received.
[0089] To better explain how network devices download upgrade files from the upgrade server, Figure 5 The data interaction example diagram between the network device and the TFTP upgrade server is shown as an example. Figure 5 In the above example, port refers to the UDP (User Datagram Protocol) port number used in TFTP communication, and ACK refers to the ACK message sent by the network device to the TFTP upgrade server. The network device sends a request message carrying at least the name of the target file to the device corresponding to the IP address to be detected. If the device corresponding to the IP address to be detected is a TFTP upgrade server with an upgrade file, the network device sends the request message to the device corresponding to the IP address to be detected. Figure 5 The interactive mode shown is used to download the upgrade file from the TFTP upgrade server. Each time the network device receives part of the content of the upgrade file returned by the TFTP upgrade server, it sends an ACK message to the TFTP upgrade server (indicating that the network device has received this part of the content).
[0090] Step S106: If an error message is received from the device corresponding to the IP address to be detected, the IP address to be detected is excluded and the process returns to step S103.
[0091] In the process of implementing step S106, if an error message returned by the device corresponding to the IP address to be detected is received, it indicates that the device corresponding to the IP address to be detected is not a TFTP upgrade server having an upgrade file related to the target file name. At this time, the IP address to be detected currently being detected is excluded, and the process returns to step S103 to reselect the IP address to be detected until the upgrade server is found or all neighbor IP addresses are detected or the detection process is interrupted manually.
[0092] In some embodiments, during the process of repeatedly executing steps S103 to S106, if no TFTP upgrade server with an upgrade file related to the target file name is found after detecting all neighbor IP addresses, a prompt message is output, which is used to prompt the user to manually enter the address of the TFTP upgrade server.
[0093] Combined with the contents of steps S103 to S106 above, it can be seen that this solution uses the TFTP protocol to implement the software upgrade of the network device. The TFTP protocol message format is as follows: Figure 6 As shown, TFTP has a total of 5 message formats, namely read message (corresponding operation code = 1), write message (corresponding operation code = 2), DATA message (corresponding operation code = 3), ACK message (corresponding operation code = 4) and ERROR message (corresponding operation code = 5).
[0094] use Figure 6 The protocol message format shown in the figure, the interaction process between the network device and the device corresponding to the IP address to be detected is:
[0095] The network device sends a request message to the IP address to be detected (that is, Figure 6 The request message carries the target file name of the software to be upgraded;
[0096] If the device corresponding to the IP address to be detected has an upgrade file corresponding to the target file name, then the device corresponding to the IP address to be detected will send a DATA message (at least containing the content of the upgrade file) to the network device. At this time, the network device knows that the device corresponding to the IP address to be detected is a suitable upgrade server and can interrupt the detection;
[0097] On the contrary, if the device corresponding to the IP address to be detected does not have the upgrade file corresponding to the target file name, the device corresponding to the IP address to be detected will send an ERROR message (error message) to the network device. At this time, the network device knows that the device corresponding to the IP address to be detected is not a suitable upgrade server, and reselects the IP address to be detected to continue detecting the next neighbor IP address.
[0098] In an embodiment of the present invention, the target file name of the software to be upgraded is obtained according to the device type or specified characteristics of the network device. According to the detection priority, the IP address to be detected is determined from the neighbor IP addresses obtained from the data packet and at least one specified network segment. A request message carrying at least the target file name is sent to the IP address to be detected. If the upgrade file is received, the software to be upgraded is upgraded according to the upgrade file. If an error message is received, the IP address to be detected is re-determined according to the detection priority, thereby realizing automatic acquisition and detection of the IP address and improving the efficiency of software upgrade.
[0099] To better understand the above-mentioned embodiment of the present invention Figure 1 The following is the interaction process between the network device and the upgrade server. Figure 7 Another flowchart of a network device upgrade method is shown as an example. Figure 7 The steps include:
[0100] Step S701: The network device determines the target file name of the software to be upgraded according to its own device type or specified characteristics.
[0101] Step S702: The network device determines the detection priority of the neighbor IP address.
[0102] Step S703: The network device extracts the neighbor IP address from the received data packet, and determines the neighbor IP address from the specified network segment using an ARP probe.
[0103] Step S704: The network device detects the upgrade server based on the neighbor IP address and the TFTP request message, and ensures that the upgrade server has the upgrade file corresponding to the target file name.
[0104] Step S705: The network device downloads the upgrade file from the upgrade server using the TFTP protocol.
[0105] It should be noted that, during the process of detecting the upgrade server, the upgrade server will respond to the ARP probe and respond to the TFTP request message (ie, send the upgrade file to the network device).
[0106] Step S706: The network device upgrades the software to be upgraded according to the upgrade file.
[0107] It should be noted that the execution principle of steps S701 to S706 can be found in the above-mentioned embodiment of the present invention. Figure 1 The content will not be repeated here.
[0108] It can be seen from the contents of the above embodiments that this solution can automatically detect the upgrade server that supports the TFTP protocol without configuring the IP address of the network device. Only a simple upgrade command is required to automatically complete the software upgrade of the network device, which simplifies the software upgrade process and streamlines the configuration work, ultimately improving the software upgrade efficiency.
[0109] Corresponding to the network device upgrade method provided by the above embodiment of the present invention, see Figure 8 , an embodiment of the present invention further provides a structural block diagram of a network device upgrade system, the network device upgrade system is applied to a network device, the network device upgrade system comprises: a first determination unit 100, an acquisition unit 200, a second determination unit 300, a sending unit 400, an upgrade unit 500 and an exclusion unit 600;
[0110] The first determining unit 100 is used to determine the target file name of the software to be upgraded according to the device type or specified characteristics of the network device.
[0111] In a specific implementation, the first determining unit 100 is specifically used to: search for a file name corresponding to a device type or a specified feature of a network device from a preset naming table to obtain a target file name of the software to be upgraded;
[0112] The naming table at least includes: the correspondence between the device type and the file name, and the correspondence between the specified feature and the file name; the specified feature includes one or a combination of the device version, product identification, company name and software type.
[0113] The acquisition unit 200 is used to acquire multiple neighbor IP addresses in response to the upgrade command, where the multiple neighbor IP addresses are derived from data packets received by the network device and at least one designated network segment.
[0114] The second determining unit 300 is used to determine the IP address to be detected from multiple neighbor IP addresses according to the detection priority, wherein the detection priority of the neighbor IP address derived from the data packet is higher than the detection priority of the neighbor IP address derived from the specified network segment.
[0115] In some embodiments, at least one designated network segment includes: network segment 192, network segment 10 and network segment 172; the detection priority of the neighbor IP address originating from network segment 192 is higher than the detection priority of the neighbor IP address originating from network segment 10, and the detection priority of the neighbor IP address originating from network segment 10 is higher than the detection priority of the neighbor IP address originating from network segment 172.
[0116] The sending unit 400 is used to send a request message carrying at least a target file name to the IP address to be detected in response to the upgrade command.
[0117] The upgrading unit 500 is used to upgrade the software to be upgraded according to the upgrading file if an upgrading file related to the target file name is received and returned by the device corresponding to the IP address to be detected.
[0118] The excluding unit 600 is configured to exclude the IP address to be detected if an error message returned by the device corresponding to the IP address to be detected is received, and return to execute the second determining unit 300.
[0119] In an embodiment of the present invention, the target file name of the software to be upgraded is obtained according to the device type or specified characteristics of the network device. According to the detection priority, the IP address to be detected is determined from the neighbor IP addresses obtained from the data packet and at least one specified network segment. A request message carrying at least the target file name is sent to the IP address to be detected. If the upgrade file is received, the software to be upgraded is upgraded according to the upgrade file. If an error message is received, the IP address to be detected is re-determined according to the detection priority, thereby realizing automatic acquisition and detection of the IP address and improving the efficiency of software upgrade.
[0120] Preferably, combined Figure 8 The content shown, the acquisition unit 200 includes an extraction module and a probe module, and the execution principle of each module is as follows:
[0121] The extraction module is used to extract the source IP address from the data packet received by the network device to obtain the neighbor IP address.
[0122] The probe module is used to send ARP probes to each IP address in the specified network segment, and determine that the IP address that returns the ARP reply message in the specified network segment is the neighbor IP address.
[0123] Preferably, an embodiment of the present invention also provides an electronic device, comprising: a processor and a memory, the processor and the memory being connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; the memory is used to store a program, and the program is used to implement the network device upgrade method provided in the above method embodiment.
[0124] Preferably, an embodiment of the present invention further provides a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are used to execute the network device upgrading method provided by the above method embodiment.
[0125] In summary, the embodiments of the present invention provide a network device upgrade method, system, electronic device and storage medium, which obtain the target file name of the software to be upgraded according to the device type or specified characteristics of the network device. According to the detection priority, the IP address to be detected is determined from the neighbor IP addresses obtained from the data packet and at least one specified network segment. A request message carrying at least the target file name is sent to the IP address to be detected. If an upgrade file is received, the software to be upgraded is upgraded according to the upgrade file. If an error message is received, the IP address to be detected is re-determined according to the detection priority, so as to realize automatic acquisition and detection of the IP address and improve the efficiency of software upgrade.
[0126] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0127] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0128] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A network device upgrade method, characterized in that: The method is applied to a network device, and the method comprises: Determining the target file name of the software to be upgraded according to the device type or specified characteristics of the network device; In response to the upgrade command, a plurality of neighbor IP addresses are acquired, wherein the plurality of neighbor IP addresses are derived from the data packets received by the network device and at least one designated network segment; Determine the IP address to be detected from the plurality of neighbor IP addresses according to the detection priority, wherein the detection priority of the neighbor IP address originating from the data packet is higher than the detection priority of the neighbor IP address originating from the designated network segment; Sending a request message carrying at least the target file name to the IP address to be detected; If an upgrade file related to the target file name is returned by the device corresponding to the IP address to be detected, the software to be upgraded is upgraded according to the upgrade file; If an error message returned by the device corresponding to the IP address to be detected is received, the IP address to be detected is excluded, and the process returns to the step of determining the IP address to be detected from the plurality of neighbor IP addresses according to the detection priority.
2. The method according to claim 1, characterized in that: In response to the upgrade command, multiple neighbor IP addresses are obtained, including: In response to the upgrade command, extracting a source IP address from a data packet received by the network device to obtain a neighbor IP address; An Address Resolution Protocol (ARP) probe is sent to each IP address in a specified network segment to determine that an IP address in the specified network segment that returns an ARP reply message is a neighbor IP address.
3. The method according to claim 1, characterized in that: According to the device type or specified characteristics of the network device, determine the target file name of the software to be upgraded, including: Searching for a file name corresponding to a device type or a specified feature of the network device from a preset naming table to obtain a target file name of the software to be upgraded; The naming table at least includes: the correspondence between the device type and the file name, the correspondence between the specified feature and the file name; the specified feature includes one or a combination of device version, product identification, company name and software type.
4. The method according to any one of claims 1 to 3, characterized in that: At least one designated network segment includes: network segment 192, network segment 10 and network segment 172; the detection priority of the neighbor IP address originating from the network segment 192 is higher than the detection priority of the neighbor IP address originating from the network segment 10, and the detection priority of the neighbor IP address originating from the network segment 10 is higher than the detection priority of the neighbor IP address originating from the network segment 172.
5. A network equipment upgrade system, characterized in that: The system is applied to a network device, and the system comprises: A first determining unit, configured to determine a target file name of the software to be upgraded according to a device type or a specified feature of the network device; An acquisition unit, configured to acquire a plurality of neighbor IP addresses in response to an upgrade command, wherein the plurality of neighbor IP addresses are derived from data packets received by the network device and at least one designated network segment; A second determining unit, configured to determine the IP address to be detected from the plurality of neighbor IP addresses according to the detection priority, wherein the detection priority of the neighbor IP address originating from the data packet is higher than the detection priority of the neighbor IP address originating from the specified network segment; A sending unit, configured to send a request message carrying at least the target file name to the IP address to be detected in response to the upgrade command; An upgrading unit, configured to upgrade the software to be upgraded according to the upgrading file if an upgrading file related to the target file name is received and returned by the device corresponding to the IP address to be detected; The exclusion unit is used to exclude the IP address to be detected if an error message returned by the device corresponding to the IP address to be detected is received, and return to execute the second determination unit.
6. The system according to claim 5, characterized in that The acquisition unit comprises: An extraction module, used for extracting a source IP address from a data packet received by the network device to obtain a neighbor IP address; The probe module is used to send an Address Resolution Protocol (ARP) probe to each IP address in a specified network segment, and determine that the IP address that returns an ARP reply message in the specified network segment is a neighbor IP address.
7. The system according to claim 5, characterized in that The first determining unit is specifically used to: search for a file name corresponding to a device type or a specified feature of the network device from a preset naming table to obtain a target file name of the software to be upgraded; The naming table at least includes: the correspondence between the device type and the file name, the correspondence between the specified feature and the file name; the specified feature includes one or a combination of device version, product identification, company name and software type.
8. The system according to any one of claims 5 to 7, characterized in that: At least one designated network segment includes: network segment 192, network segment 10 and network segment 172; the detection priority of the neighbor IP address originating from the network segment 192 is higher than the detection priority of the neighbor IP address originating from the network segment 10, and the detection priority of the neighbor IP address originating from the network segment 10 is higher than the detection priority of the neighbor IP address originating from the network segment 172.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; The memory is used to store a program, and the program is used to implement the network device upgrading method as described in any one of claims 1-4.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the network device upgrading method described in any one of claims 1-4.
