CN114697211B - Network configuration method, device, equipment and storage medium - Google Patents

Network configuration method, device, equipment and storage medium Download PDF

Info

Publication number
CN114697211B
CN114697211B CN202210603546.0A CN202210603546A CN114697211B CN 114697211 B CN114697211 B CN 114697211B CN 202210603546 A CN202210603546 A CN 202210603546A CN 114697211 B CN114697211 B CN 114697211B
Authority
CN
China
Prior art keywords
network configuration
configuration information
target
equipment
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210603546.0A
Other languages
Chinese (zh)
Other versions
CN114697211A (en
Inventor
金玲
周波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Clerware Technology Co ltd
Original Assignee
Shenzhen Clerware Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Clerware Technology Co ltd filed Critical Shenzhen Clerware Technology Co ltd
Priority to CN202210603546.0A priority Critical patent/CN114697211B/en
Publication of CN114697211A publication Critical patent/CN114697211A/en
Application granted granted Critical
Publication of CN114697211B publication Critical patent/CN114697211B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/085Retrieval of network configuration; Tracking network configuration history
    • H04L41/0859Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions
    • H04L41/0863Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions by rolling back to previous configuration versions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention belongs to the field of communication, and discloses a network configuration method, a network configuration device, network configuration equipment and a storage medium. The method comprises the following steps: acquiring original network configuration information of target equipment, and acquiring target network configuration information set by a user; modifying the target equipment from the original network configuration information to target network configuration information; judging whether a confirmation instruction of a user is received within a preset time period; and when the confirmation instruction is not received within a preset time period, rolling back the target equipment from the target network configuration information to the original network configuration information. The invention rolls back the target equipment from the target network configuration information to the original network configuration information when the confirmation instruction is not received within the preset time period. Compared with the existing mode of using the modified network configuration after the network configuration is carried out on the communication equipment, the mode of the invention improves the efficiency of the network configuration and reduces the manual operation caused by the failure of the configuration.

Description

Network configuration method, device, equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a network configuration method, apparatus, device, and storage medium.
Background
In the field of communications, each communication device needs to be configured with a network. For a communication device, the correctness of the network configuration is crucial, and a wrong configuration will result in other communication devices not being able to access the device, as if it were not present. Other network devices cannot access it until it has the correct network configuration. Changing from the wrong network configuration back to the correct network configuration can be a lengthy process. For example: in one operation and maintenance, an operation and maintenance engineer remotely controls a server in the machine room A to carry out network configuration, and configures a wrong IP due to misoperation. For example: expected configuration 172.16.1.100, when IP is entered, yields 172.16.1.101. Because 172.16.1.101 already exists in the network environment, at this time, due to IP conflict, the preset IP cannot be configured and normal access of the existing machine with IP 172.16.1.101 is affected, so that both machines cannot be reachable through the network, or the two machines are alternately on-line, which affects the existing service. To resolve the network failure, the operation and maintenance engineer has to go to room a, find the machine with the wrong network information, connect to the display and keyboard, and configure the IP to 172.16.1.100. Changing from the wrong network configuration to the correct network configuration involves significant time and labor costs.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a network configuration method, a network configuration device, network configuration equipment and a storage medium, and aims to solve the technical problem that time and labor cost are wasted when network configuration is mistakenly changed in the prior art.
In order to achieve the above object, the present invention provides a network configuration method, including the following steps:
acquiring original network configuration information of target equipment;
acquiring target network configuration information set by a user, and modifying the target equipment from original network configuration information to the target network configuration information;
judging whether a confirmation instruction of a user is received within a preset time period;
and when the confirmation instruction is not received within the preset time period, rolling back the target equipment from the target network configuration information to the original network configuration information.
Optionally, the original network configuration information includes device configuration information and system network configuration information;
the acquiring of the original network configuration information of the target device includes:
acquiring equipment configuration information of all physical network equipment and virtual network equipment on target equipment;
acquiring system network configuration information of an operating system corresponding to the target equipment;
and displaying the composition relationship between the physical network equipment and the logic network equipment, the equipment configuration information and the system network configuration information to a user through an operation interface.
Optionally, the obtaining target network configuration information set by a user, and modifying the target device from original network configuration information to the target network configuration information includes:
acquiring target network configuration information set by a user;
recombining the physical network equipment and the virtual network equipment on the target equipment according to the target network configuration information;
and resetting the equipment configuration information and the system network configuration information according to the target network configuration information.
Optionally, after the step of modifying the target device from the original network configuration information to the target network configuration information, the method further includes:
starting a preset timer to start timing;
receiving a confirmation instruction sent by a user through a preset server;
and when the timing is finished, clearing the preset timer.
Optionally, before the recombining the physical network device and the virtual network device on the target device according to the target network configuration information, the method includes:
judging whether the target network configuration information modifies the connection address of the target equipment or not;
and when the connection address of the target equipment is modified, controlling a network configuration interface program to use the configured network connection address to connect the target equipment.
Optionally, after the resetting the device configuration information and the system network configuration information according to the target network configuration information, the method further includes:
obtaining the state information of a firewall;
and when the state information of the firewall is in an opening state, closing the firewall.
Optionally, after the step of determining whether a confirmation instruction of the user is received within a preset time period, the method further includes:
and after the confirmation instruction is received within the preset time period, configuring the firewall rules.
In addition, to achieve the above object, the present invention further provides a network configuration apparatus, including:
the acquisition module is used for acquiring the original network configuration information of the target equipment;
the modification module is used for acquiring target network configuration information set by a user and modifying the target equipment from original network configuration information to the target network configuration information;
the judging module is used for judging whether a confirmation instruction of the user is received within a preset time period;
and the rollback module is used for rolling back the target equipment from the target network configuration information to the original network configuration information when the confirmation instruction is not received within the preset time period.
In addition, to achieve the above object, the present invention further provides a network configuration device, including: a memory, a processor and a network configuration program stored on the memory and executable on the processor, the network configuration program being configured to implement the steps of the network configuration method as described above.
Furthermore, to achieve the above object, the present invention further provides a storage medium having a network configuration program stored thereon, wherein the network configuration program, when executed by a processor, implements the steps of the network configuration method as described above.
The invention obtains the target network configuration information set by the user; modifying the target equipment from the original network configuration information to the target network configuration information; judging whether a confirmation instruction of a user is received within a preset time period; and when the confirmation instruction is not received within the preset time period, rolling back the target equipment from the target network configuration information to the original network configuration information. The invention rolls back the target equipment from the target network configuration information to the original network configuration information when the confirmation instruction is not received in the preset time period. Compared with the existing mode of adopting modified network configuration after the communication equipment is subjected to network configuration, the mode of the invention can roll back the target equipment from the target network configuration information to the original network configuration information when the confirmation instruction is not received, thereby improving the efficiency of network configuration and reducing manual operation caused by configuration failure.
Drawings
Fig. 1 is a schematic structural diagram of a network configuration device of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a network configuration method according to the present invention;
FIG. 3 is a flowchart illustrating a network configuration method according to a second embodiment of the present invention;
fig. 4 is a block diagram of a network configuration device according to a first embodiment of the present invention.
The implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a network configuration device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the network configuration device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001 described previously.
Those skilled in the art will appreciate that the architecture shown in fig. 1 does not constitute a limitation of network configuration devices, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a network configuration program.
In the network configuration device shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the network configuration device of the present invention may be disposed in the network configuration device, and the network configuration device calls the network configuration program stored in the memory 1005 through the processor 1001 and executes the network configuration method provided by the embodiment of the present invention.
Based on the network configuration device, an embodiment of the present invention provides a network configuration method, and referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of the network configuration method according to the present invention.
In this embodiment, the network configuration method includes the following steps:
step S10: acquiring original network configuration information of target equipment;
it should be noted that the execution subject of the embodiment may be a computing service device with data processing, network communication and program running functions, such as a mobile phone, a tablet computer, a personal computer, etc., or an electronic device or a network configuration device capable of implementing the above functions. The present embodiment and the following embodiments will be described below by taking the network configuration device as an example.
Before adjusting the network configuration of the target device, the original network configuration information needs to be acquired and stored, and when the subsequent network configuration fails, the target device can be reconfigured through the stored network configuration, so that network configuration rollback is realized. In addition, the configuration information needs to be presented to the user through an interface, and the user can modify or adjust the configuration information through the operation interface. The method specifically comprises the following steps:
acquiring equipment configuration information of all physical network equipment and virtual network equipment on target equipment;
acquiring system network configuration information of an operating system corresponding to the target equipment;
and displaying the composition relationship between the physical network equipment and the logic network equipment, the equipment configuration information and the system network configuration information to a user through an operation interface.
It should be noted that the original network configuration information includes device configuration information and system network configuration information. The device configuration information includes: all physical Network devices (such as Network cards) on the target device, Virtual Network devices (such as Virtual switches, Virtual routers, and an aggregation Network card … …), and relationships between the Virtual Network devices and the physical Network devices (such as Virtual switches, Virtual routers connected to those physical Network devices, and an aggregation Network card composed of which physical Network cards … …), where the physical Network devices, device names of the Virtual Network devices, connection states, IP addresses, subnet masks, maximum transmission units, VLAN identifiers (Virtual Local Area networks), and the system Network configuration information includes Network configuration information of an operating system corresponding to the target device (such as DNS, gateways, routes, and the like of the system). The specific obtaining method may be through a command line, or may be through a programming interface of the system, which is not limited herein. In addition, it is also necessary to determine whether the firewall of the target device is in the enabled state, and if the firewall is turned on, the firewall rule is also acquired and stored. The information can be displayed to the user through the interface, so that the user can know which configuration information exists in the target device before setting the network information for the target device.
The existing network device basically supports remote management and configuration, or supports a B/S (Browser/Server) remote management mode, or a C/S (Client-Server) remote management mode, so that a user may connect to a target network device through a Browser or a Client application program before configuring a network for the target device, and then view existing network configuration information of the target device on an interface of the Browser or the Client application program, and at the same time, may also make a setting for network configuration of the target device on the display interface, for example: the ip of the network card eth0 is set to be 192.168.1.203/24, and the network cards eth1 and eth2 are aggregated into a bond0 … … and the like.
Step S20: the method comprises the following steps of acquiring target network configuration information set by a user, and modifying target equipment from original network configuration information to the target network configuration information:
acquiring target network configuration information set by a user;
recombining the physical network equipment and the virtual network equipment on the target equipment according to the target network configuration information;
and resetting the equipment configuration information and the system network configuration information according to the target network configuration information.
It should be noted that the target network configuration information may be configuration information that needs to be configured on the target device, and includes a combination state to be set by a physical network device and a virtual network device on the device (for example, deleting an existing virtual switch, a virtual router, and an aggregation network card, and then creating a new virtual switch, a virtual router, and an aggregation network card … …), a device name, an IP address, a subnet mask, a Maximum Transmission Unit (MTU), a VLAN identifier of the physical network device and the virtual network device, and a DNS, a gateway, a route, a firewall rule of the operating system, and the like.
The virtual switch is a switch virtualized by software technology, and can be used for connecting a virtual network card of a virtual machine to realize network communication. The virtual router is a router virtualized by software technology and used for connecting a virtual switch to complete data packet forwarding between different network segments.
The network card aggregation is to change a plurality of physical network cards into one logical network card for use, so as to obtain higher network throughput performance (there are multiple working modes, such as a balanced loop strategy, a master-backup strategy, a balanced strategy, a broadcast strategy, dynamic link aggregation, adapter transmission load balancing, and adapter adaptive load balancing), and the aggregated logical network card is called an interface. The network card aggregation configuration information may be configuration information when a plurality of physical network cards become an aggregation state, including device names, aggregation modes, aggregated interface names, and the like of each member network card, for example, aggregating the physical network cards eth0, eth1, eth2 into an interface named bond0 according to a balanced load mode; in addition, the interface in the aggregation state can also be removed, for example, the interface bond1 in the aggregation state (by the physical network cards eth3 and eth 4) is removed from aggregation, and is restored to the normal use mode of the physical network cards.
The rules of the network firewall are used for controlling which external devices can access which ports of the target device, and the network firewall can intercept the attack behavior of the external devices on the target device, so that the security of a service system of the target device is better protected, but if the configuration is not proper, normal network communication can be intercepted, and the network cannot be communicated.
In the specific implementation: first, the virtual network devices on the target device, such as the virtual switch, the virtual router, the aggregation network card … …, etc., are deleted according to the configuration information of the user. In the previous steps, the physical network device and the virtual network device on the target device are obtained and displayed to the user through the remote management and configuration interface, so that the user can delete some virtual network devices on the operation interface according to the requirement, create a new virtual network device and configure the physical network device and the virtual network device. For example: before configuration is modified, the network cards eth3 and eth4 on the target device are aggregated into a bond1, and if a user wants to delete the aggregated network card and then create a new aggregated network card, the bond1 needs to be deaggregated, which can be implemented by nmcli for a Linux system and Powershell script for a Windows system;
and then, creating a new virtual network device according to the target network configuration information set by the user, and connecting the new virtual network device to the corresponding physical network device to complete the combination of the physical network device and the new virtual network device. Such as: if the target network configuration indicates that eth0, eth1 and eth3 are to be aggregated into the bond0, then eth0, eth1 and eth3 are aggregated into the bond0 and set to the user-specified operation mode according to the target network configuration.
Then, according to the used configuration, deleting the configuration information of the physical network device and the virtual network device which need to be modified, and then configuring the configuration information set by the user on the physical network device and the virtual network device according to the target network configuration, such as: the names of the physical network devices, the virtual network devices, the IP addresses (assuming that the newly set IP address is 192.168.3.111), the subnet masks, the maximum transmission units, and the like are configured. After configuration, the DNS, gateway, route, etc. of the operating system are configured into the system. The specific configuration method, whether linux or windows, may be implemented by a command, such as ifconfig, netsh, and the like, which is not described in detail herein.
And finally, checking the state of the firewall, and if the firewall is in an open state, closing the firewall to prevent the firewall from intercepting the network access request of the external equipment to the target equipment. In this way, the user can connect to the target device through the browser or the Client application program under the condition that the network configuration is correct, and confirm that the configuration is effective. And after the network configuration to be confirmed takes effect, the firewall rule is applied to the system, so that the condition that a user cannot distinguish whether the external equipment cannot access the target equipment or not is caused by an IP address configuration error or firewall rule interception is avoided.
Further, since the user is connected to the target device through the browser or the Client application for remote management configuration (for example, the user is connected to the target device through the IP address 192.168.1.16 before configuration modification), the user changes the IP address of the target device from 192.168.1.16 to 172.16.1.16 on the operation interface, and after the configuration modification is successful, the user needs to manually modify the browser or the Client application connection address to 172.16.1.16 to connect the target device. In order to improve the user experience, the trouble that the user needs to manually input 172.16.1.16 the address is saved, after the target network configuration information set by the user is obtained, the network configuration program on the target device sends a message to the remote management configuration program (namely, the browser or the Client application program) before the network configuration information is modified for the target device, the browser or the Client application program is informed to automatically connect the target device through the modified network address (namely, 172.16.1.16 the address) after the appointed time (assumed to be 30 seconds later) so as to send an instruction for confirming the configuration modification after the connection is successful, and the trouble that the user needs to manually input the connection address is saved, so that better user experience is obtained.
Generally, there may be multiple network devices (i.e. multiple network cards, here, assume 3 network cards, which are eth1, eth2, eth3 respectively) in the target device, and different addresses are configured, where the IP address of eth1 is 192.168.1.16, the IP address of eth2 is 10.10.1.16, the IP address of eth3 is 200.200.1.16, and the remote management configuration program (i.e. the browser or Client application program) is connected to the target device through 192.168.1.16. If the user modified network configuration does not contain the eth1 configuration, then the network configurator program may continue to access the target device using the original IP address (i.e., 192.168.1.16) without notifying the remote management configuration program to connect the target device using the configured IP address. If the user modifies the network configuration to include the eth1 configuration (assuming that the IP address of eth1 is modified to 172.16.1.16), the network configurator needs to send a message to the remote management configurator to notify the remote management configurator to use the modified IP address (i.e., 172.16.1.16) to connect to the target device before modifying the network configuration, so as to implement automatic jump of the connection target and obtain better user experience.
Further, after the step S20, the method further includes: starting a preset timer to start timing; receiving a confirmation instruction sent by a user; and when the timing is finished, clearing the preset timer.
In a specific implementation, after the target device is modified from the original network configuration information to the target network configuration information, a tag file is generated to tag that the network state of the target device is a temporary network state at this time, and a timer is started to record time, for example, a preset confirmation time is 5 minutes. When the confirmation instruction of the user is not received within 5 minutes, a network configuration rollback operation needs to be performed, that is, the target device is rolled back from the target network configuration information to the original network configuration information. And deletes the markup file and the timer. For example, a flag file (e.g., run/temp _ config) may be created to indicate that the network status of the target device is a temporary network status, then wait for the user to send a confirmation instruction within a set time, and after receiving the confirmation instruction from the user, flag the network status of the target device as a permanent network status. And if the confirmation instruction of the user is not received within the preset time length, deleting the marking file and the clearing timer, and rolling back the network configuration to the original network configuration.
Step S30: judging whether a confirmation instruction of a user is received within a preset time period;
it should be noted that the preset time period may be a preset time duration. The confirmation instruction may be an instruction sent by the user to confirm that the network configuration information of the target device is modified into the target network configuration information. After the user sets the network configuration, the network configuration program on the target device sends a message to the remote management configuration program (i.e. the browser or the Client application program) before modifying the network configuration of the target device, and notifies the browser or the Client application program to automatically connect to the target device through the modified network address after the appointed time.
If the target network configured by the target device is correct, the browser or the Client application program can normally access the remote management interface of the target device, after receiving the access request, the network configuration program on the target device checks whether the current network configuration is in a temporary state (namely, whether a/run/temp _ config markup file exists or not is judged), and if the current network configuration is in the temporary state, the browser or the Client application program end is informed to pop up a box to prompt a user that the current network configuration is in the temporary state, and the user needs to confirm that the current temporary network configuration is set to be the permanent network configuration. When the user clicks on the interface for confirmation, the network configuration program at the target device end deletes the/run/temp _ config tag file and the timer, so that the temporary network configuration becomes the permanent network configuration.
If the target network configured by the target device is wrong, the browser or the Client application program cannot access the remote management interface of the target device, and the network configuration program at the target device end cannot receive a confirmation instruction sent by a user at the remote management interface within the set time length, so that after the timer finishes timing, the temporary network configuration of the target device is deleted, the network configuration stored in advance is reset into the target device, and the timer and the marker file are deleted at the same time, and the network configuration rollback is completed. After the rollback is finished, the user can access the remote management interface of the target device through the original IP address, reconfigure the network without entering a machine room, connect a keyboard and a display and then set the network configuration.
Further, after the step S30, the method further includes: and after the confirmation instruction is received within the preset time period, configuring the firewall rules.
It should be noted that, in the foregoing, when the target device is configured with the target network, the firewall rule is not configured, because the wrong firewall rule may intercept the normal access of the external device to the target device, so that the external device may still not access the target device when the network configuration of the target device is correct. Therefore, the technical scheme divides the whole configuration process into two stages of network address configuration and firewall rule configuration, firstly configures the network address and waits for user confirmation, and then configures the firewall rule and waits for user confirmation again, so that the user can easily distinguish whether the target device cannot be accessed by external equipment and is the problem of network address configuration or the problem of the firewall rule.
The specific implementation steps are that after receiving the network configuration confirmation instruction within the preset time period (that is, deleting the/run/temp _ config flag file, deleting the timer, and changing the temporary network configuration into the permanent network configuration), it is determined whether the target configuration set by the user configures the firewall rule, if so, the firewall rule in the target network configuration set by the user needs to be temporarily applied to the system of the target device, and then the user rule confirmation instruction is waited for again (specifically, a timer is started to time, and then it is determined whether the user confirmation instruction is received within the set time period). If the user's confirmation instruction is received within a predetermined time, the temporary firewall rule is changed to the permanent firewall rule. If the confirmation instruction of the user is not received within the preset time, the firewall possibly intercepts the access request of the external device, the temporary firewall rule needs to be deleted, and the access of the external device to the target device is released, so that the user can access the remote management interface of the target device through the network again. When the user accesses the remote management interface again, the interface prompts the user, and because the user's rule confirmation instruction cannot be received within the preset time, the previously configured firewall rule cannot be applied to the system, and the user needs to reconfigure the firewall rule and confirm again. Therefore, the trouble that the user cannot access the remote management interface of the target device after the firewall rules are started, and the user needs to enter the computer to connect the display and the keyboard and then reconfigure the network can be avoided.
Step S40: and when the confirmation instruction is not received within the preset time period, rolling back the target equipment from the target network configuration information to the original network configuration information.
It should be noted that, when the confirmation instruction is not received within the preset time period, rolling back the target device from the target network configuration information to the original network configuration information may be that, when the confirmation instruction is not received within the preset time period, rolling back the network configuration information of the target device to the original network configuration information. The specific method is that firstly, the target network configuration set by the user is deleted (including the DNS, gateway and route of the operating system set by the user latest), then the configuration information of the physical network device and virtual network device set by the user latest is deleted, then the newly created virtual network device is deleted, finally the original network configuration stored in advance is set into the system (namely, the virtual network device is created according to the original configuration, the physical network device and the virtual network device are configured, the DNS, gateway and route of the operating system are set, and the like), and the rollback of the network configuration is completed.
The embodiment acquires target network configuration information set by a user; modifying the target equipment from the original network configuration information to the target network configuration information; judging whether a confirmation instruction of a user is received within a preset time period; and when the confirmation instruction is not received within the preset time period, rolling back the target equipment from the target network configuration information to the original network configuration information. In this embodiment, when the confirmation instruction is not received within the preset time period, the target device rolls back the target network configuration information to the original network configuration information. Compared with the existing mode of adopting modified network configuration after network configuration is performed on the communication equipment, the mode of the embodiment can roll back the target equipment from the target network configuration information to the original network configuration information when a confirmation instruction is not received, thereby improving the efficiency of network configuration and reducing manual operation caused by configuration failure.
Referring to fig. 3, fig. 3 is a flowchart illustrating a network configuration method according to a second embodiment of the present invention.
Based on the first embodiment, in this embodiment, the step S20 includes:
step S201: acquiring target network configuration information set by a user, and performing preliminary verification on the target network configuration information to obtain a verification result;
it should be noted that the preliminary verification of the target network configuration information may be a preliminary legal verification of parameters in the target network configuration information, so as to effectively avoid common errors. For example, whether IP, subnet mask, gateway, DNS conform to IP address specifications; whether the gateway is reachable or not, and the like. The method specifically comprises the following steps: acquiring an IP and a subnet mask in the target network configuration information; determining the reachable gateway range of the gateway according to the IP and the subnet mask; acquiring a configuration gateway in the target network configuration information; and judging whether the configuration gateway is in the gateway range or not, and obtaining a gateway checking result.
In a specific implementation, for example, the IP in the target network configuration information is 192.168.1.100, and the subnet mask is 255.255.255.0, and the gateway is 172.16.1.1. Since the accessible range determined from the IP and subnet mask is 192.168.1.0-192.168.1.255, the gateway in the target network configuration is not within the accessible range. This situation is therefore inaccessible to the gateway and therefore an invalid network configuration. And the verification result is that the gateway is failed to verify. Or determining the IP range which can be set by the IP through the subnet mask and the gateway, and judging whether the IP in the target network configuration is in the IP range to further obtain the verification result.
Further, in order to improve the efficiency of network configuration, the step S101 may include: acquiring a target DNS in the target network configuration information; matching in a preset DNS according to the DNS to obtain a matching result; and determining a DNS checking result according to the matching result.
It should be noted that the preset DNS library may be a set of DNS accessible to the target device. The matching result may include matching success and matching failure, and when matching is successful, the DNS verification result is determined to be verification pass.
Step S202: and when the verification result is that the verification is passed, modifying the target equipment from the original network configuration information to the target network configuration information.
It should be understood that, when the operating system type of the target device is different, the step of modifying the target device from the original network configuration information to the target network configuration information is also different, and may be, when the operating system type of the target device is Windows, performing network configuration of the system by using a network configuration command line tool (netsh).
It should be noted that, when the operating system is a Linux operating system, when the network configuration information in the network configuration file is modified, the modified network configuration information needs to be restarted to use, and therefore, when the target device is modified from the original network configuration information to the target network configuration information in a manner of modifying the network configuration file, the target device needs to be restarted. For the Linux operating system, the system network can also be directly configured through an ip command, that is, the target device is modified from the original network configuration information to the target network configuration information through the ip command.
The embodiment performs preliminary verification on the target network configuration information to obtain a verification result; and when the verification result is that the verification is passed, modifying the target equipment from the original network configuration information to the target network configuration information. According to the embodiment, the target network configuration information is preliminarily verified before the target device is modified from the original network configuration information to the target network configuration information, so that the network configuration efficiency is improved.
Referring to fig. 4, fig. 4 is a block diagram of a first embodiment of a network configuration device according to the present invention.
As shown in fig. 4, a network configuration apparatus according to an embodiment of the present invention includes:
an obtaining module 10, configured to obtain original network configuration information of a target device;
a modification module 20, configured to acquire target network configuration information set by a user, and modify the target device from original network configuration information to the target network configuration information;
the judging module 30 is configured to judge whether a confirmation instruction of the user is received within a preset time period;
a rollback module 40, configured to roll back the target device from the target network configuration information to the original network configuration information when the confirmation instruction is not received within the preset time period.
The embodiment acquires target network configuration information set by a user; modifying the target equipment from the original network configuration information to the target network configuration information; judging whether a confirmation instruction of a user is received within a preset time period; and when the confirmation instruction is not received within the preset time period, rolling back the target equipment from the target network configuration information to the original network configuration information. In this embodiment, when the confirmation instruction is not received within the preset time period, the target device rolls back the target network configuration information to the original network configuration information. Compared with the existing mode of adopting modified network configuration after network configuration is performed on the communication equipment, the mode of the embodiment can roll back the target equipment from the target network configuration information to the original network configuration information when a confirmation instruction is not received, thereby improving the efficiency of network configuration and reducing manual operation caused by configuration failure.
It should be noted that the above-mentioned work flows are only illustrative and do not limit the scope of the present invention, and in practical applications, those skilled in the art may select some or all of them according to actual needs to implement the purpose of the solution of the present embodiment, and the present invention is not limited herein.
In addition, the technical details that are not described in detail in this embodiment may refer to the parameter operation method provided in any embodiment of the present invention, and are not described herein again.
Based on the first embodiment of the network configuration device of the present invention, a second embodiment of the network configuration device of the present invention is provided.
In this embodiment, the obtaining module 10 is further configured to obtain device configuration information of all physical network devices and virtual network devices on the target device;
acquiring system network configuration information of an operating system corresponding to the target equipment;
and displaying the composition relationship between the physical network equipment and the logic network equipment, the equipment configuration information and the system network configuration information to a user through an operation interface.
Further, the modifying module 20 is further configured to obtain target network configuration information set by a user; recombining the physical network equipment and the virtual network equipment on the target equipment according to the target network configuration information; and resetting the equipment configuration information and the system network configuration information according to the target network configuration information.
Further, the modification module 20 is further configured to start a preset timer to start timing; receiving a confirmation instruction sent by a user through a preset server; and when the timing is finished, clearing the preset timer.
Further, the modifying module 20 is further configured to determine whether the target network configuration information modifies the connection address of the target device; and when the connection address of the target equipment is modified, controlling a network configuration interface program to use the configured network connection address to connect the target equipment.
Further, the modification module 20 is further configured to obtain firewall status information; and when the state information of the firewall is in the opening state, closing the firewall.
Further, the determining module 30 is further configured to configure the firewall rule after receiving the confirmation instruction within the preset time period.
Other embodiments or specific implementation manners of the network configuration apparatus of the present invention may refer to the above method embodiments, and are not described herein again.
Furthermore, an embodiment of the present invention further provides a storage medium, where a network configuration program is stored on the storage medium, and the network configuration program, when executed by a processor, implements the steps of the network configuration method described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or system in which the element is included.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., a rom/ram, a magnetic disk, an optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A network configuration method, characterized in that the network configuration method comprises the steps of:
acquiring original network configuration information of target equipment;
acquiring target network configuration information set by a user, and modifying the target equipment from original network configuration information to the target network configuration information;
judging whether a confirmation instruction of a user is received within a preset time period;
when the confirmation instruction is not received within the preset time period, rolling back the target equipment from the target network configuration information to the original network configuration information;
the step of acquiring target network configuration information set by a user and modifying the target device from original network configuration information to the target network configuration information comprises the following steps:
acquiring target network configuration information set by a user, and performing preliminary verification on the target network configuration information to obtain a verification result;
when the verification result is that the verification is passed, modifying the original network configuration information of the target equipment into the target network configuration information;
after the step of judging whether a confirmation instruction of the user is received within a preset time period, the method further comprises the following steps:
when the confirmation instruction is received within the preset time period, judging whether the target network configuration information comprises a target firewall rule or not;
if yes, modifying the firewall rule of the target equipment into the target firewall rule, and judging whether a firewall rule confirmation instruction of the user is received within a second preset time period;
and if the firewall rule confirmation instruction is not received, rolling back the firewall rule of the target equipment to the original firewall rule.
2. The network configuration method of claim 1, wherein the original network configuration information comprises device configuration information and system network configuration information;
the acquiring of the original network configuration information of the target device includes:
acquiring equipment configuration information of all physical network equipment and virtual network equipment on target equipment;
acquiring system network configuration information of an operating system corresponding to the target equipment;
and displaying the composition relationship between the physical network equipment and the logic network equipment, the equipment configuration information and the system network configuration information to a user through an operation interface.
3. The network configuration method of claim 2, wherein the obtaining of the target network configuration information set by the user and the modifying of the target device from the original network configuration information to the target network configuration information comprises:
acquiring target network configuration information set by a user;
recombining the physical network equipment and the virtual network equipment on the target equipment according to the target network configuration information;
and resetting the equipment configuration information and the system network configuration information according to the target network configuration information.
4. The network configuration method of any of claims 1-3, wherein after the step of modifying the target device from original network configuration information to the target network configuration information, further comprising:
starting a preset timer to start timing;
receiving a confirmation instruction sent by a user through a preset server;
and when the timing is finished, clearing the preset timer.
5. The network configuration method of claim 3, wherein before recombining the physical network device and the virtual network device on the target device according to the target network configuration information, the method comprises:
judging whether the target network configuration information modifies the connection address of the target equipment or not;
and when the connection address of the target equipment is modified, controlling a network configuration interface program to use the configured network connection address to connect the target equipment.
6. The network configuration method of claim 3, wherein after the resetting the device configuration information and the system network configuration information according to the target network configuration information, further comprising:
obtaining the state information of a firewall;
and when the state information of the firewall is in the opening state, closing the firewall.
7. The method for configuring a network according to claim 1, wherein the step of determining whether the confirmation instruction of the user is received within the preset time period further comprises:
and after the confirmation instruction is received within the preset time period, configuring the firewall rules.
8. A network configuration apparatus, characterized in that the network configuration apparatus comprises:
the acquisition module is used for acquiring original network configuration information of the target equipment;
the modification module is used for acquiring target network configuration information set by a user and modifying the target equipment from original network configuration information to the target network configuration information;
the judging module is used for judging whether a confirmation instruction of the user is received within a preset time period;
a rollback module, configured to roll back the target device from target network configuration information to the original network configuration information when the confirmation instruction is not received within the preset time period;
the modification module is further used for acquiring target network configuration information set by a user, and performing preliminary verification on the target network configuration information to obtain a verification result; when the verification result is that the verification is passed, modifying the original network configuration information of the target equipment into the target network configuration information;
the rollback module is further configured to determine whether the target network configuration information includes a target firewall rule when the confirmation instruction is received within the preset time period; if yes, modifying the firewall rule of the target equipment into the target firewall rule, and judging whether a firewall rule confirmation instruction of the user is received within a second preset time period; and if the firewall rule confirmation instruction is not received, rolling back the firewall rule of the target equipment to the original firewall rule.
9. A network configuration device, the device comprising: a memory, a processor and a network configuration program stored on the memory and executable on the processor, the network configuration program being configured to implement the steps of the network configuration method of any of claims 1 to 7.
10. A storage medium, characterized in that the storage medium has stored thereon a network configuration program, which when executed by a processor implements the steps of the network configuration method according to any one of claims 1 to 7.
CN202210603546.0A 2022-05-31 2022-05-31 Network configuration method, device, equipment and storage medium Active CN114697211B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210603546.0A CN114697211B (en) 2022-05-31 2022-05-31 Network configuration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210603546.0A CN114697211B (en) 2022-05-31 2022-05-31 Network configuration method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114697211A CN114697211A (en) 2022-07-01
CN114697211B true CN114697211B (en) 2022-09-02

Family

ID=82131004

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210603546.0A Active CN114697211B (en) 2022-05-31 2022-05-31 Network configuration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114697211B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102412978A (en) * 2010-09-21 2012-04-11 杭州华三通信技术有限公司 Method for carrying out network configuration for VM and system thereof
CN109039765A (en) * 2018-08-28 2018-12-18 新华三技术有限公司 Network collocating method and device
CN109831447A (en) * 2019-03-05 2019-05-31 浙江大学 A kind of intelligent honeynet system based on NFV
CN112491606A (en) * 2020-11-20 2021-03-12 湖南麒麟信安科技股份有限公司 Method for automatically deploying high-availability cluster of service system based on infrastructure

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697518B (en) * 2009-09-24 2012-04-25 华为技术有限公司 Telecommunication equipment collocating method and system as well as telecommunication equipment
CN102082685A (en) * 2009-11-30 2011-06-01 三星电子(中国)研发中心 Network configured method and system of embedded device
CN103973577A (en) * 2013-01-31 2014-08-06 上海斐讯数据通信技术有限公司 Automatic set-up method of router
CN106789204A (en) * 2016-12-09 2017-05-31 邯郸美的制冷设备有限公司 A kind of method of intelligent network distribution, device and smart machine
CN108039969B (en) * 2017-12-13 2021-08-03 深圳市科力锐科技有限公司 Network automatic configuration method, device, system, storage medium and target computer
CN108377202A (en) * 2018-02-11 2018-08-07 广东美的厨房电器制造有限公司 The distribution method, apparatus and system of smart machine
US10887190B2 (en) * 2018-03-23 2021-01-05 Hewlett Packard Enterprise Development Lp System for simultaneous viewing and editing of multiple network device configurations
CN111817869B (en) * 2019-04-12 2023-05-19 华为技术有限公司 Network configuration recovery method and related equipment thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102412978A (en) * 2010-09-21 2012-04-11 杭州华三通信技术有限公司 Method for carrying out network configuration for VM and system thereof
CN109039765A (en) * 2018-08-28 2018-12-18 新华三技术有限公司 Network collocating method and device
CN109831447A (en) * 2019-03-05 2019-05-31 浙江大学 A kind of intelligent honeynet system based on NFV
CN112491606A (en) * 2020-11-20 2021-03-12 湖南麒麟信安科技股份有限公司 Method for automatically deploying high-availability cluster of service system based on infrastructure

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于以太网OTA远程升级的研究;严娟等;《上海汽车》;20200320(第03期);全文 *
张洋平.基于包过滤技术的自适应路径复合型防火墙的设计与实现.《 中国优秀硕士论文电子期刊网》.2016, *

Also Published As

Publication number Publication date
CN114697211A (en) 2022-07-01

Similar Documents

Publication Publication Date Title
CN110611588B (en) Network creation method, server, computer readable storage medium and system
USRE41030E1 (en) System and method of network independent remote configuration of internet server appliance
EP3073676B1 (en) Method, apparatus and system for controlling auto-provisioning of network device
CN114070723B (en) Virtual network configuration method and system of bare metal server and intelligent network card
US20090233609A1 (en) Touchless Plug and Play Base Station
US8351340B2 (en) Method for detecting a proxy ARP agent in secure networks having embedded controllers
WO2017054549A1 (en) Device batch upgrading method and system
US8887237B2 (en) Multimode authentication
CN111800399B (en) Information transmission method, device, equipment and storage medium
CN110855488B (en) Virtual machine access method and device
CN109768906B (en) Private subnet line configuration method and device
US20240039923A1 (en) Method and apparatus for deploying network device, device, system, and storage medium
EP3457657A1 (en) Access control method and system, and switch
CN113098722A (en) Multi-network card management method, device and computer readable storage medium
CN113347287B (en) Host discovery and addition method, device, equipment and medium in data center
CN109379339B (en) Portal authentication method and device
CN112667293A (en) Method, device and storage medium for deploying operating system
CN114697211B (en) Network configuration method, device, equipment and storage medium
CN110912725A (en) Configuration method and configuration device of OpenFlow virtual switch
CN111163463B (en) Method, device, equipment and storage medium for wireless equipment to access router
CN111756870A (en) IPv6 address configuration method, device, equipment and readable storage medium
CN112099902A (en) Network adapter configuration method and device of virtual machine, electronic device and storage medium
JP2006113754A (en) Software update device and method
Li et al. One-pass in-band automatic bootstrapping for OpenFlow switches
US11729140B2 (en) Method and system for managing DHCP servers

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant