Method, device and electronic device for extending network port based on source MAC address

Through the method based on the source MAC address, a virtual network port is created and the MAC address of the extended network port is configured, which solves the problems in the existing technology that the hub cannot achieve port isolation and the port expansion of the layer 2 switch is cumbersome, and realizes the expansion of the network port and the physical Port isolation is suitable for scenarios such as small FPGAs.

CN117640546BActive Publication Date: 2024-10-18BEIJING ZHONGKE TENGYUE TECH DEV CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311605109.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2024-10-18
Estimated Expiration
2043-11-28

AI Technical Summary

Technical Problem

In the existing technology, hubs cannot achieve port isolation. Layer 2 switches are powerful but the port expansion process is cumbersome and cannot effectively expand network ports.

Method used

Create a virtual network port by presetting the number of extended network ports, obtain the MAC address of the virtual network port based on the main network port speed and the number of virtual network ports, configure the MAC address of the extended network port, and implement network port expansion based on the source MAC address. Simplify physical port isolation.

Benefits of technology

It realizes the expansion of network ports and the isolation of physical ports. For example, the expansion of physical network ports is implemented on a small FPGA, which simplifies the port expansion process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117640546B_ABST
    Figure CN117640546B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device and electronic device for extending network ports based on source MAC addresses, including presetting the number of extended network ports, creating a virtual network port according to the rate of the main network port and the number of the preset extended network ports, obtaining the MAC address of the virtual network port, and configuring the MAC address of the extended network port according to the MAC address of the virtual network port. Through this method, the expansion of physical network ports and the isolation of physical ports can be easily realized on a small FPGA with a small design.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer network port expansion, and in particular to a method, device and electronic device for network port expansion based on source MAC address. Background Art

[0002] In the prior art, the hub concentrates all nodes on the node centered on it. It works at the first layer of the OSI (Open System Interconnection Reference Model) reference model, namely the "physical layer". Like the transmission media such as network cards and network cables, the hub is a basic device in the local area network and adopts the CSMA / CD (i.e., carrier sense multiple access technology with collision detection) media access control mechanism. The layer 2 switch works at the second layer (data link layer) of the OSI model, so it is called a layer 2 switch. The development of layer 2 switching technology has been relatively mature. The layer 2 switch belongs to the data link layer device, which can identify the MAC address information in the data frame, forward it according to the MAC address, and record these MAC addresses and corresponding ports in an internal address table. When it is necessary to expand the network port, the first-layer hub is a broadcast mode, and it is impossible to isolate the corresponding port. The layer 2 switch is too powerful, and the port expansion only uses a very small function. In addition, the port expansion configuration process of VLAN is cumbersome. Summary of the invention

[0003] In view of this, the present application proposes a method for extending a network port based on a source MAC address to solve the problems embodied in the above-mentioned background technology.

[0004] According to one aspect of the present application, a method for extending a network port based on a source MAC address is provided, including:

[0005] Preset the number of extended network ports;

[0006] Creating a virtual network port according to the rate of the main network port and the number of the preset extended network ports;

[0007] Get the MAC address of the virtual network port;

[0008] The MAC address of the extended network port is configured according to the MAC address of the virtual network port.

[0009] As an optional embodiment of the present application, optionally, it includes:

[0010] The number of the extended network ports is less than or equal to the number of the virtual network ports.

[0011] As an optional embodiment of the present application, optionally, it includes:

[0012] The rate of the main network port is greater than the sum of the rates of the extended network ports.

[0013] As an optional implementation scheme of the present application, optionally, obtaining the MAC address of the virtual network port includes:

[0014] The MAC address of the virtual network port is obtained from the preset memory through the preset instruction.

[0015] As an optional implementation scheme of the present application, optionally, configuring the extended network port MAC address of the extended network port according to the MAC address of the virtual network port includes:

[0016] The extended network port generates a corresponding extended network port source MAC address table according to the configured MAC address.

[0017] As an optional embodiment of the present application, optionally, it includes:

[0018] The extended network port is connected to the main network port through an extended network card.

[0019] As an optional embodiment of the present application, optionally, it includes:

[0020] The extended network card is configured to obtain a source MAC address extended network port mapping table corresponding to the extended network port.

