Method and system for upgrading two-layer switch into three-layer switch and medium
By dividing VLANs on Layer 2 switches and using network servers for routing processing, the problem that traditional Layer 2 switches cannot achieve cross-subnet communication and network layer functions is solved, and the upgrade of Layer 2 switches to Layer 3 switches is realized, which improves the The flexibility and functionality of the network.
Patent Information
- Application Number
- CN202411144670.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-11-26
AI Technical Summary
Traditional layer two switches cannot realize cross-subnet communication and network layer functions, which limits the scalability and functionality of the network.
By dividing VLANs on Layer 2 switches and installing the network function software Quagga using a network server (such as Linux server), the routing of VLAN packets is completed, thereby upgrading the Layer 2 switch to a Layer 3 switch, realizing cross-subnet communication and routing Function.
Without increasing hardware costs, the flexibility and functionality of the network are improved, cross-subnet communication and complex network functions are realized, and the scalability and security of the network are enhanced.
Smart Images

Figure CN119030874A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technology, and in particular to a method, system and medium for upgrading a layer 2 switch to a layer 3 switch. Background Art
[0002] The main function of a Layer 2 switch is to forward data packets based on the MAC address (Media Access Control Address). However, as the scale and complexity of networks increase, traditional Layer 2 switches have significant limitations in the following scenarios:
[0003] (1) Communication limited to Layer 2 networks: Layer 2 switches mainly forward data packets in the local network and cannot communicate across subnets or route IP layer data packets.
[0004] (2) Lack of network layer IP (Internet Protocol) functions: Since the Layer 2 switch only forwards MAC addresses, it is unable to implement network layer functions such as routing and ACL (Access Control List).
[0005] Therefore, how to realize network communication function based on the two-layer switch architecture becomes a problem that needs to be solved. Summary of the invention
[0006] The technical problem to be solved by the present application is to provide a method, system and medium for upgrading a layer 2 switch to a layer 3 switch in view of the above-mentioned deficiencies in the prior art, so as to solve the problems existing in the prior art.
[0007] In a first aspect, the present application provides a method for upgrading a layer 2 switch to a layer 3 switch, wherein the layer 2 switch is connected to a network server via a trunk, and the network server is installed with network function software, and the method comprises:
[0008] S1, performing VLAN division through the layer 2 switch;
[0009] S2, the layer 2 switch forwards data packets according to the divided VLANs;
[0010] S3. When the layer 2 switch receives data that needs to be processed at layer 3, the layer 2 switch sends the corresponding VLAN data packet to the network server through the trunk, so that the network server routes the VLAN data packet through the network function software after receiving the VLAN data packet.
[0011] In some embodiments, S1 includes:
[0012] Creating multiple VLANs on the layer 2 switch;
[0013] The ports of the layer 2 switch are respectively divided into the multiple VLANs, so that the ports of the layer 2 switch are associated with each VLAN.
[0014] In some embodiments, S2 includes:
[0015] When receiving a data packet to be forwarded, the layer 2 switch obtains a destination VLAN identifier of the data packet to be forwarded;
[0016] According to the destination VLAN identifier, the data packet to be forwarded is forwarded to the corresponding VLAN.
[0017] In some embodiments, in S3, the network server performs routing processing on the VLAN data packet through network function software, including:
[0018] The network server decodes the VLAN data packet through network function software to obtain the data packet content;
[0019] Determine the destination VLAN ID corresponding to the VLAN data packet according to the network topology and the routing table;
[0020] The data packet content of the VLAN data packet is classified into a VLAN processing queue corresponding to the destination VLAN identifier.
[0021] In some embodiments, when there are multiple data that need to be processed at the third layer, the second layer switch sends the corresponding VLAN data packet to the network server through the port corresponding to each data via the trunk.
[0022] In some embodiments, the network server comprises a Linux server.
[0023] In some embodiments, the network function software includes network function software Quagga.
[0024] In a second aspect, the present application provides a system for upgrading a layer 2 switch to a layer 3 switch, including a layer 2 switch and a network server, wherein:
[0025] The layer 2 switch is connected to a network server via a trunk, and the network server is installed with network function software;
[0026] The layer 2 switch is used to divide VLANs; forward data packets according to the divided VLANs; when the layer 2 switch receives data that needs to be processed at layer 3, the layer 2 switch sends the corresponding VLAN data packet to the network server through the trunk;
[0027] The network server is used for routing the VLAN data packet through the network function software after receiving the VLAN data packet.
[0028] In a third aspect, the present application provides a system for upgrading a layer 2 switch to a layer 3 switch, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the method for upgrading a layer 2 switch to a layer 3 switch described in the first aspect above.
[0029] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for upgrading a layer-2 switch to a layer-3 switch as described in the first aspect above is implemented.
[0030] The present application provides a method, system and medium for upgrading a layer 2 switch to a layer 3 switch, the method comprising: performing VLAN division through the layer 2 switch; the layer 2 switch forwarding data packets according to the divided VLAN; when the layer 2 switch receives data that needs to be processed at the layer 3, the layer 2 switch sends the corresponding VLAN data packet to the network server through the trunk, so that after receiving the VLAN data packet, the network server routes the VLAN data packet through the network function software. The present application connects the network server to a layer 2 switch through the TRUNK, and the network server network card sub-interface is associated with the VLAN, thereby generating an association relationship. The core technology is to use the network server to complete the layer 3 function, and upgrade the layer 2 switch to a layer 3 switch with routing, including VLAN division, switch and server connection configuration, and data processing and forwarding. Through the cooperation of these technologies, data reception, processing and forwarding are realized, and the upgrade of the layer 2 switch to the layer 3 switch is completed. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0032] Figure 1 A schematic diagram of the structure of a system for upgrading a layer 2 switch to a layer 3 switch provided in an embodiment of the present application;
[0033] Figure 2 A flowchart of a method for upgrading a layer 2 switch to a layer 3 switch provided in an embodiment of the present application.
[0034] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0035] In order to enable those skilled in the art to better understand the technical solution of the present application, the implementation mode of the present application will be further described in detail below with reference to the accompanying drawings.
[0036] It should be understood that the specific embodiments and drawings described herein are only used to explain the present application, rather than to limit the present application.
[0037] It can be understood that, in the absence of conflict, the various embodiments in the present application and the various features in the embodiments can be combined with each other.
[0038] It can be understood that, for the convenience of description, the drawings of the present application only show the parts related to the present application, while the parts unrelated to the present application are not shown in the drawings.
[0039] It can be understood that each unit and module involved in the embodiments of the present application may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.
[0040] It can be understood that the terms "first", "second", etc. in the embodiments of the present application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.
[0041] It is understandable that, in the absence of conflict, the functions and steps marked in the flowcharts and block diagrams of the present application may occur in an order different from that marked in the drawings.
[0042] It is understood that the flowcharts and block diagrams of the present application illustrate the possible architectures, functions, and operations of the systems, systems, devices, and methods according to the embodiments of the present application. Among them, each box in the flowchart or block diagram may represent a unit, module, program segment, code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or by a combination of hardware and computer instructions.
[0043] It can be understood that the units and modules involved in the embodiments of the present application can be implemented by software or hardware, for example, the units and modules can be located in a processor.
[0044] Currently, traditional Layer 2 switches have significant limitations in the following scenarios:
[0045] (1) Switching limitations of Layer 2 switches: Layer 2 switches have certain limitations. Traditional Layer 2 switches can only forward data packets locally and cannot achieve cross-subnet communication or network IP data packet routing.
[0046] (2) Limited network functions: Due to the lack of network layer functions, Layer 2 switches cannot provide advanced network functions such as routing and firewalls, which limits the network architecture;
[0047] In response to these limitations, three-layer switches came into being. Based on the two-layer switches, three-layer switches add routing functions and can forward data packets according to IP addresses. This enables three-layer switches to implement complex functions such as cross-subnet communication and network segmentation, thereby improving the scalability of the network.
[0048] However, although Layer 3 switches can solve the above problems, they require hardware to support routing functions, making them more expensive than Layer 2 switches. At the same time, Layer 3 switches increase the complexity of network devices and require additional time and cost to maintain the configuration.
[0049] In view of the above problems, the present application provides a method for upgrading a layer 2 switch to a layer 3 switch.
[0050] The main ideas of this application are:
[0051] This application utilizes the powerful network processing capabilities of the Linux server to complete the three-layer function. It can upgrade the two-layer switch to a three-layer switch without adding additional costs, thereby making up for the limitations of traditional two-layer switches and improving network flexibility and functionality.
[0052] Before describing the embodiments of the present application, the terms and definitions used in the embodiments of the present application are explained as follows:
[0053] (1) Layer 2 switch
[0054] A layer 2 switch is a data link layer device that can identify MAC address information in data packets, forward data based on the MAC address, and record these MAC addresses and corresponding ports in an internal address table.
[0055] (2) Layer 3 switch
[0056] Layer 3 switching technology is a technology that combines routing technology and switching technology. After routing the first data stream, it will generate a mapping table between MAC addresses and positive addresses. When the same data stream passes again, it will pass directly from the second layer according to this table instead of routing again, thus eliminating the network delay caused by the router's routing selection and improving the efficiency of data packet forwarding.
[0057] The main difference: Layer 2 switches work at the data link layer, and Layer 3 switches work at the network layer.
[0058] (3)Trunk
[0059] Trunk means port aggregation. By configuring the software, two or more physical ports are combined into a logical path to increase the bandwidth between the switch and the network node. Trunk is an encapsulation technology. It is a point-to-point link. Both ends of the link can be switches, switches and routers, or hosts and switches or routers.
[0060] Trunk is used for cascading between switches. It provides bundled high bandwidth for data exchange between switches by sacrificing the number of ports, increasing network speed, breaking through network bottlenecks, and thus greatly improving network performance. Trunk can provide load balancing capabilities and system fault tolerance. Since Trunk balances the traffic of each switch port and server interface in real time, once a port fails, it will automatically remove the failed port from the Trunk group, and then redistribute the traffic of each Trunk port, thereby achieving system fault tolerance.
[0061] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0062] Figure 1 A schematic diagram of a system for upgrading a layer 2 switch to a layer 3 switch provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the present application provides a system for upgrading a layer 2 switch to a layer 3 switch, including a layer 2 switch and a network server, wherein:
[0063] The layer 2 switch is connected to a network server via a trunk, and the network server is installed with network function software;
[0064] The layer 2 switch is used to divide VLANs; forward data packets according to the divided VLANs; when the layer 2 switch receives data that needs to be processed at layer 3, the layer 2 switch sends the corresponding VLAN data packet to the network server through the trunk;
[0065] The network server is used for routing the VLAN data packet through the network function software after receiving the VLAN data packet.
[0066] In some embodiments, the network server includes a Linux server, or alternatively, other types of servers, such as a Windows server.
[0067] In some embodiments, the network function software includes the network function software Quagga. Quagga is an open source router software suite that supports multiple routing protocols, can maintain routing tables and execute routing algorithms, and performs routing forwarding according to received data packets. Through Quagga, the Linux server can process data packets from different VLANs and route and forward them to corresponding destinations. Optionally, other types of network function software may also be used.
[0068] This application connects a network server (such as a Linux server) to a layer 2 switch through a TRUNK, and the Linux server network card sub-interface is associated with a VLAN, thereby generating an association relationship. The core technology is to use the Linux server to complete the layer 3 function, and upgrade the layer 2 switch to a layer 3 switch with routing, including VLAN division, switch and server connection configuration, and data processing and forwarding. Through the cooperation of these technologies, data reception, processing and forwarding are realized, and the upgrade of the layer 2 switch to the layer 3 switch is completed.
[0069] In this application, VLAN division allows network administrators to divide a single physical network into multiple logical networks. Each VLAN has an independent broadcast domain to enhance network security and flexibility. Data packets are tagged with VLAN on the switch, so that the switch can send the tagged data packets to the correct VLAN, thereby achieving isolation and management of different VLAN data in the network.
[0070] In addition, through the TRUNK connection method, a logical channel is established between the switch and the server, which can transmit data from multiple VLANs on a single physical link. This connection method realizes two-way data transmission and provides basic support for subsequent data processing, allowing the server to receive and process data from different VLANs.
[0071] In some embodiments, when there are multiple data that need to be processed at the third layer, the second layer switch sends the corresponding VLAN data packet to the network server through the port corresponding to each data via the trunk.
[0072] In addition, network function software such as Quagga is installed and configured on the Linux server, and related services are started so that the Linux server has the function of routing and forwarding. These configurations realize the maintenance of the routing table and the execution of the routing algorithm, and can perform routing and forwarding according to the received data packets, and return the processing results to the switch. When the switch receives data that needs to be processed at the third layer, it sends it to the Linux server, which is forwarded and processed by the network function software and finally returned to the switch, thus completing the processing of upgrading the switch from the second layer to the third layer.
[0073] The technical solution of the present application realizes the isolation and management of network resources through VLAN division, improves the security and flexibility of the network, and in the cases listed in the present application, VLAN division allows the network to be divided into multiple completely independent logical networks, so that the data traffic of different logical networks can be effectively managed and controlled. Through the TRUNK connection, the switched TRUNK port is connected to the network interface of the Linux server, and the data streams of multiple VLANs can be transmitted, allowing data transmission across VLANs, so that the Linux server can process data packets from different VLANs and display routing functions.
[0074] Figure 2 A schematic diagram of a method for upgrading a layer 2 switch to a layer 3 switch provided in an embodiment of the present application, such as Figure 2 As shown, the present application provides a method for upgrading a layer 2 switch to a layer 3 switch, wherein the layer 2 switch is connected to a network server via a trunk, and the network server is installed with network function software. The method includes S1-S3, which are specifically as follows:
[0075] S1, performing VLAN division through the layer 2 switch;
[0076] In some embodiments, S1 includes: creating multiple VLANs on the layer 2 switch; and dividing the ports of the layer 2 switch into the multiple VLANs respectively, so that the ports of the layer 2 switch are associated with each VLAN.
[0077] Specifically, for the VLAN division process:
[0078] Division basis: VLAN division is based on the organization's internal network requirements, topology, security factors, etc.
[0079] Division steps: First, create a VLAN on the switch. The VLAN ID and name can be set through the command line or graphical tools. Then divide the switch port into the corresponding VLAN. By configuring the switch port, the port is associated with its specific VLAN, so as to achieve data isolation and convention between different VLANs. This method of port-to-VLAN association allows the switch to forward according to the VLAN tag of the data packet, thereby ensuring that the data packet is correctly sent to the corresponding VLAN.
[0080] Application association of VLAN in the solution:
[0081] Data isolation and management: The divided VLANs can achieve logical isolation of data. Data packets between different VLANs cannot communicate directly, thereby improving network security. At the same time, each VLAN can be independently managed and configured according to actual business needs, which is more flexible.
[0082] Routing processing association: When a data packet is transmitted from one VLAN to another VLAN after division, it needs to be processed by routing and forwarded according to the destination, so VLAN division is crucial for the correct implementation of routing processing.
[0083] Contributions of VLAN division technology:
[0084] The divided VLAN provides the basic guarantee for the whole solution. Through the logical isolation of VLAN, the isolated communication between different departments or functional areas is realized. This isolation reduces the possibility of attackers obtaining sensitive information in the network and improves the security and management efficiency of the network. In addition, the division of VLAN also provides the segmentation and management of data flow for subsequent routing processing, laying the foundation for the permission of the whole solution.
[0085] VLAN division enables better control of network traffic. When the internal network architecture of an organization changes, administrators can directly adjust VLAN to adapt to the new network environment.
[0086] S2, the layer 2 switch forwards data packets according to the divided VLANs;
[0087] In some embodiments, S2 includes: when receiving a data packet to be forwarded, the layer 2 switch obtains a destination VLAN identifier of the data packet to be forwarded; and forwards the data packet to be forwarded to a corresponding VLAN according to the destination VLAN identifier.
[0088] S3. When the layer 2 switch receives data that needs to be processed at layer 3, the layer 2 switch sends the corresponding VLAN data packet to the network server through the trunk, so that the network server routes the VLAN data packet through the network function software after receiving the VLAN data packet.
[0089] In some embodiments, in S3, the network server performs routing processing on the VLAN data packet through network function software, including: the network server performs decoding processing on the VLAN data packet through network function software to obtain data packet content; determines the destination VLAN identifier corresponding to the VLAN data packet according to the network topology and routing table; and classifies the data packet content of the VLAN data packet into the VLAN processing queue corresponding to the destination VLAN identifier.
[0090] Specifically, the network function software runs on the Linux server and is mainly used to perform the three-layer switching function, integrating the two-layer switch with the three-layer routing function to achieve effective data processing and forwarding.
[0091] The Linux server receives data packets carrying VLAN tags from the switch through the TRUNK link, extracts the data packet content through software decoding, determines which VLAN the data packet should be forwarded to based on the network topology and routing table, and classifies the data packet into the corresponding VLAN processing queue based on the VLAN ID. This ensures that the data packet is not confused during processing. The routing information is updated through the routing protocol, and the forwarding path of the data packet is determined based on the entries in the routing table and the calculation results of the routing algorithm. Through the TRUNK link, bidirectional transmission of data packets from multiple VLANs is supported at the same time to ensure data integrity and accuracy. Software ACL is configured based on IP address, port number, and VLAN ID to ensure data isolation of different VLANs, and data access records are recorded at the same time. The software continuously monitors the load of links and routes, including bandwidth utilization and data packet forwarding delay, and dynamically adjusts the load balancing strategy to ensure network operation and data transmission accuracy.
[0092] The above processes work together to build a complete solution for upgrading a Layer 2 switch to a Layer 3 switch. VLAN division and the connection between the switch and the server ensure data transmission. The routing function is realized through the Linux server sub-interface configuration and the operation of the network function software. Finally, data processing and forwarding technology is used to complete the processing and forwarding of data packets.
[0093] The beneficial effects of this application are as follows:
[0094] 1. Upgrading the Layer 2 switch to a Layer 3 switch: In this application, the Linux server plays the role of a Layer 3 switch. By installing and configuring the network function software Quagga on the Linux server, the server can be transformed into a device with routing function. Quagga is an open source router software suite that supports multiple routing protocols, can maintain routing tables and execute routing algorithms, and performs routing forwarding according to received data packets. Through Quagga, the Linux server can process data packets from different VLANs and route them to the corresponding destinations;
[0095] 2. Utilize existing hardware resources: This method does not require additional dedicated hardware, but utilizes existing Linux server resources to save hardware costs and improve the reuse rate of hardware resources;
[0096] 3. Switch port and VLAN association: The port configuration of the switch determines the forwarding path of the data packet. In this application, the network administrator can specify a VLAN ID for each port by configuring the switch port. When the data packet arrives at a port of the switch, the switch will decide which VLAN to forward the data packet to based on the VLAN ID.
[0097] 4. VLAN division enhances network flexibility: VLAN division allows network administrators to divide a single physical network into multiple logical networks. Each VLAN has an independent broadcast domain. In this solution, VLAN division enhances network security and flexibility. For example, different users are grouped into different VLANs according to different functions of different departments, and digital data is isolated and managed. Through VLAN division, the network is subdivided into multiple virtual networks, which improves network flexibility and management efficiency.
[0098] The following is a specific implementation case of this application plan:
[0099] 1. VLAN division: Enter the switch management interface, create two new VLANs in the VLAN list: VLAN10 and VLAN20, VLAN N..., and divide the switch ports into corresponding VLANs:
[0100] - Open the file `ifcfg-ens192.10` to edit the configuration of the VLAN 10 network card.
[0101] TYPE = VLAN
[0102] BOOTPROTO=none
[0103] DEVICE=ens192.10
[0104] ONBOOT=yes
[0105] VLAN=yes
[0106] IPADDR=192.168.10.1
[0107] PREFIX=23
[0108] - Open the file `ifcfg-ens192.20` to edit the configuration of the VLAN 20 network card.
[0109] TYPE = VLAN
[0110] BOOTPROTO=none
[0111] DEVICE=ens192.20
[0112] ONBOOT=yes
[0113] VLAN=yes
[0114] IPADDR=192.168.20.1
[0115] PREFIX=24
[0116] 2. Linux server configuration: Connect to the Linux server via SSH and configure the primary network card on the Linux server:
[0117] - Open the file `ifcfg-ens192` to edit the configuration of the primary physical network card.
[0118] BOOTPROTO=none
[0119] NAME=ens192
[0120] DEVICE=ens192
[0121] ONBOOT=yes
[0122] Enable IP forwarding on Liunx server
[0123] - Open the file ` / etc / sysctl.conf` to edit the IP forwarding configuration
[0124] net.ipv4.ip_forward=1
[0125] Execute the sysctl -p bash command to take effect
[0126] 3. Install the Quagga software package and use the VIM editor to open the configuration file " / etc / quagga / zebra.conf" for routing configuration
[0127] Configure log level, interface, router ID
[0128] ! Configure log file
[0129] log file / var / log / quagga / zebra.log
[0130] ! Define your router's ID
[0131] router-id 1.1.1.1
[0132] ! Enable interfaces for routing
[0133] interface GigabitEthernet0 / 0 / 1
[0134] ip address 192.168.1.254 / 24
[0135] Configure OSPF process (other routing protocols can also be used)
[0136] - Open the file ` / etc / quagga / ospfd.conf` to edit the zebra configuration
[0137] !OSPF configuration
[0138] router ospf 1network 192.168.0.0 / 16area 0.0.0.0
[0139] 4. Security policy configuration: Use the firewall management tool iptables to configure firewall rules on the Linux server to display communication between VLANs, and control access rights between different VLANs on the Linux server through ACL to ensure network security.
[0140] It should be understood that, although the various steps in the flowcharts in the above-described embodiments are sequentially displayed according to the indications of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily to be carried out sequentially, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0141] In some embodiments, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for upgrading a layer 2 switch to a layer 3 switch in the above-mentioned embodiments of the present application is implemented.
[0142] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage systems, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0143] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present application, but the present application is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and substance of the present application, and these modifications and improvements are also considered to be within the scope of protection of the present application.
Claims
1. A method for upgrading a layer 2 switch to a layer 3 switch, characterized in that: The layer 2 switch is connected to a network server via a trunk, the network server is installed with network function software, and the method comprises: S1, performing VLAN division through the layer 2 switch; S2, the layer 2 switch forwards data packets according to the divided VLANs; S3. When the layer 2 switch receives data that needs to be processed at layer 3, the layer 2 switch sends the corresponding VLAN data packet to the network server through the trunk, so that the network server routes the VLAN data packet through the network function software after receiving the VLAN data packet.
2. The method for upgrading a layer 2 switch to a layer 3 switch according to claim 1, characterized in that: S1, including: Creating multiple VLANs on the layer 2 switch; The ports of the layer 2 switch are respectively divided into the multiple VLANs, so that the ports of the layer 2 switch are associated with each VLAN.
3. The method for upgrading a layer 2 switch to a layer 3 switch according to claim 1, characterized in that: S2, including: When receiving a data packet to be forwarded, the layer 2 switch obtains a destination VLAN identifier of the data packet to be forwarded; According to the destination VLAN identifier, the data packet to be forwarded is forwarded to the corresponding VLAN.
4. The method for upgrading a layer 2 switch to a layer 3 switch according to claim 1, characterized in that: In S3, the network server performs routing processing on the VLAN data packet through network function software, including: The network server decodes the VLAN data packet through network function software to obtain the data packet content; Determine the destination VLAN ID corresponding to the VLAN data packet according to the network topology and the routing table; The data packet content of the VLAN data packet is classified into a VLAN processing queue corresponding to the destination VLAN identifier.
5. The method for upgrading a layer 2 switch to a layer 3 switch according to claim 2, characterized in that: When there are multiple data that need to be processed at the third layer, the second layer switch sends the corresponding VLAN data packet to the network server through the port corresponding to each data via the trunk.
6. The method for upgrading a layer 2 switch to a layer 3 switch according to any one of claims 1 to 5, characterized in that: The network server comprises a Linux server.
7. The method for upgrading a layer 2 switch to a layer 3 switch according to any one of claims 1 to 5, characterized in that: The network function software includes the network function software Quagga.
8. A system for upgrading a layer 2 switch to a layer 3 switch, characterized in that: It includes a layer 2 switch and a network server, including: The layer 2 switch is connected to a network server via a trunk, and the network server is installed with network function software; The layer 2 switch is used to divide VLANs; forward data packets according to the divided VLANs; when the layer 2 switch receives data that needs to be processed at layer 3, the layer 2 switch sends the corresponding VLAN data packet to the network server through the trunk; The network server is used for routing the VLAN data packet through the network function software after receiving the VLAN data packet.
9. A system for upgrading a layer 2 switch to a layer 3 switch, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the method for upgrading a layer-2 switch to a layer-3 switch according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for upgrading a layer-2 switch to a layer-3 switch according to any one of claims 1 to 7 is implemented.
