A three-layer switch, network system and data transmission method
By grouping the ports of the Layer 3 switch and specifying specific ports for physical connection, the problem of the Layer 3 switch relearning ARP entries during the failover of the Layer 2 ring network is solved, optimizing the service interruption time and ensuring high network performance. reliability.
Patent Information
- Application Number
- CN202211642543.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2042-12-20
AI Technical Summary
During the failover of the Layer 2 ring network, the ARP entries of the Layer 3 switch need to be relearned, resulting in service interruption times that may reach the second level, seriously affecting performance.
By dividing the ports of the Layer 3 switch into two groups, which are used for Layer 2 forwarding and routing forwarding respectively, and specifying specific ports for physical connection, the ARP table entries remain unchanged and the service interruption time is consistent with the Layer 2 ring network failure switching time.
The interruption time of Layer 3 services is kept within 50ms, which improves network reliability and avoids second-level interruptions caused by ARP table entry relearning.
Smart Images

Figure CN115766334B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of switches, and in particular to a three-layer switch, a network system and a data transmission method. Background Art
[0002] In traditional networking solutions, layer 2 switches and routers are different devices. Layer 2 switches serve as ring nodes to form a second-layer ring network and provide redundancy. Routers serve as gateways for layer 2 networks and are interconnected with external networks.
[0003] Since the second-layer ring network is a complete ring in physical topology, in order to avoid loop storms, a link on the ring is blocked according to the ring network protocol, and the ring structure of the physical topology is converted into a linear structure of the logical topology. When a link in the ring network fails, the original blocked link is released according to the ring network protocol to achieve the network connection state after the ring network fault switching.
[0004] In the above-mentioned ring network link fault switching process, only the Layer 2 switch S on the ring network needs to refresh the local MAC (Media Access Control) forwarding table to achieve the switching of Layer 2 traffic, and the ARP (Address Resolution Protocol) table entry on the router R will not change. In other words, in the traditional networking solution, the topology changes caused by the fault switching of the Layer 2 ring network will not affect the forwarding of the router. Since the fault switching time of the Layer 2 ring network is generally within 50ms, the Layer 3 service can be restored immediately after the Layer 2 ring network completes the switching, so the interruption time of the Layer 3 service fault is usually also within 50ms.
[0005] However, with the widespread use of Layer 3 switches, Layer 3 switches that integrate the functions of Layer 2 switches and routers have gradually become nodes of ring networks, changing the networking structure of ring networks. Compared with traditional routers, the content of ARP entries on Layer 3 switches has also changed. The ARP entries of Layer 3 switches have more physical port numbers than traditional routers, as shown in Table 1 below:
[0006] Table 1
[0007] Traditional router Layer 3 switch IP+MAC+outbound interface IP+MAC+outbound interface+outbound port
[0008] In the networking structure using a three-layer switch, when the two-layer ring network topology changes, the three-layer switch needs to relearn ARP. Although the switching time of the two-layer ring network is within 50ms, after the two-layer ring network switching is completed, the three-layer service cannot be restored before the ARP table of the three-layer switch RS is relearned. The time for the three-layer switch RS to relearn ARP may be in the order of seconds, which may cause the interruption time of the three-layer service to reach the order of seconds, seriously affecting the service performance. Summary of the invention
[0009] The purpose of the present application is to provide a three-layer switch, a network system and a data transmission method, which are used to solve the problem that during the fault switching of the second-layer ring network, the ARP table entries of the three-layer switch RS need to be relearned and the time may be in the order of seconds, which may cause the interruption time of the three-layer service to reach the order of seconds, seriously affecting the service performance.
[0010] In a first aspect, an embodiment of the present application provides a three-layer switch, wherein the three-layer switch includes a first port group and a second port group, wherein:
[0011] The first port group includes a plurality of layer 2 forwarding ports, the layer 2 forwarding ports are all configured in the first virtual local area network, and one port is set as a specific connection port, and the non-specific connection port is connected to the layer 2 ring network;
[0012] The second port group includes a plurality of layer 3 forwarding ports, the layer 3 forwarding ports are respectively configured in a second virtual local area network that is different from the first virtual local area network and independent of each other, and one layer 3 forwarding port is set as a specific forwarding port, and the non-specific forwarding port is connected to the upper network;
[0013] The specific connection port and the specific forwarding port are physically connected.
[0014] In one or more possible embodiments, the three-layer switch further includes:
[0015] The data processing unit is used to perform layer 2 forwarding of data between a non-specific connection port and a specific connection port according to a locally stored MAC address forwarding table, and to perform routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to a locally stored routing table.
[0016] In one or more possible embodiments, the IP address and MAC address of the specific forwarding port in the MAC address forwarding table are respectively a gateway IP address and a gateway MAC address;
[0017] The port number corresponding to the gateway MAC address in the MAC address table is a specific connection port, so that the non-specific connection port in the first port group performs layer 2 forwarding to the specific connection port.
[0018] In one or more possible embodiments, the entries of the MAC address forwarding table include a MAC address, a VLAN ID, and a port number;
[0019] The data processing unit specifically establishes a MAC address forwarding table in the following manner:
[0020] Receive an ARP request packet broadcast by a terminal, wherein the ARP request packet carries the terminal's IP as a source IP address, the terminal's MAC as a source MAC address, and the gateway's IP as a destination IP;
[0021] Learning the source MAC address in the ARP request data packet, determining the table entry corresponding to the terminal MAC address, and sending the ARP request data packet from the specific connection port;
[0022] After receiving the ARP request packet through a specific forwarding port, an ARP reply packet is sent from the specific forwarding port, wherein the ARP reply packet carries the MAC of the gateway as the source MAC and the MAC of the terminal as the destination MAC;
[0023] After receiving the ARP reply data packet through a specific connection port, learning the source MAC address in the ARP reply data packet to determine the table entry corresponding to the gateway MAC address;
[0024] The MAC address is queried according to the destination MAC address in the ARP reply data packet to obtain the egress port, and the ARP reply data packet is sent from the determined egress port through the layer 2 ring network and finally reaches the terminal, so that the terminal uses the source MAC address in the ARP reply data packet as the MAC address of the gateway recorded locally.
[0025] In one or more possible embodiments, the routing table includes a static routing table entry whose destination IP is a remote server IP and a direct routing table entry whose destination IP is a terminal IP;
[0026] The data processing unit specifically establishes a direct connection routing table entry in the following manner:
[0027] Receive an ARP request data packet from a terminal forwarded by a specific connection port through a specific forwarding port, wherein the ARP request data packet carries the IP of the terminal as a source IP address, the MAC of the terminal as a source MAC address, and the IP of the gateway as a destination IP;
[0028] A new ARP table entry is constructed based on the source IP address and the source MAC address in the ARP request data packet, and a direct routing table entry is generated based on the new ARP table entry.
[0029] In one or more possible embodiments, the data processing unit is specifically used to receive an uplink IP data packet from a non-specific connection port, search for an entry corresponding to a gateway MAC address in a MAC address forwarding table according to a destination MAC address, obtain a corresponding egress port as the specific connection port, and forward the uplink IP data packet to the specific connection port;
[0030] The data processing unit is specifically used to receive a downlink IP data packet from a specific forwarding port through a specific connection port, determine in a MAC address forwarding table that the egress port corresponding to the destination MAC address is a non-specific connection port, and forward the downlink IP data packet to the non-specific connection port;
[0031] The uplink IP data packet carries the IP address of the terminal as the source IP address, the MAC address of the terminal as the source MAC address, the IP address of the remote server as the destination IP address, and the MAC address of the gateway as the destination MAC address, and the downlink IP data packet carries the MAC address of the terminal as the destination MAC address.
[0032] In one or more possible embodiments, the data processing unit is specifically used to obtain the destination IP address of the uplink IP data packet after receiving the uplink IP data packet through the specific forwarding port, search the local static routing table according to the obtained destination IP address, and modify the layer 2 header of the IP data packet according to the obtained outbound interface VLAN ID and next hop IP address and then forward it to the corresponding non-specific forwarding port;
[0033] The data processing unit is specifically used to, after receiving a downlink IP data packet through a non-specific forwarding port, search the locally stored direct routing table entries and ARP table entries according to the destination IP address therein to determine the MAC address and outbound interface VLAN ID corresponding to the destination IP address, and modify the destination MAC address and outbound interface VLAN ID of the downlink IP data packet, and then forward it to the specific forwarding port.
[0034] In a second aspect, an embodiment of the present application further provides a three-layer network system, including a second-layer ring network, a terminal connected to a ring network node, and an upper-level network that is not in the same network segment as the terminal, and the system further includes:
[0035] The three-layer switch provided by the first aspect above, wherein:
[0036] The three-layer switch accesses the two-layer ring network through two non-specific connection ports in the first port group, is connected to the upper-level network through the non-specific forwarding port in the second port group, performs two-layer forwarding of data between the non-specific connection port and the specific connection port according to the locally stored MAC address forwarding table, and performs routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the locally stored routing table.
[0037] In a third aspect, an embodiment of the present application further provides a data transmission method, including:
[0038] According to the locally stored MAC address forwarding table, perform layer 2 forwarding of data between the non-specific connection port and the specific connection port in the first port group;
[0039] According to the locally stored routing table, data is routed and forwarded between the specific forwarding port and the non-specific forwarding port in the second port group.
[0040] In one or more possible embodiments, the IP address and MAC address of the specific forwarding port in the MAC address forwarding table are respectively a gateway IP address and a gateway MAC address;
[0041] The port number corresponding to the gateway MAC address in the MAC address table is a specific connection port, so that the non-specific connection port in the first port group performs layer 2 forwarding to the specific connection port.
[0042] In one or more possible embodiments, the entries of the MAC address forwarding table include a MAC address, a VLAN ID, and a port number;
[0043] Create a MAC address forwarding table in the following ways:
[0044] Receive an ARP request packet broadcast by a terminal, wherein the ARP request packet carries the terminal's IP as a source IP address, the terminal's MAC as a source MAC address, and the gateway's IP as a destination IP;
[0045] Learning the source MAC address in the ARP request data packet, determining the table entry corresponding to the terminal MAC address, and sending the ARP request data packet from the specific connection port;
[0046] After receiving the ARP request packet through a specific forwarding port, an ARP reply packet is sent from the specific forwarding port, wherein the ARP reply packet carries the MAC of the gateway as the source MAC and the MAC of the terminal as the destination MAC;
[0047] After receiving the ARP reply data packet through a specific connection port, learning the source MAC address in the ARP reply data packet to determine the table entry corresponding to the gateway MAC address;
[0048] The MAC address is queried according to the destination MAC address in the ARP reply data packet to obtain the egress port, and the ARP reply data packet is sent from the determined egress port through the layer 2 ring network and finally reaches the terminal, so that the terminal uses the source MAC address in the ARP reply data packet as the MAC address of the gateway recorded locally.
[0049] In one or more possible embodiments, the routing table includes a static routing table entry whose destination IP is a remote server IP and a direct routing table entry whose destination IP is a terminal IP;
[0050] Create a direct route entry in the following way:
[0051] Receive an ARP request data packet from a terminal forwarded by a specific connection port through a specific forwarding port, wherein the ARP request data packet carries the IP of the terminal as a source IP address, the MAC of the terminal as a source MAC address, and the IP of the gateway as a destination IP;
[0052] A new ARP table entry is constructed based on the source IP address and the source MAC address in the ARP request data packet, and a direct routing table entry is generated based on the new ARP table entry.
[0053] In one or more possible embodiments, performing Layer 2 forwarding of data between a non-specific connection port and a specific connection port in the first port group according to the locally stored MAC address forwarding table includes:
[0054] Receive an uplink IP data packet from a non-specific connection port, search for an entry corresponding to a gateway MAC address in a MAC address forwarding table according to a destination MAC address, obtain a corresponding outbound port as the specific connection port, and forward the uplink IP data packet to the specific connection port;
[0055] Receiving a downlink IP data packet from a specific forwarding port through a specific connection port, determining in a MAC address forwarding table that an outbound port corresponding to a destination MAC address is a non-specific connection port, and forwarding the downlink IP data packet to the non-specific connection port;
[0056] The uplink IP data packet carries the IP address of the terminal as the source IP address, the MAC address of the terminal as the source MAC address, the IP address of the remote server as the destination IP address, and the MAC address of the gateway as the destination MAC address, and the downlink IP data packet carries the MAC address of the terminal as the destination MAC address.
[0057] In one or more possible embodiments, routing and forwarding data between the specific forwarding port and the non-specific forwarding port according to the locally stored routing table includes:
[0058] After receiving an uplink IP data packet through a specific forwarding port, obtain the destination IP address of the uplink IP data packet, search the local static routing table according to the obtained destination IP address, modify the layer 2 header of the IP data packet according to the obtained outbound interface VLAN ID and next hop IP address, and then forward it to the corresponding non-specific forwarding port;
[0059] After receiving a downlink IP data packet through a non-specific forwarding port, the locally stored direct routing table entry and ARP table entry are searched according to the destination IP address therein to determine the MAC address and outbound interface VLAN ID corresponding to the destination IP address, and the destination MAC address and outbound interface VLAN ID of the downlink IP data packet are modified and then forwarded to the specific forwarding port.
[0060] In a fourth aspect, an embodiment of the present application provides a data transmission method, which is applied to the three-layer network system provided in the second aspect above, including:
[0061] The terminal communicates data with a remote server located in the upper network through the second-layer ring network and the third-layer switch;
[0062] The data communication includes: according to the flow direction of the communication data, performing layer 2 forwarding of data between the non-specific connection port and the specific connection port of the three-layer switch according to the local MAC address forwarding table; and routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the routing table.
[0063] In a fifth aspect, another embodiment of the present application further provides a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program is used to enable a computer to execute the data transmission method provided in the first aspect of the embodiment of the present application.
[0064] In the embodiment of the present application, for a ring network structure using a three-layer switch as a ring node, two physical ports of the three-layer switch are interconnected, and the ports of the three-layer switch are divided into two groups for two-layer forwarding and routing forwarding respectively, and a specific port physical connection is designated in each of the two groups of ports, and the port located in the three-layer forwarding is designated as the gateway for the two-layer forwarding. In this way, when the ring network topology changes, the ARP table entries of the three-layer switch remain unchanged, and the interruption time of the three-layer service is consistent with the fault switching time of the two-layer ring network, reaching 50ms, thereby improving network reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. Obviously, the drawings introduced below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0066] Figure 1a It is a schematic diagram of the networking structure of a layer 2 switch when no link failure occurs in the related technology;
[0067] Figure 1b A schematic diagram of a network structure of a layer 2 switch when a link failure occurs in the related technology;
[0068] Figure 2a It is a schematic diagram of the networking structure of applying a three-layer switch when no link failure occurs in the related technology;
[0069] Figure 2b A schematic diagram of a network structure using a three-layer switch when a link failure occurs in the related technology;
[0070] Figure 3 A schematic diagram of the port layout of a three-layer switch provided in an embodiment of the present application;
[0071] Figure 4 A schematic diagram of the topological structure of a three-layer network system in an embodiment of the present application;
[0072] Figure 5 A schematic diagram of the process of constructing a MAC address forwarding table and a direct routing table in an embodiment of the present application;
[0073] Figure 6 This is a schematic diagram of data flow in the uplink direction in an embodiment of the present application;
[0074] Figure 7 This is a schematic diagram of data flow in the downlink direction in an embodiment of the present application;
[0075] Figure 8 This is a schematic diagram of data flow in the uplink direction when a faulty link forms a new blocked link in an embodiment of the present application. DETAILED DESCRIPTION
[0076] To further illustrate the technical solution provided by the embodiments of the present application, a detailed description is given below in conjunction with the accompanying drawings and specific implementation methods.
[0077] Since the ring network is a complete ring in physical topology, in order to avoid loop storm, a link on the ring is blocked according to the ring network protocol, turning the ring structure of the physical topology into a linear structure of the logical topology. Figure 1aThe figure shows the network connection status of a typical layer 2 switch networking structure in a normal state (i.e., when the links between nodes in the network are normal). Figure 1a The figure schematically shows the path for traffic exchange between terminal T and the network side: the traffic from the network side is forwarded by router R, enters the ring network composed of layer 2 switches, and finally reaches terminal T; the traffic from terminal T enters the ring network composed of layer 2 switches, is forwarded by router R, and reaches the network side.
[0078] Figure 1b It shows that when a link in the ring network fails, the previously blocked link is released according to the ring network protocol to achieve the network connection status after the ring network fails over; Figure 1b The figure still schematically shows the path for traffic exchange between terminal T and the network side: the traffic from the network side is forwarded by router R, enters the ring network composed of layer 2 switches, and can still reach terminal T; the traffic from terminal T enters the ring network composed of layer 2 switches, and reaches the network side after being forwarded by router R.
[0079] In the above-mentioned ring network link fault switching process, only the Layer 2 switch S on the ring network needs to refresh the local MAC address forwarding table to achieve the Layer 2 traffic switching, and the ARP table entries on the router R will not change. In other words, in the traditional networking solution, the topology changes caused by the fault switching of the Layer 2 ring network will not affect the router forwarding. Since the fault switching time of the Layer 2 ring network is generally within 50ms, the Layer 3 service can be restored immediately after the Layer 2 ring network completes the switching, so the interruption time of the Layer 3 service fault is usually also within 50ms.
[0080] However, with the widespread application of three-layer switches, the three-layer switches that integrate the functions of two-layer switches and routers have gradually become the nodes of the ring network, which has changed the networking structure of the ring network. Compared with traditional routers, the content of the ARP table entries on the three-layer switches has also changed. The ARP table entries of the three-layer switches have more physical port numbers than traditional routers.
[0081] Figure 2a The figure shows the network connection status of a typical three-layer switch networking structure under normal conditions. A link in the second-layer ring network is blocked. The message of terminal T (IP1, MAC1) enters from port 1 of the three-layer switch RS. The three-layer switch RS learns that the ARP table entry of terminal T is IP1+MAC1+outgoing interface+port 1. When the link of the ring network fails, the topology of the second-layer ring network changes, such as Figure 2bAs shown in the figure, the blocked link is restored to the forwarding state, and the faulty link becomes blocked. At this time, the ARP table entry learned by the three-layer switch RS for the terminal user T becomes IP1+MAC1+outgoing interface+port 2. That is, in the networking structure using the three-layer switch, when the two-layer ring network topology changes, the three-layer switch needs to relearn ARP. Although the switching time of the two-layer ring network is within 50ms, after the two-layer ring network switching is completed, the three-layer service cannot be restored before the ARP table entry of the three-layer switch RS is relearned. The time for the three-layer switch RS to relearn ARP may be in the second level, which may cause the interruption time of the three-layer service to reach the second level, seriously affecting the service performance.
[0082] In view of the above technical problems in the related art, the present application proposes a three-layer switch, the three-layer switch comprising a first port group and a second port group, wherein:
[0083] The first port group includes a plurality of layer 2 forwarding ports, the layer 2 forwarding ports are all configured in the first virtual local area network, and one port is set as a specific connection port, and the non-specific connection port is connected to the layer 2 ring network;
[0084] The above-mentioned layer 2 forwarding ports except the specific connection port are non-specific connection ports. The specific connection port and the other non-specific connection ports in the embodiment of the present application respectively form a layer 2 forwarding path;
[0085] The second port group includes a plurality of layer 3 forwarding ports, the layer 3 forwarding ports are respectively configured in a second virtual local area network that is different from the first virtual local area network and independent of each other, and one layer 3 forwarding port is set as a specific forwarding port, and the non-specific forwarding port is connected to the upper network; the ports other than the specific forwarding port in the above-mentioned layer 3 forwarding ports are non-specific forwarding ports;
[0086] The specific connection port and the specific forwarding port are physically connected.
[0087] In one or more possible embodiments, the three-layer switch further includes:
[0088] The data processing unit is used to perform layer 2 forwarding of data between a non-specific connection port and a specific connection port according to a locally stored MAC address forwarding table, and to perform routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to a locally stored routing table.
[0089] The present application is directed to a ring network structure using a layer 3 switch as a ring node. By interconnecting two physical ports of the layer 3 switch, the ports of the layer 3 switch are divided into two groups for layer 2 forwarding and routing forwarding respectively, and a specific port is designated for physical connection in each of the two groups of ports. The port located at the layer 3 forwarding is designated as the gateway for the layer 2 forwarding. In this way, when the ring network topology changes, the ARP table entries of the layer 3 switch remain unchanged, and the interruption time of the layer 3 service is consistent with the fault switching time of the layer 2 ring network, reaching 50ms, thereby improving network reliability.
[0090] like Figure 3 In the three-layer switch of the example embodiment of the present application shown in the figure, ports 1-20 of the three-layer switch are set to the first port group, port 20 is a specific connection port; ports 21-28 are set to the second port group, port 21 is a specific forwarding port; port 20 and port 21 are physically connected through a network cable; data received by ports 1-port 19 are forwarded at the second layer according to their corresponding MAC address forwarding tables, sent out by port 20, and then forwarded at the third layer through port 21 according to the routing forwarding table.
[0091] Therefore, in the embodiment of the present application, the three-layer switch is actually virtualized into a virtual two-layer switch consisting of a first port group and a corresponding local MAC address forwarding table, and a virtual router consisting of a second port group and a corresponding routing forwarding table, and data forwarding is performed through the virtual switch and the virtual router. In the three-layer switch, for the first port group and the second port group, each has its own forwarding table, and the number of ports in the uplink port group and the number of ports in the second port group can be determined by ordinary technicians in the field according to actual application scenarios, but the sum of the number of ports in the uplink port group and the number of ports in the second port group is not greater than the number of ports of the three-layer switch; the first virtual local area network to which the ports in the first port group belong and the virtual local area network to which the ports in the second port group belong are completely different, and the virtual local area networks to which the ports in the second port group belong are also completely different, and the specific allocation can be determined by ordinary technicians in the field according to networking requirements.
[0092] In the three-layer switch proposed in the present application, no matter which non-specific connection port in the first port group the data is received from, the data will first be forwarded to the specific connection port through the second layer, and then sent to the specific forwarding port in the second port group, which will perform subsequent three-layer forwarding. As a result, when the three-layer switch is used as a ring network node, if a link failure occurs within the ring and only the second-layer forwarding is switched, the switching time is consistent with the second-layer ring network switching time, thereby ensuring business performance.
[0093] In one or more possible embodiments, the data processing unit performs Layer 2 forwarding of data between the non-specific connection port and the specific connection port according to the locally stored MAC address forwarding table, specifically including:
[0094] Receive an uplink IP data packet from a non-specific connection port, search for an entry corresponding to a gateway MAC address in a MAC address forwarding table according to a destination MAC address, obtain a corresponding outbound port as the specific connection port, and forward the uplink IP data packet to the specific connection port;
[0095] Receiving a downlink IP data packet from a specific forwarding port through a specific connection port, determining in a MAC address forwarding table that an outbound port corresponding to a destination MAC address is a non-specific connection port, and forwarding the downlink IP data packet to the non-specific connection port;
[0096] The uplink IP data packet carries the IP address of the terminal as the source IP address, the MAC address of the terminal as the source MAC address, the IP address of the remote server as the destination IP address, and the MAC address of the gateway as the destination MAC address, and the downlink IP data packet carries the MAC address of the terminal as the destination MAC address.
[0097] In one or more possible embodiments, the data processing unit performs routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the locally stored routing table, specifically including:
[0098] After receiving an uplink IP data packet through a specific forwarding port, obtain the destination IP address of the uplink IP data packet, search the local static routing table according to the obtained destination IP address, modify the layer 2 header of the IP data packet according to the obtained outbound interface VLAN ID and next hop IP address, and then forward it to the corresponding non-specific forwarding port;
[0099] After receiving a downlink IP data packet through a non-specific forwarding port, the locally stored direct routing table entry and ARP table entry are searched according to the destination IP address therein to determine the MAC address and outbound interface VLAN ID corresponding to the destination IP address, and the destination MAC address and outbound interface VLAN ID of the downlink IP data packet are modified and then forwarded to the specific forwarding port.
[0100] The present application embodiment provides a data transmission method, which is applied to the above-mentioned three-layer switch, including:
[0101] According to the locally stored MAC address forwarding table, perform layer 2 forwarding of data between the non-specific connection port and the specific connection port in the first port group;
[0102] According to the locally stored routing table, data is routed and forwarded between the specific forwarding port and the non-specific forwarding port in the second port group.
[0103] In one or more possible embodiments, the method for performing Layer 2 forwarding of data between the non-specific connection port and the specific connection port in the first port group according to the locally stored MAC address forwarding table is as described above, and the method for performing routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the locally stored routing table is as described above, which will not be described in detail here.
[0104] The present application also provides a three-layer network system. Figure 4 As shown, it includes a layer 2 ring network, a terminal connected to a node of the layer 2 ring network, and an upper-level network that is not in the same network segment as the terminal. The system also includes: the above-mentioned layer 3 switch, the layer 3 switch is connected to the upper-level network as a node of the layer 2 ring network and as a gateway of the layer 2 network, wherein:
[0105] The three-layer switch accesses the two-layer ring network through two non-specific connection ports in the first port group, is connected to the upper-level network through the non-specific forwarding port in the second port group, performs two-layer forwarding of data between the non-specific connection port and the specific connection port according to the locally stored MAC address forwarding table, and performs routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the locally stored routing table.
[0106] exist Figure 4In the above-mentioned three-layer switch, the three-layer switch mentioned above in this application is directly quoted here. Port 1 and port 2 in the first port group of the above-mentioned three-layer switch are used as ring ports to access the second-layer ring network, port 28 is used as a non-specific forwarding port in the second port group to connect to the upper network, the specific connection port (port 20) in the first port group and the specific forwarding port (port 21) in the second port group are connected through a network cable, all ports in the first port group only enable the second-layer forwarding function, and do not enable the third-layer forwarding function, and the ports in the first port group are all added to VLAN1. In fact, the first port group and the corresponding MAC address forwarding table constitute a virtual layer 2 switch; further, the port 20 closes the port security policy to avoid recognizing the source MAC as the switch's own MAC when receiving a message forwarded from port 21, judging it as a message sent by itself and terminating the forwarding of the message; each port in the second port group (port 21-port 28) only opens the three-layer forwarding function, and each joins an independent virtual LAN, for example: port 21 joins VLAN 3001, port 22 joins VLAN3002, ..., port 28 joins VLAN3008, thereby, ports 21 to 28 are isolated from each other at the second layer, and the second-layer traffic cannot communicate with each other. In fact, the second port group and the corresponding routing forwarding table constitute a virtual router. Furthermore, since port 20 and port 21 are connected by network cable, the IP address of port 21 is used as the gateway address of the layer 2 network to which the first port group belongs, and port 28 is created as a layer 3 interface to achieve connection with the external superior network. The traffic interconnection between port 21 and port 28 is achieved by layer 3 routing forwarding. At this time, the layer 3 switch in this network structure is equivalent to acting as a "virtual layer 2 switch + virtual router" network structure.
[0107] In one or more possible embodiments, the IP address and MAC address of the specific forwarding port in the above MAC address forwarding table are respectively a gateway IP address and a gateway MAC address;
[0108] The port number corresponding to the gateway MAC address in the MAC address table is a specific connection port, so that the non-specific connection port in the first port group performs layer 2 forwarding to the specific connection port.
[0109] In the embodiment of the present application, the entries of the MAC address forwarding table include the MAC address, VLAN ID, and port number; the MAC address of the gateway is obtained in the three-layer switch through the APR request to construct the MAC address forwarding table. The routing table in the embodiment of the present application includes a static routing table entry whose destination IP is the remote server IP and a direct routing table entry whose destination IP is the terminal IP. Exemplarily, each port on the three-layer switch is configured as follows: Port 21 is configured as a gateway for layer 2 forwarding, and the IP address and VLAN ID of port 21 as the gateway, the IP of port 21: 192.168.1.1, VLAN: 3001, and the three-layer switch is provided with static routing table entries to each remote server, and the static routing table entries include: destination IP address, mask, next hop address and outbound interface. Exemplarily, the following Table 2 is a static routing table entry to the remote server N:
[0110] Table 2
[0111] Destination IP address Mask Next hop Outbound interface IPN 255.255.255.255 10.0.0.1 VLAN 3008
[0112] like Figure 5 The process of constructing a MAC address forwarding table and a direct routing table through an APR request process in an embodiment of the present application is shown, which specifically includes the following steps:
[0113] Step S501: Terminal T broadcasts an ARP request packet to request the MAC address of the gateway (port 21) 192.168.1.1; the layer 3 switch receives the ARP request packet broadcast by the terminal, and the ARP request packet carries the terminal's IP as the source IP address, the terminal's MAC as the source MAC address, and the gateway's IP as the destination IP;
[0114] Step S502: The layer 3 switch learns the source MAC address in the ARP request data packet, determines the table entry corresponding to the terminal MAC address, and sends the ARP request data packet from the specific connection port;
[0115] Port 1 of the three-layer switch receives the ARP request data packet transmitted through the ring network, learns the source MAC address in the ARP request data packet, and creates a MAC address forwarding table entry as shown in Table 3 below in the local MAC address forwarding table, and then sends the ARP request data packet from port 20;
[0116] Table 3
[0117] MAC Address VLAN ID Port Number MAC1 1 1
[0118] Step S503, after receiving the ARP request data packet through a specific forwarding port, the layer 3 switch learns and constructs a new ARP table entry based on the source IP address and the source MAC address in the ARP request data packet, and generates a direct routing table entry based on the new ARP table entry;
[0119] After receiving the ARP request packet, port 21 of the layer 3 switch obtains the source IP address and the source MAC address, learns and constructs a new ARP table entry as shown in Table 4 below, and generates a direct route table entry as shown in Table 5 based on the new ARP table entry;
[0120] Table 4
[0121] Destination IP address Destination MAC address Layer 3 interface port IP1 MAC1 VLAN 3001 21
[0122] Table 5
[0123] Destination IP address Mask Next hop Outbound interface IP1 255.255.255.255 IP1 VLAN 3001
[0124] Step S504, the layer 3 switch sends an ARP reply data packet from the specific forwarding port, wherein the ARP reply data packet carries the MAC of the gateway as the source MAC and the MAC of the terminal as the destination MAC;
[0125] The layer 3 switch knows from the destination IP address in the ARP request packet that the received ARP request packet requests its own MAC address, and therefore sends an ARP reply packet for the ARP request packet of the terminal T from port 21, wherein the source MAC address is the local MAC address MAC RS;
[0126] Since port 20 and port 21 of the three-layer switch are physically connected, the ARP request data packet sent from port 20 of the three-layer switch is directly received by port 21 and enters the three-layer switch from port 21; similarly, the ARP reply data packet sent from port 21 of the three-layer switch is directly received by port 20 and enters the three-layer switch from port 20.
[0127] Step S505, after receiving the ARP reply data packet through the specific connection port, learning the source MAC address in the ARP reply data packet, and determining the table entry corresponding to the gateway MAC address;
[0128] After receiving the ARP reply data packet, port 20 of the layer 3 switch learns the source MAC address therein and creates a new MAC address forwarding entry in the local MAC address forwarding table, as shown in Table 6 below.
[0129] Table 6
[0130] MAC Address VLAN ID Port Number MAC1 1 1 MAC RS 1 20
[0131] In step S506, the layer 3 switch queries the MAC address according to the destination MAC address in the ARP reply data packet to obtain the output port, sends the ARP reply data packet from the determined output port through the layer 2 ring network and finally reaches the terminal, so that the terminal uses the source MAC address in the ARP reply data packet as the MAC address of the gateway recorded locally.
[0132] The layer 3 switch searches the MAC address forwarding table according to the destination MAC address in the ARP reply data packet, hits the MAC1 entry, obtains the egress port 1, and sends the ARP reply data packet from port 1 through the layer 2 ring network to finally reach terminal T.
[0133] Step S507: After receiving the ARP reply data packet, terminal T obtains and locally records the MAC address of the gateway as MACRS.
[0134] Therefore, through the above steps S501-S507, not only the gateway address is obtained, but also the MAC address of the terminal that initiates the ARP request can be learned.
[0135] The present application provides a data transmission method, which is applied to the above three-layer network system. The method includes:
[0136] The terminal communicates data with a remote server located in the upper network through the second-layer ring network and the third-layer switch;
[0137] The data communication includes: according to the flow direction of the communication data, performing layer 2 forwarding of data between the non-specific connection port and the specific connection port of the three-layer switch according to the local MAC address forwarding table; and routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the routing table.
[0138] Based on the above three-layer network system, the following will introduce the method of data communication between the terminal and the upper network through the ring network. The following example is used to illustrate the data communication between the terminal T (IP address: IP1, MAC address: MAC1) and the remote server N (IP address: IPN).
[0139] The data transmission method between the terminal and the remote server includes data transmission in the uplink direction and data transmission in the downlink direction.
[0140] Data transmission in the uplink direction is as follows Figure 6 As shown, it mainly includes:
[0141] Step S600: The terminal T sends an uplink IP data packet to the remote server N through the layer 2 ring network. The source IP address of the uplink IP data packet is IP1, the source MAC address is MAC1, the destination IP address is IPN, and the destination MAC address is the MAC address of the layer 3 switch RS itself.
[0142] In this step, when terminal T needs to send an uplink IP data packet to the remote server N, because the remote server N and terminal T are not in the same network segment, terminal T must rely on gateway forwarding to communicate with the remote server N; and in this application, a port of a three-layer switch is required to act as a gateway. The gateway MAC address is obtained before terminal T can send an IP data packet to the remote server across the network segment and is recorded locally.
[0143] Step S601: after receiving the uplink IP data packet from the ring network, port 1 of the layer 3 switch searches the MAC address forwarding table for an entry that hits the MAC address MAC RS of a specific connection port, obtains the output port 20, and sends the packet from port 20 to port 21 of the layer 3 switch connected via a network cable;
[0144] In this step, the entries in the MAC address forwarding table may be pre-set or acquired through learning.
[0145] Step S602: After receiving the uplink IP data packet from port 21, the layer 3 switch obtains the destination IP address of the IP data packet, searches the local static routing table, modifies the layer 2 header of the IP data packet based on the obtained outbound interface VLAN 3008 and next hop 10.0.0.1 information, sends it from port 28, and finally reaches the remote server N.
[0146] Data transmission in the downlink direction is as follows Figure 7 As shown, it mainly includes:
[0147] Step S700: The remote server N sends a downlink IP data packet to the terminal T through the layer 2 ring network, wherein the destination IP address in the downlink IP data packet is IP1;
[0148] Step S701: After the port of the three-layer switch receives the downstream IP data packet, it searches for the locally stored direct routing table entry according to the destination IP address therein, and determines the next hop information according to the direct routing table entry shown in Table 5: then obtain the MAC address corresponding to the destination IP address in Table 4 as MAC1, the outbound interface VLAN ID as 3001, and the port number as 21; modify the destination MAC address of the downstream IP data packet to MAC1, modify the VLAN ID to 3001, and then send it out from port 21;
[0149] Step S702: Port 20 of the three-layer switch receives the downstream IP data packet sent from port 21 through the network cable, determines in the locally stored MAC address forwarding table that the message with destination MAC as MAC1 corresponds to port 1, and sends the downstream IP data packet from port 1 through the two-layer ring network to finally reach terminal T.
[0150] Furthermore, the method described above for data communication between the terminal and the upper network through the ring network is based on Figure 4 The three-layer network system shown in Figure 4 In the three-layer network system in the second-layer ring network, the links between the nodes in the ring are in normal state. According to the ring network protocol, a link on the ring is blocked to avoid the occurrence of a ring storm. However, when a link in the ring network fails, the previously blocked link is released according to the ring network protection mechanism, and the failed link forms a new blocked link. At this time, the data flow in the upstream direction is as follows: Figure 8 As shown, the uplink data packet sent by terminal T reaches port 2 of the three-layer switch through the ring network, searches the MAC address forwarding table to hit the entry of the gateway MAC address MAC RS, obtains the output port 20, and sends it from port 20 to port 21 of the three-layer switch connected by the network cable; since the ARP table entry of IP1 maintained on the three-layer switch does not change, it is always as shown in Table 4, and will not change due to different access ports. During the fault switching of the two-layer ring network, only the switching needs to occur in the two-layer ring network, and the ARP table entries stored in the three-layer switch are not affected, and there is no need to re-learn the ARP table entries. Therefore, the three-layer service interruption time depends on the fault switching time of the two-layer ring network, which is still usually less than 50ms.
[0151] The embodiment of the present application optimizes the three-layer service performance of the three-layer switch in the ring network topology change by virtualizing the three-layer switch into a two-layer switch + router, without increasing the complexity of the software, adding new hardware resources (CPU, memory, etc.), and adding new software systems; in the networking solution with the three-layer switch as the ring node, the time for the three-layer service interruption caused by the second-layer ring network failure switching is optimized from seconds to within 50ms.
[0152] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0153] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A three-layer switch, characterized in that: The three-layer switch includes a first port group and a second port group, wherein: The first port group includes a plurality of layer 2 forwarding ports, the layer 2 forwarding ports are all configured in the first virtual local area network, and one port is set as a specific connection port, and the non-specific connection port is connected to the layer 2 ring network; The second port group includes a plurality of layer 3 forwarding ports, the layer 3 forwarding ports are respectively configured in a second virtual local area network that is different from the first virtual local area network and independent of each other, and one layer 3 forwarding port is set as a specific forwarding port, and the non-specific forwarding port is connected to the upper network; The specific connection port and the specific forwarding port are physically connected.
2. The three-layer switch according to claim 1, characterized in that: Also includes: The data processing unit is used to perform layer 2 forwarding of data between a non-specific connection port and a specific connection port according to a locally stored MAC address forwarding table, and to perform routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to a locally stored routing table.
3. The three-layer switch according to claim 2, characterized in that: The IP address and MAC address of the specific forwarding port in the MAC address forwarding table are respectively the gateway IP address and the gateway MAC address; The port number corresponding to the gateway MAC address in the MAC address table is a specific connection port, so that the non-specific connection port in the first port group performs layer 2 forwarding to the specific connection port.
4. The three-layer switch according to claim 3, characterized in that: The entries of the MAC address forwarding table include MAC address, VLAN ID, and port number; The data processing unit specifically establishes a MAC address forwarding table in the following manner: Receive an ARP request packet broadcast by a terminal, wherein the ARP request packet carries the terminal's IP as a source IP address, the terminal's MAC as a source MAC address, and the gateway's IP as a destination IP; Learning the source MAC address in the ARP request data packet, determining the table entry corresponding to the terminal MAC address, and sending the ARP request data packet from the specific connection port; After receiving the ARP request packet through a specific forwarding port, an ARP reply packet is sent from the specific forwarding port, wherein the ARP reply packet carries the MAC of the gateway as the source MAC and the MAC of the terminal as the destination MAC; After receiving the ARP reply data packet through a specific connection port, learning the source MAC address in the ARP reply data packet to determine the table entry corresponding to the gateway MAC address; The MAC address is queried according to the destination MAC address in the ARP reply data packet to obtain the egress port, and the ARP reply data packet is sent from the determined egress port through the layer 2 ring network and finally reaches the terminal, so that the terminal uses the source MAC address in the ARP reply data packet as the MAC address of the gateway recorded locally.
5. The three-layer switch according to claim 2, characterized in that: The routing table includes static routing table entries whose destination IP is the remote server IP and direct routing table entries whose destination IP is the terminal IP; The data processing unit specifically establishes a direct connection routing table entry in the following manner: Receive an ARP request data packet from a terminal forwarded by a specific connection port through a specific forwarding port, wherein the ARP request data packet carries the IP of the terminal as a source IP address, the MAC of the terminal as a source MAC address, and the IP of the gateway as a destination IP; A new ARP table entry is constructed based on the source IP address and the source MAC address in the ARP request data packet, and a direct routing table entry is generated based on the new ARP table entry.
6. The three-layer switch according to any one of claims 2 to 5, characterized in that: The data processing unit is specifically used to receive an uplink IP data packet from a non-specific connection port, search for an entry corresponding to a gateway MAC address in a MAC address forwarding table according to a destination MAC address, obtain a corresponding egress port as the specific connection port, and forward the uplink IP data packet to the specific connection port; The data processing unit is specifically used to receive a downlink IP data packet from a specific forwarding port through a specific connection port, determine in a MAC address forwarding table that the egress port corresponding to the destination MAC address is a non-specific connection port, and forward the downlink IP data packet to the non-specific connection port; The uplink IP data packet carries the IP address of the terminal as the source IP address, the MAC address of the terminal as the source MAC address, the IP address of the remote server as the destination IP address, and the MAC address of the gateway as the destination MAC address, and the downlink IP data packet carries the MAC address of the terminal as the destination MAC address.
7. The three-layer switch according to any one of claims 2 to 5, characterized in that: The data processing unit is specifically used to obtain the destination IP address of the uplink IP data packet after receiving it through the specific forwarding port, search the local static routing table according to the obtained destination IP address, and modify the layer 2 header of the IP data packet according to the obtained outbound interface VLAN ID and next hop IP address, and then forward it to the corresponding non-specific forwarding port; The data processing unit is specifically used to, after receiving a downlink IP data packet through a non-specific forwarding port, search the locally stored direct routing table entries and ARP table entries according to the destination IP address therein to determine the MAC address and outbound interface VLAN ID corresponding to the destination IP address, and modify the destination MAC address and outbound interface VLAN ID of the downlink IP data packet, and then forward it to the specific forwarding port.
8. A three-layer network system, comprising a second-layer ring network, a terminal connected to a node of the ring network, and an upper-level network that is not in the same network segment as the terminal, characterized in that: The system further comprises: The three-layer switch according to at least one of claims 1 to 7, wherein: The three-layer switch accesses the two-layer ring network through two non-specific connection ports in the first port group, is connected to the upper-level network through the non-specific forwarding port in the second port group, performs two-layer forwarding of data between the non-specific connection port and the specific connection port according to the locally stored MAC address forwarding table, and performs routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the locally stored routing table.
9. A data transmission method, characterized in that: include: According to the locally stored MAC address forwarding table, perform layer 2 forwarding of data between the non-specific connection port and the specific connection port in the first port group; According to the locally stored routing table, data is routed and forwarded between the specific forwarding port and the non-specific forwarding port in the second port group, wherein the routing table includes a static routing table entry whose destination IP is the remote server IP and a direct routing table entry whose destination IP is the terminal IP; Create a direct route entry in the following way: Receive an ARP request data packet from a terminal forwarded by a specific connection port through a specific forwarding port, wherein the ARP request data packet carries the IP of the terminal as a source IP address, the MAC of the terminal as a source MAC address, and the IP of the gateway as a destination IP; A new ARP table entry is constructed based on the source IP address and the source MAC address in the ARP request data packet, and a direct routing table entry is generated based on the new ARP table entry.
10. The method according to claim 9, characterized in that The IP address and MAC address of the specific forwarding port in the MAC address forwarding table are respectively the gateway IP address and the gateway MAC address; The port number corresponding to the gateway MAC address in the MAC address table is a specific connection port, so that the non-specific connection port in the first port group performs layer 2 forwarding to the specific connection port.
11. The method according to claim 10, characterized in that The entries of the MAC address forwarding table include MAC address, VLAN ID, and port number; Create a MAC address forwarding table in the following ways: Receive an ARP request packet broadcast by a terminal, wherein the ARP request packet carries the terminal's IP as a source IP address, the terminal's MAC as a source MAC address, and the gateway's IP as a destination IP; Learning the source MAC address in the ARP request data packet, determining the table entry corresponding to the terminal MAC address, and sending the ARP request data packet from the specific connection port; After receiving the ARP request packet through a specific forwarding port, an ARP reply packet is sent from the specific forwarding port, wherein the ARP reply packet carries the MAC of the gateway as the source MAC and the MAC of the terminal as the destination MAC; After receiving the ARP reply data packet through a specific connection port, learning the source MAC address in the ARP reply data packet to determine the table entry corresponding to the gateway MAC address; The MAC address is queried according to the destination MAC address in the ARP reply data packet to obtain the egress port, and the ARP reply data packet is sent from the determined egress port through the layer 2 ring network and finally reaches the terminal, so that the terminal uses the source MAC address in the ARP reply data packet as the MAC address of the gateway recorded locally.
12. The method according to claim 9, characterized in that According to the locally stored MAC address forwarding table, data is forwarded at layer 2 between the non-specific connection port and the specific connection port in the first port group, including: Receive an uplink IP data packet from a non-specific connection port, search for an entry corresponding to a gateway MAC address in a MAC address forwarding table according to a destination MAC address, obtain a corresponding outbound port as the specific connection port, and forward the uplink IP data packet to the specific connection port; Receiving a downlink IP data packet from a specific forwarding port through a specific connection port, determining in a MAC address forwarding table that an outbound port corresponding to a destination MAC address is a non-specific connection port, and forwarding the downlink IP data packet to the non-specific connection port; The uplink IP data packet carries the IP address of the terminal as the source IP address, the MAC address of the terminal as the source MAC address, the IP address of the remote server as the destination IP address, and the MAC address of the gateway as the destination MAC address, and the downlink IP data packet carries the MAC address of the terminal as the destination MAC address.
13. The method according to claim 9, characterized in that The method includes performing routing forwarding of data between the specific forwarding port and the non-specific forwarding port according to the locally stored routing table, including: After receiving an uplink IP data packet through a specific forwarding port, obtain the destination IP address of the uplink IP data packet, search the local static routing table according to the obtained destination IP address, modify the layer 2 header of the IP data packet according to the obtained outbound interface VLAN ID and next hop IP address, and then forward it to the corresponding non-specific forwarding port; After receiving a downlink IP data packet through a non-specific forwarding port, the locally stored direct routing table entry and ARP table entry are searched according to the destination IP address therein to determine the MAC address and outbound interface VLAN ID corresponding to the destination IP address, and the destination MAC address and outbound interface VLAN ID of the downlink IP data packet are modified and then forwarded to the specific forwarding port.
14. A data transmission method, applied to the three-layer network system as claimed in claim 8, characterized in that: include: The terminal communicates data with a remote server located in the upper network through the second-layer ring network and the third-layer switch; The data communication includes: performing layer 2 forwarding of data between the non-specific connection port and the specific connection port of the layer 3 switch according to the local MAC address forwarding table according to the flow direction of the communication data; And data is routed and forwarded between the specific forwarding port and the non-specific forwarding port according to the routing table.