[0021] As an optional embodiment of the present application, optionally, it includes:

[0022] When the extended network card receives a message, according to the source MAC address of the message, the extended network port corresponding to the source MAC address is confirmed through the source MAC address extended network port mapping table;

[0023] The message is sent to the corresponding extended network port.

[0024] According to the second aspect of the present application, a device for extending a network port based on a source MAC address is provided, comprising:

[0025] Get the number of extended network ports module, used to preset the number of extended network ports;

[0026] A virtual network port creation module is used to create a virtual network port according to the rate of the main network port and the number of the preset extended network ports;

[0027] Get MAC address module, used to get the MAC address of the virtual network port;

[0028] The extended network port configuration module is used to configure the MAC address of the extended network port according to the MAC address of the virtual network port.

[0029] According to the third aspect of the present application, an electronic device is proposed, comprising:

[0030] processor;

[0031] memory for storing processor-executable instructions and data;

[0032] Wherein, the processor is configured to implement the above-mentioned method for extending a network port based on a source MAC address when executing the executable instructions and data.

[0033] Beneficial effects of this application:

[0034] Through the present invention, the expansion of network ports can be achieved through a small design, for example, the expansion of physical network ports can be achieved on a small FPGA, and the isolation of physical ports can be simply achieved.

[0035] Other features and aspects of the present application will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present application and, together with the description, serve to explain the principles of the present application.

[0037] Figure 1 A flow chart of a method for extending a network port based on a source MAC address according to an embodiment of the present application is shown;

[0038] Figure 2 A diagram showing a connection between a host and an extended network card based on a source MAC address extended network port according to an embodiment of the present application is shown;

[0039] Figure 3 A block diagram of a device for extending a network port based on a source MAC address according to an embodiment of the present application is shown; DETAILED DESCRIPTION

[0040] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0041] Among them, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application or simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0042] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0043] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0044] In addition, in order to better illustrate the present application, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0045] The scheme of the present application is mainly used to implement the binding of physical ports using source MAC addresses, specifically to use the MAC address of the virtual network port to bind with the port connected to the physical device, so that the MAC address of the virtual network port and the physical port on the device have a corresponding binding relationship, and can be connected to the physical device for network communication, so as to achieve the purpose of interconnecting the physical devices corresponding to the expanded multiple network ports. The physically existing port refers to the network port that is actually expanded, which can be RJ45 (electrical port), SFP (optical port) or other ports that can be connected to devices with network ports. That is, the physical port is a port that can be connected to devices with network ports, and these devices include but are not limited to network hubs, layer 2 switches, layer 3 routers, etc. In the present application, the expansion of the network port is completed on the second layer (data link layer).

[0046] A network hub concentrates all nodes on a node centered on it. Network ports can also be expanded using a network hub, but the network hub uses a broadcast method and cannot isolate ports, so its usage is easily restricted.

[0047] The layer 2 switch works at the second layer (data link layer) of the OSI model, so it is called a layer 2 switch. The development of layer 2 switch technology is relatively mature and powerful. For the expansion of network ports, only some of its functions are needed. In this application, the layer 2 switch is replaced to complete the expansion of the main network port.

[0048] Example 1

[0049] In this embodiment, the main network port part in the layer 2 switch is retained, and then the source MAC address and the corresponding physical port are bound through VLAN technology.

[0050] Figure 1 The flowchart of the method for extending network ports based on source MAC addresses according to an embodiment of the present application is shown. When multiple network ports are required to allow multiple devices to access the network, the expansion of physical network ports can be achieved through this process. Figure 1 As shown, the flow chart includes:

[0051] S100, preset number of expansion network ports;

[0052] When the number of network ports is insufficient for the devices to use, determine the number of expansion network ports required based on the number of devices that need to be connected to the network.

[0053] S200, creating a virtual network port according to the rate of the main network port and the number of the preset extended network ports;

[0054] The rate of the main network port will affect the rate of the extended network port. Before creating a virtual network port, you need to consider the rate of the main network port and the number of extended network ports.

[0055] S300, obtaining the MAC address of the virtual network port;

[0056] Before assigning the MAC address of the virtual network port to the extended network port, you need to obtain the MAC address of the virtual network port.

[0057] S400: Configure the MAC address of the extended network port according to the MAC address of the virtual network port.

[0058] By assigning the MAC address of the virtual network port to the extended network port, the virtual network port and the extended network port correspond one to one.

[0059] As an optional embodiment of the present application, optionally, it includes:

[0060] The number of the extended network ports is less than or equal to the number of the virtual network ports.

[0061] In this embodiment, it is assumed that a layer 2 concentrator is needed to expand the network port. The layer 2 concentrator has a main network port, which is connected to the host. When the network port is expanded through the main network port, a virtual network port is created according to the number of expanded network ports. For example, when 6 network ports need to be expanded, 6 virtual network ports are created on the host.

[0062] In a possible embodiment, the number of extended network ports is less than the number of virtual network ports; according to the requirements of network communication services, when the number of extended network ports is less than the number of virtual network ports, multiple virtual network ports can correspond to the same physical extended network port.

[0063] As an optional embodiment of the present application, optionally, it includes:

[0064] The rate of the main network port is greater than the sum of the rates of the extended network ports.

[0065] The line rate of the main network port is greater than or equal to the sum of the rates of the expansion ports. Each expansion network port has a maximum rate (bandwidth). For example, if you want to expand 6 100Mbps 100M network ports, the rate of the main network port must be greater than 6*100Mbps. This ensures that if the 6 expansion network ports receive messages at the same time, they will not be discarded due to insufficient uplink rate (bandwidth) of the main network port. On the other hand, it ensures that the 6 expansion network ports can send messages at the same time, and they will not fail to reach the full rate due to insufficient downlink rate (bandwidth) of the main network port.

[0066] As an optional implementation scheme of the present application, optionally, obtaining the MAC address of the virtual network port includes:

[0067] The MAC address of the virtual network port is obtained from the preset memory through the preset instruction.

[0068] In this embodiment, after a virtual network port (MACVLAN) is created on the host, the MAC address configured by the virtual network card for each virtual network port is obtained through EEPROM (Electrically Erasable Programmable read only memory) for subsequent allocation to the extended network port.

[0069] As an optional implementation scheme of the present application, optionally, configuring the extended MAC address of the extended network port according to the MAC address of the virtual network port includes:

[0070] The extended network port generates a corresponding extended network port source MAC address table according to the configured MAC address.

[0071] In this embodiment, the device with an extended network port is assigned to the extended network port according to the MAC address of the virtual network port; for example, there are two virtual network port MAC addresses, AA:BB:CC:DD:EE:F0 and AA:BB:CC:DD:EE:F2. To assign the MAC address AA:BB:CC:DD:EE:F0 to extended network port 1 and the MAC address AA:BB:CC:DD:EE:F2 to extended network port 2, AA:BB:CC:DD:EE:F0 is written into the source MAC address table of extended network port 1, and AA:BB:CC:DD:EE:F2 is written into the source MAC address table of extended network port 2. After writing, the MAC address configuration of extended network port 1 and extended network port 2 is completed. For the extended network port, there is a source MAC address table including its own extended MAC address. With the operation of the network communication service, each extended network port can change its source MAC address table.

[0072] As an optional embodiment of the present application, optionally, it includes:

[0073] The extended network port is connected to the main network port through an extended network card.

[0074] In this embodiment, the extended network port is connected to the main network port through the extended network card, and the extended network card includes one or more extended network ports, and the extended network port is a physical port. When the extended network card is connected to the interface corresponding to the main network port, the main network port PHY interface (physical interface transceiver) only needs to comply with the 802.3 specification, that is, it can be various PHY interface standards, such as MII / RMII / GMII / RGMII / SGMII / QSGMII / 1000BASEX / 100BASEFX, etc.

[0075] As an optional embodiment of the present application, optionally, it includes:

[0076] The extended network card is configured to obtain a source MAC address extended network port mapping table corresponding to the extended network port.

[0077] In this embodiment, the extended network card is used to manage each extended network port; the MAC address of each virtual network port is matched with the corresponding physical extended network port and configured to the extended network card. For the extended network card, there is a source MAC address extended network port mapping table, and the correspondence between the virtual network port and the extended network port is determined by the source MAC address extended network port mapping table. For example: the MAC address of virtual network port 1 is bound to extended network port 1, the MAC address of virtual network port 2 is bound to extended network port 2, and so on.

[0078] When configuring an extended network card, the source MAC address-extended network port mapping table of the extended network card is obtained or changed by configuring the interface of the extended network card (I2C, SPI, MDIO or other bus interface).

[0079] As an optional embodiment of the present application, optionally, it includes:

[0080] When the extended network card receives a message, according to the source MAC address of the message, the extended network port corresponding to the source MAC address is confirmed through the source MAC address extended network port mapping table;

[0081] The message is sent to the corresponding extended network port.

[0082] In this embodiment, the above example assigns the MAC address AA:BB:CC:DD:EE:F0 to the extended network port 1, and the MAC address AA:BB:CC:DD:EE:F2 to the extended network port 2; when the extended network card receives the message sent down, it will find out that it is bound to the extended network port 1 according to the message with the source MAC address AA:BB:CC:DD:EE:F0 in the message sent down, and the extended network card will send the message to the extended network port 1. After the extended network port 1 receives the message, it will convert the message according to the destination source MAC address to be forwarded in the next step in the message, and send it to the corresponding device. Similarly, if the source MAC address is AA:BB:CC:DD:EE:F2, it will be found to be bound to the extended network port 2 and sent out from the extended network port 2. If the binding relationship between the source MAC address and the extended network port is not found, but the destination MAC address is a broadcast address (FF:FF:FF:FF:FF:FF), it will also be sent out from each extended network port. Otherwise, it will usually be discarded. This is related to the configuration of the extended network port and is configured according to user needs. It is not limited here.

[0083] Similarly, when the extended network card receives a message sent by the extended network port, it determines the virtual network port corresponding to the source MAC address based on the source MAC address in the message, sends the message to the corresponding virtual network port, and then processes the message at the virtual network port.

[0084] In a possible embodiment, a processor with a network processor (network card or network port), a small FPGA and an extended PHY device are connected as follows: Figure 2 shown.

[0085] If a host (processor) has only one main network port, but needs to implement 6 isolated physical network ports, then the 6 extended network ports can be easily implemented through a small FPGA expansion network card. Figure 2 In the example, the host is the processor (CPU), and the expansion network card is a combination of FPGA and multiple PHYs.

[0086] The PHY interface of the main network port can be various, including MII (Media Independent Interface), GMII (Gigabit Media Independant Interface), RMII (Reduced Media Independant Interface), etc.

[0087] The main processor and FPGA control interface can be SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit, a synchronous, half-duplex communication bus) or other buses.

[0088] The expansion PHY device and FPGA interface can be various, such as MII, GMII, RMII, etc.

[0089] Taking the implementation of 6 isolated physical expansion network ports as an example, 6 virtual network ports are set in the host, and the MAC addresses of the 6 virtual network ports are obtained from the EEPROM.

[0090] After obtaining the MAC addresses of the six virtual network ports, set the MAC addresses of the six extended network ports, and configure the extended network card to bind the physical extended network port corresponding to the MAC address of the virtual network port.

[0091] After the configuration is completed, use the network communication service through the wire connections of each device interface to perform normal network operations on the 6 virtual network ports and extended network ports.

[0092] Through the above introduction, the network port expansion is realized with the smallest design. This method can easily realize the expansion of physical network ports on a small FPGA and simply realize the isolation of physical ports.

[0093] Example 2

[0094] Based on the same principle as the above method, a device for extending the network port based on the source MAC address is also proposed, see Figure 2 , a device 100 for extending a network port based on a source MAC address according to an embodiment of the present disclosure includes:

[0095] The module 110 for obtaining the number of extended network ports is used to preset the number of extended network ports;

[0096] A virtual network port creation module 120 is used to create a virtual network port according to the rate of the main network port and the number of the preset extended network ports;

[0097] A MAC address acquisition module 130 is used to acquire the MAC address of the virtual network port;

[0098] The extended network port configuration module 140 is used to configure the MAC address of the extended network port according to the MAC address of the virtual network port.

[0099] Obviously, those skilled in the art should understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned control methods. The modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by computing devices, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.

[0100] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned control methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated as: HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0101] Example 3

[0102] Furthermore, an electronic device is proposed, comprising:

[0103] processor;

[0104] memory for storing processor-executable instructions and data;

[0105] Wherein, the processor is configured to implement a method for extending a network port based on a source MAC address as described in Example 1 when executing the executable instructions and data.

[0106] The electronic device of the embodiment of the present disclosure includes a processor and a memory for storing processor executable instructions and data, wherein the processor is configured to implement any of the above-mentioned methods for extending a network port based on a source MAC address when executing the executable instructions and data.

[0107] It should be noted that the number of processors may be one or more. At the same time, the electronic device of the embodiment of the present disclosure may also include an input device and an output device. The processor, memory, input device, and output device may be connected via a bus or in other ways, which are not specifically limited here.

[0108] The memory, as a computer-readable storage medium for a method for extending a network port based on a source MAC address, can be used to store software programs, computer executable programs, and various modules, such as: a program or module corresponding to a method for extending a network port based on a source MAC address in an embodiment of the present disclosure. The processor executes various functional applications and data processing of the electronic device by running the software programs or modules stored in the memory.

[0109] The input device can be used to receive input numbers or signals. The signal can be a key signal related to user settings and function control of the device / terminal / server. The output device can include a display device such as a display screen.

[0110] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for extending a network port based on a source MAC address, characterized in that: include: The number of preset extended network ports; wherein the extended network ports are physical ports; Creating a virtual network port according to the rate of the main network port and the number of the preset extended network ports; The extended network port is communicatively connected to the main network port via an extended network card; Get the MAC address of the virtual network port; Configure the MAC address of the extended network port according to the MAC address of the virtual network port; Configuring the MAC address of the extended network port according to the MAC address of the virtual network port includes: The extended network port generates a corresponding extended network port source MAC address table according to the configured MAC address; When the extended network card receives a message, the extended network port corresponding to the source MAC address is confirmed through the source MAC address extended network port mapping table according to the source MAC address of the message; The number of the extended network ports is less than or equal to the number of the virtual network ports; When the number of the extended network ports is less than the number of the virtual network ports, multiple virtual network ports correspond to the same extended network port.

2. A method for extending a network port based on a source MAC address as claimed in claim 1, characterized in that: include: The rate of the main network port is greater than the sum of the rates of the extended network ports.

3. A method for extending a network port based on a source MAC address as claimed in claim 1, characterized in that: Get the MAC address of the virtual network port, including: The MAC address of the virtual network port is obtained from the preset memory through the preset instruction.

4. A method for extending a network port based on a source MAC address as claimed in claim 1, characterized in that: include: The extended network card is configured to obtain a source MAC address extended network port mapping table corresponding to the extended network port.

5. A method for extending a network port based on a source MAC address as claimed in claim 4, characterized in that: include: The message is sent to the corresponding extended network port.

6. A device for extending a network port based on a source MAC address, characterized in that: Includes the following modules: A module for obtaining the number of extended network ports is used to preset the number of extended network ports; wherein the extended network ports are physical ports; A virtual network port creation module is used to create a virtual network port according to the rate of the main network port and the number of the preset extended network ports; A MAC address acquisition module is used for the extended network port to communicate with the main network port through the extended network card to acquire the MAC address of the virtual network port; The extended network port module is configured to configure the MAC address of the extended network port according to the MAC address of the virtual network port, and the MAC address of the extended network port is configured according to the MAC address of the virtual network port, including: the extended network port generates a corresponding extended network port source MAC address table according to the configured MAC address; when the extended network card receives a message, according to the source MAC address of the message, the extended network port corresponding to the source MAC address is confirmed through the source MAC address extended network port mapping table; the number of the extended network ports is less than or equal to the number of the virtual network ports; when the number of the extended network ports is less than the number of the virtual network ports, multiple virtual network ports correspond to the same extended network port.

7. An electronic device, characterized in that: include processor; memory for storing processor-executable instructions and data; Wherein, the processor is configured to implement a method for extending a network port based on a source MAC address as described in any one of claims 1 to 5 when executing the executable instructions and data.

Citation Information

Patent Citations

  • Network port extension and message rapid equalization processing method

    CN115412502A