CN115277630B - Method, device and equipment for renaming network adapter interface - Google Patents

Method, device and equipment for renaming network adapter interface Download PDF

Info

Publication number
CN115277630B
CN115277630B CN202210968974.3A CN202210968974A CN115277630B CN 115277630 B CN115277630 B CN 115277630B CN 202210968974 A CN202210968974 A CN 202210968974A CN 115277630 B CN115277630 B CN 115277630B
Authority
CN
China
Prior art keywords
interface
network
slot
network adapter
interfaces
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210968974.3A
Other languages
Chinese (zh)
Other versions
CN115277630A (en
Inventor
刘芳宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Neusoft Corp
Original Assignee
Neusoft Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Neusoft Corp filed Critical Neusoft Corp
Priority to CN202210968974.3A priority Critical patent/CN115277630B/en
Publication of CN115277630A publication Critical patent/CN115277630A/en
Application granted granted Critical
Publication of CN115277630B publication Critical patent/CN115277630B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The application discloses a method, a device and equipment for renaming network adapter interfaces, which acquire slot position information of a network adapter card slot of network equipment and interface sequences of at least two network interfaces corresponding to the slot position information. Further, a standard naming of each of the at least two network interfaces is determined based on the slot information and the interface order. And then, acquiring interface identification information of at least two network interfaces, and changing original names corresponding to the interface identification information of the target network interfaces into standard names of the target network interfaces, wherein the target network interfaces are respectively used for each network interface. Therefore, the application provides a more standard renaming mode of the network interface, namely, the new standard naming of each network interface corresponding to the slot position information is determined according to the slot position information of the network adapter card slot and the interface sequence of at least two network interfaces corresponding to the slot position information, thereby improving the renaming efficiency of the network interface and being convenient for the use of the network interface.

Description

Method, device and equipment for renaming network adapter interface
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a device for renaming a network adapter interface.
Background
Network devices such as firewalls, switches, and intrusion detection systems typically require a large number of network adapter interfaces (abbreviated network interfaces) to meet the many-sided demands of the network devices in terms of performance and functionality. When more network interfaces are used in the same network device, renaming is required for each network interface used, so as to distinguish different network interfaces.
At present, each network interface of the same network device is renamed in a manual mode, and the mode has the problems of low efficiency and high randomness, so that the subsequent use of the network interface is inconvenient.
Disclosure of Invention
In view of this, the embodiments of the present application provide a method, apparatus and device for renaming a network adapter interface, which provides a network interface renaming manner with high efficiency and more specifications, so as to facilitate the use of a network interface.
In order to solve the above problems, the technical solution provided by the embodiment of the present application is as follows:
a method of network adapter interface renaming, the method comprising:
Acquiring slot position information of a network adapter card slot of the network equipment;
acquiring interface sequences of at least two network interfaces corresponding to the slot position information;
determining standard naming corresponding to each network interface in the at least two network interfaces according to the slot information and the interface sequence;
Acquiring interface identification information of the at least two network interfaces;
And changing the original name corresponding to the interface identification information of the target network interface into the standard name of the target network interface, wherein the target network interface is respectively used for each of the at least two network interfaces.
In one possible implementation manner, the obtaining slot information of the network adapter card slot of the network device includes:
Acquiring device identifiers corresponding to each bus address of the network device;
Identifying the equipment identifier of the network adapter from the equipment identifiers, and acquiring a bus address corresponding to the equipment identifier of the network adapter;
And determining the bus address corresponding to the equipment identifier of the network adapter as slot position information of a network adapter card slot of the network equipment.
In one possible implementation manner, the obtaining the interface sequence of the at least two network interfaces corresponding to the slot information includes:
Acquiring an interface linear relation mapping function of the network adapter corresponding to the slot position information; the interface linear relation mapping function characterizes the corresponding relation between the interface sequence of the network adapter corresponding to the slot position information in the network equipment and the interface sequence of the actual physical interface; the interface linear relation mapping function is predetermined according to the model of the network adapter;
and determining the interface sequence of the actual physical interface of the network adapter as the interface sequence of at least two network interfaces corresponding to the slot position information through the interface linear relation mapping function.
In one possible implementation manner, the obtaining interface identification information of the at least two network interfaces includes:
And acquiring interface identification information of the at least two network interfaces from the file catalogue corresponding to the slot position information.
In one possible implementation, the method further includes:
And obtaining a type identifier corresponding to the equipment identifier of the network adapter, and determining that the network adapter belongs to an on-board network adapter or an extended network adapter according to the type identifier.
In one possible implementation manner, the changing the original naming corresponding to the interface identification information of the target network interface to the standard naming of the target network interface includes:
When the network equipment uses a Linux operating system, acquiring an original name corresponding to interface identification information of a target network interface;
Closing the target network interface;
Responding to a renaming request, changing an original name corresponding to the interface identification information of the target network interface into a standard name of the target network interface, wherein the renaming request comprises the original name corresponding to the interface identification information of the target network interface and the standard name of the target network interface;
and opening the target network interface.
In one possible implementation manner, the changing the original naming corresponding to the interface identification information of the target network interface to the standard naming of the target network interface includes:
When the network device uses Dpdk user mode, responding to renaming request triggered by inter-process communication, changing original naming corresponding to interface identification information of the target network interface into standard naming of the target network interface, wherein the renaming request comprises the interface identification information of the target network interface and the standard naming of the target network interface.
An apparatus for renaming a network adapter interface, the apparatus comprising:
the first acquisition unit is used for acquiring slot position information of a network adapter card slot of the network equipment;
the second acquisition unit is used for acquiring the interface sequence of at least two network interfaces corresponding to the slot position information;
the determining unit is used for determining standard naming corresponding to each network interface in the at least two network interfaces according to the slot position information and the interface sequence;
A third obtaining unit, configured to obtain interface identification information of the at least two network interfaces;
and the changing unit is used for changing the original name corresponding to the interface identification information of the target network interface into the standard name of the target network interface, wherein the target network interface is respectively used for each of the at least two network interfaces.
An electronic device, comprising: the network adapter interface renaming method comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the network adapter interface renaming method when executing the computer program.
A computer readable storage medium having instructions stored therein which, when executed on a terminal device, cause the terminal device to perform a method of network adapter interface renaming as described above.
From this, the embodiment of the application has the following beneficial effects:
The embodiment of the application provides a method, a device and equipment for renaming a network adapter interface, which are used for acquiring slot position information of a network adapter card slot of network equipment and interface sequences of at least two network interfaces corresponding to the slot position information. Further, a standard naming of each of the at least two network interfaces is determined based on the slot information and the interface order. And then, acquiring interface identification information of at least two network interfaces, and changing original names corresponding to the interface identification information of the target network interfaces into standard names of the target network interfaces, wherein the target network interfaces are respectively used for each network interface. In this way, the embodiment of the application provides a more standard renaming mode of the network interface, namely, the new standard naming of each network interface corresponding to the slot position information is determined according to the slot position information of the network adapter card slot and the interface sequence of at least two network interfaces corresponding to the slot position information, thereby improving the renaming efficiency of the network interface and being convenient for the use of the network interface.
Drawings
Fig. 1 is a schematic diagram of an exemplary application scenario provided in an embodiment of the present application;
fig. 2 is a flowchart of a method for renaming a network adapter interface according to an embodiment of the present application;
FIG. 3 is a flowchart of another method for renaming a network adapter interface according to an embodiment of the application;
fig. 4 is a schematic structural diagram of a device for renaming a network adapter interface according to an embodiment of the present application.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will become more readily apparent, a more particular description of embodiments of the application will be rendered by reference to the appended drawings and appended drawings.
In order to facilitate understanding and explanation of the technical solution provided by the embodiments of the present application, the background technology related to the embodiments of the present application is first described.
Network devices such as firewalls, switches, and intrusion detection systems typically require a large number of network adapter interfaces (abbreviated network interfaces) to meet the many-sided demands of the network devices in terms of performance and functionality. When more network interfaces are used in the same network device, renaming is required for each network interface used to distinguish between different network interfaces.
At present, each network interface of the same network device is renamed in a manual mode, and the mode has the problems of low efficiency and high randomness, so that the subsequent use of the network interface is inconvenient. In addition, the manner of manual renaming may also cause a conflict between the naming of the network interface and the naming of other types of interfaces of the network device, or may cause a situation in which the naming of the network interface is inconsistent with the interface order of the actual physical interfaces of the network adapter.
Based on this, the embodiment of the application provides a method, a device and equipment for renaming a network adapter interface, which firstly acquire slot information of a network adapter card slot of a network device and interface sequences of at least two network interfaces corresponding to the slot information. Further, a standard naming of each of the at least two network interfaces is determined based on the slot information and the interface order. And then, acquiring interface identification information of at least two network interfaces, and changing original names corresponding to the interface identification information of the target network interfaces into standard names of the target network interfaces, wherein the target network interfaces are respectively used for each network interface. In this way, the embodiment of the application provides a more standard renaming mode of the network interface, namely, the new standard naming of each network interface corresponding to the slot position information is determined according to the slot position information of the network adapter card slot and the interface sequence of at least two network interfaces corresponding to the slot position information, thereby improving the renaming efficiency of the network interface and being convenient for the use of the network interface.
In addition, in the embodiment of the application, the interface renaming is performed according to the slot position information and the interface sequence of at least two network interfaces corresponding to the slot position information, so that the new standard naming of each network interface is related to the card slot corresponding to the network interface. The card slots corresponding to the network adapter interfaces are different from the card slots corresponding to other interfaces of the network equipment, so that the situation that conflicts exist between the naming of the network adapter interfaces and the naming of other interfaces of the network equipment can be reduced. When the embodiment of the application renames the interfaces, the interface sequence of the network interfaces is considered, so that the condition that the naming of the network adapter interfaces is inconsistent with the interface sequence of the actual physical interfaces of the network adapter can be reduced.
In order to facilitate understanding of the method for renaming a network adapter interface provided in the embodiment of the present application, the following description is provided with reference to a scenario example shown in fig. 1. Referring to fig. 1, the diagram is a schematic diagram of an exemplary application scenario provided in an embodiment of the present application.
In practical applications, hardware information, i.e. network device information, is obtained. And further, acquiring slot position information of a network adapter card slot of the network equipment, interface sequences of at least two network interfaces corresponding to the slot position information and interface identification information of at least two network interfaces corresponding to the slot position information according to the network equipment information. The network equipment is a firewall, a switch, an intrusion detection system and the like. The network equipment is provided with a network adapter clamping groove which is used for being connected with the network adapter. The network adapters are provided with network interfaces, and the number of the network interfaces of each network adapter is at least two.
Further, the standard naming of the network interfaces is determined according to the slot information and the interface sequence. Based on the information, changing the original name corresponding to the interface identification information of the target network interface into the standard name of the target network interface to achieve the renaming of the interface, wherein the target network interface is respectively used for each network interface.
Those skilled in the art will appreciate that the frame diagram shown in fig. 1 is but one example in which embodiments of the present application may be implemented. The scope of applicability of the embodiments of the application is not limited in any way by the framework.
In order to facilitate understanding of the present application, a method for renaming a network adapter interface according to an embodiment of the present application is described below with reference to the accompanying drawings.
Referring to fig. 2, the flowchart of a method for renaming a network adapter interface according to an embodiment of the present application is shown in fig. 2, where the method may include S201-S205:
S201: and obtaining slot position information of a network adapter card slot of the network equipment.
Network devices and components are physical entities connected to a network, and there are many kinds of network devices, such as firewalls, switches, intrusion detection systems, and the like. The network adapter, i.e., a network card, generally includes an on-board network adapter (on-board card) and an extension network adapter (extension card) according to the installation manner of the network card on the network device. The board-mounted card is a network card embedded in the network equipment, and the expansion card is a pluggable network card. For firewalls, switches, and intrusion detection systems, network interfaces are in great demand, so a combination of on-board and expansion cards is often used. Typically, a network adapter is provided with a plurality of metal contact pads on one side and a network interface on the other side.
The network equipment is provided with a network adapter clamping groove, and the network adapter is inserted into the network adapter clamping groove, so that the network equipment is connected with the network equipment through the metal contact piece on the network adapter. The network interface on the network adapter is used to connect to a network, such as a LAN network. Thus, the network card acts as a connection intermediary to enable the network device to communicate with an external network. The on-board network adapter is fixedly connected with a network adapter clamping groove in the network equipment, and the expansion network adapter can be inserted into the network adapter clamping groove or pulled out from the network adapter clamping groove.
Alternatively, a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus may be used as a local bus for network devices, primarily for the purpose of connecting external devices. The PCI bus has an independent address space, i.e., a PCI bus address space (PCI address or bus address for short). The network device may assign an independent PCI address to each network adapter card slot.
As an alternative example, the slot information of the network adapter card slot is the PCI address of the network adapter card slot. When a certain network adapter card slot is connected with a network adapter, the slot position information of the network adapter card slot can be acquired, and when the certain network adapter card slot is not connected with the network adapter, the slot position information of the network adapter card slot cannot be acquired. That is, in the embodiment of the present application, the slot information of each network adapter card slot of the network device is obtained, and the obtained slot information is the slot information of the network adapter card slot connected with the network adapter. There may be multiple network adapter card slots of one network device, and the acquired slot position information of the network adapter card slots may also be multiple.
In the embodiment of the application, the slot information of the network adapter card slot can be represented by slot_index, the slot represents the slot, the index represents the sequence number, and the whole slot_index represents the slot information. The slot position information of the network adapter card slot can also obtain the slot position number of the network adapter card slot, for example, the slot position number of the on-board card slot is represented by 0, and the slot position number of the expansion card slot is represented by other numbers. The corresponding relation between the slot information and the slot number of each type of network equipment is pre-bound, for example, PCI address 1 and PCI address 2 are bound with slot number 0, PCI address 3 is bound with slot number 1, PCI address 4 is bound with slot number 2, namely, PCI address 1 and PCI address 2 correspond to the card slot of the board, PCI address 3 corresponds to expansion card slot 1, and PCI address 4 corresponds to expansion card slot 2.
In one possible implementation manner, the embodiment of the present application provides a specific implementation manner for obtaining slot information of a network adapter card slot of a network device in S201, specifically please see A1-A3 below.
S202: and acquiring the interface sequence of at least two network interfaces corresponding to the slot position information.
The number of network interfaces corresponding to the slot information is usually a plurality of, and can be determined according to actual situations. For example, the number of network interfaces in an expansion network adapter (expansion card) is typically 2,4, or 8, i.e., a 2-port expansion card, a 4-port expansion card, or an 8-port expansion card. The number of network interfaces in an on-board network adapter (on-board card) is also typically 2,4, 6, 8 or 10. In practical applications, the number of network interfaces of the network adapter is generally even. In addition, the number of the network adapter card slots can be 1,2, 4 or 8.
In order to rename at least two network interfaces corresponding to the slot information, an interface sequence of at least two network interfaces corresponding to the slot information needs to be obtained.
According to the wiring standard, each network interface in the network adapter has a corresponding interface serial number. Each network interface has a corresponding interface serial number, and because the number of the network interfaces is a plurality of, the number of the interfaces is a plurality of. The plurality of interface serial numbers may form an interface sequence of the plurality of network interfaces corresponding to the slot information. The interface sequence of the plurality of network interfaces corresponding to the slot information is used to represent the sequence of the plurality of network interfaces, and the interface sequence number corresponding to each network interface is used to represent the ranking of the network interface in the plurality of network interfaces. The interface order of the plurality of network interfaces may be exemplarily understood as a network interface linear relationship.
In the embodiment of the application, the interface serial number of a network interface in the interface sequence can be represented by port_index, the port represents the interface, the index represents the serial number, and the port_index integrally represents the interface serial number in the interface sequence. For example, when the interface number of one network interface is 1, the network interface may be denoted as network interface 1.
And obtaining the interface sequence of at least two network interfaces corresponding to the slot information, wherein the corresponding relation between the interface sequence of the network adapter corresponding to the slot information in the network equipment and the interface sequence of the actual physical interface is required to be referred to.
The interface sequence of the network adapter corresponding to the slot information in the network device may be understood as the arrangement sequence of the network interfaces of the network adapter corresponding to the slot information in the operating system of the network device. For example, the network adapter A has 4 network interfaces, which are arranged in the operating system of the network device in the order of 1-2-3-4.
The interface order of the actual physical interfaces is the order of arrangement of the individual network interfaces of the network adapter on the physical host of the network device. For example, the 4 network interfaces of network adapter A are arranged in the order of 2-1-4-3 on the physical host. I.e. the network interface ordered 1 in the operating system of the network device is the 2 nd network interface on the physical host, and the network interface ordered 2 in the operating system of the network device is the 1 st network interface on the physical host.
At this time, the interface sequence of at least two network interfaces corresponding to the slot information may be determined according to the interface sequence of the actual physical interface.
In one possible implementation manner, the embodiment of the present application provides a specific implementation manner of the interface sequence of the network interface corresponding to the slot position information, and specific please refer to B1-B2 below.
S203: and determining the standard naming corresponding to each network interface in at least two network interfaces according to the slot position information and the interface sequence.
After the slot information and the interface order of at least two network interfaces corresponding to the slot information are obtained, standard naming of the network interfaces may be determined. In the implementation, the slot number can be determined according to the slot information, and the interface serial number of each network interface can be determined according to the interface sequence of at least two network interfaces corresponding to the slot information. Further, the standard naming of the network interface is determined by the slot number and the interface serial number corresponding to the network interface.
In practical applications, the corresponding interface naming may be determined according to the type of the network adapter. Based on this, as an optional example, when the network adapter is an on-board adapter, the interface naming of the network interface in the on-board adapter is determined according to the interface serial number corresponding to the network interface in the on-board adapter. For example, ethx is used, where "x" is the interface number, such as eth0, eth1, eth2, etc.
As another alternative example, when the network adapter is an extended network adapter, the interface naming of the network interface is determined by the slot number and the interface serial number corresponding to the network interface. For example, using the nomenclature of eth-szpx, where "s" represents the slot number designation, "z" is the specific slot number, "p" is the interface number designation, "x" is the specific interface number, such as eth-s1p1, eth-s1p2, eth-s1p3, and eth-s1p4. Taking eth-s1p1 as an example, this represents the network interface 1 in the expansion card slot 1.
It can be known that, because the card slot corresponding to the network adapter interface is different from the card slots corresponding to other interfaces of the network device, the standard naming of the network interface in the embodiment of the application can be bound with the slot number of the card slot corresponding to the network adapter. In this way, the situation that there is a conflict between the naming of the network adapter interface and the naming of the other interfaces of the network device can be reduced. Further, since the interface order of the network interfaces is considered when the interface renaming is performed, it is possible to reduce the case where the naming of the network adapter interfaces does not coincide with the interface order of the actual physical interfaces of the network adapter.
Meanwhile, based on the above, when a new expansion network adapter is connected with the network device, only the network card type of the new expansion network adapter, the slot position information of the network adapter slot corresponding to the new expansion network adapter, and the interface sequence of the network interfaces in the new expansion network adapter need to be determined, so that the new naming of each network interface in the new expansion network adapter can be determined, and the renaming of the network interfaces can be realized. Thus, when a new extended network adapter is connected to the network device, the expandability of the renaming of the network interface can be improved.
S204: interface identification information of at least two network interfaces is obtained.
Each network interface in the network adapter connected to the network adapter card slot corresponds to its own interface identification information.
As an alternative example, the interface identification information is a PCI address of network interfaces, each of which is bound with a pre-assigned PCI address. In an embodiment of the application, the interface identification information of the network interface may be represented by [ < bus > ] [ < slot > ] [ < func > ]. bus, slot, func is a PCI address identifier, where bus represents a bus number, slot represents a device number, and func represents a function block order. The interface identification information through the network interface can uniquely identify a physical network interface. For example, interface identification information of 4 network interfaces in a network adapter connected to a network adapter card slot is 02:00.0, 02:00.1, 02:00.2, and 02:00.3, respectively. In one possible implementation manner, the embodiment of the present application provides a specific implementation manner of acquiring interface identification information of a network interface corresponding to slot position information, which is specifically described below.
S205: and changing the original name corresponding to the interface identification information of the target network interface into the standard name of the target network interface. Wherein the target network interface is each of the at least two network interfaces.
After the standard naming of the target network interface is obtained, changing the original naming corresponding to the interface identification information of the target network interface into the standard naming of the target network interface. And the standard name corresponding to the interface identification information of the target network interface is the new name of the target network interface.
The contents of S201-S202, S204 can be understood that the slot information of the network adapter slot, the interface identification information of at least two network interfaces corresponding to the slot information and the interface sequence are obtained, and then [ < slot_index > ] [ < port_index > ] [ < bus > ] [ < slot > ] [ < func > ]. The [ < slot > ] [ < port_index > ] [ < bus > ] [ < slot > ] [ < func > ] may be described as a network interface relationship five-tuple.
It can be known that after the [ < slot_index > ] < port_index > ] in the network interface relation five-tuple is determined, each network interface corresponding to the slot information can be uniquely determined. Interface identification information [ < bus > ] [ < slot > ] [ < func > ] of each network interface corresponding to the same slot information can also be determined.
For example, determining the slot information to be 00:01.0 is an extended network adapter card slot 1, the corresponding extended network adapter has 4 network interfaces, and the acquired 4 interfaces of the network interfaces are in the order of 2-1-4-3. The standard designations for these 4 interface sequences are eth-s1p2, eth-s1p1, eth-s1p4, and eth-s1p3.
Then, it can be determined that the interface identification information corresponding to the 4 network interfaces is 02:00.0, 02:00.1, 02:00.2 and 02:00.3, respectively, and then the network interface corresponding to 02:00.0 is named as eth-s1p2, the network interface corresponding to 02:00.1 is named as eth-s1p1, the network interface corresponding to 02:00.2 is named as eth-s1p4, and the network interface corresponding to 02:00.3 is named as eth-s1p3.
In some possible implementations, the embodiments of the present application provide two specific implementations of changing the original naming corresponding to the interface identification information of the target network interface to the standard naming of the target network interface, specifically please see below.
Based on the above-mentioned content of S201-S205, the embodiment of the present application provides a method for renaming a network adapter interface, which includes obtaining slot information of a network adapter card slot of a network device and an interface sequence of at least two network interfaces corresponding to the slot information. Further, a standard naming of each of the at least two network interfaces is determined based on the slot information and the interface order. And then, acquiring interface identification information of at least two network interfaces, and changing original names corresponding to the interface identification information of the target network interfaces into standard names of the target network interfaces, wherein the target network interfaces are respectively used for each network interface. In this way, the embodiment of the application provides a more standard renaming mode of the network interface, namely, the new standard naming of each network interface corresponding to the slot position information is determined according to the slot position information of the network adapter card slot and the interface sequence of at least two network interfaces corresponding to the slot position information, thereby improving the renaming efficiency of the network interface and being convenient for the use of the network interface.
In a possible implementation manner, the embodiment of the present application provides a specific implementation manner for obtaining slot information of a network adapter card slot of a network device in S201, including:
a1: and acquiring the device identification corresponding to each bus address of the network device.
The network device may connect to some other device, assign a bus address to each device, and record the device identification of each device. The device identification of each of the network devices corresponds to the bus address of the device. A device identification may correspond to one or more bus addresses.
In this step, the device identifier corresponding to each bus address of the network device is acquired first. In the embodiment of the application, the bus address is a PCI address.
It will be appreciated that when the device identifier is available, it indicates that the device to which the device identifier belongs is connected in the network device.
A2: and identifying the equipment identifier of the network adapter from the equipment identifiers, and acquiring the bus address corresponding to the equipment identifier of the network adapter.
The network adapter is one of the devices to which the network device is connected. After the device identifiers corresponding to the bus addresses are acquired, the device identifier of the network adapter is identified from the device identifiers. Further, a bus address corresponding to the device identifier of the network adapter is acquired. For example, the device identifier that identifies the network adapter is 8088, and the bus address corresponding to the device identifier 8088 is acquired.
In practical application, as an alternative example, the PCI bus structure may be obtained through lspci-tv commands in the network device, and the bus address corresponding to the device identifier of the network adapter may be obtained. The expression form of the command is usually the form of command name+space+parameter, that is lspci is command name, -tv is parameter, and the command name and parameter are separated by space.
A3: and determining the bus address corresponding to the equipment identifier of the network adapter as slot position information of a network adapter card slot of the network equipment.
After the bus address corresponding to the device identifier of the network adapter is obtained, the bus address corresponding to the device identifier of the network adapter is determined to be the slot information of the network adapter slot of the network device, namely slot_index information in the network interface relation five-tuple. This facilitates the subsequent correspondence of the interface identification information of each network interface with the slot information of the card slot to which the network interface corresponds.
Based on the content of A1-A3, a specific implementation manner of determining slot information of a network adapter card slot of a network device is provided, namely, firstly, acquiring a device identifier of the network adapter, further acquiring a bus address corresponding to the device identifier of the network adapter, and determining the bus address as the slot information of the network adapter card slot of the network device.
Based on A1-A3, in a possible implementation manner, a type identifier corresponding to the device identifier of the network adapter may also be obtained, and it is determined that the network adapter belongs to an on-board network adapter or an extended network adapter according to the type identifier.
The network adapter comprises an on-board network adapter and an extension network adapter, and the on-board network adapter and the extension network adapter respectively correspond to respective type identifiers. For example, the type identifier corresponding to the on-board network adapter is 0101 or 0104, and the type identifier corresponding to the extension network adapter is 0103. After determining the type of the network adapter, the determination of the slot number of the network adapter card slot in the above embodiment can be facilitated.
Based on this, it may be determined that the network adapter belongs to an on-board network adapter or an extended network adapter according to the type identification. For example, when the type identifier 0104 is acquired, it is known that the network adapter belongs to the on-board network adapter.
In addition, the bus address corresponding to the device identifier of the network adapter can be determined to belong to the bus address of the on-board network adapter or the bus address of the extended network adapter according to the device identifier of the network adapter. For example, when the bus address corresponding to the type identifier 0104 is 00:05.0, it may be determined that the bus address is the bus address of the on-board network adapter; when the bus address corresponding to the type identifier 0101 is 00:03.0, determining that the bus address is the bus address of the on-board network adapter; when the bus address corresponding to the type identifier 0103 is 00:01.0, the bus address can be determined to be the bus address of the extended network adapter.
In practical application, due to the bus layout and the arrangement of the optical port and the electrical port, the interface sequence of the network adapter corresponding to the slot information in the network device may not be the same as the interface sequence of the actual physical interface, so that the interface sequence of the network adapter corresponding to the slot information in the network device needs to be corrected.
Based on this, in a possible implementation manner, the embodiment of the present application provides a specific implementation manner of an interface sequence of at least two network interfaces corresponding to the slot information acquired in S203, including:
B1: acquiring an interface linear relation mapping function of the network adapter corresponding to the slot position information; the interface linear relation mapping function characterizes the corresponding relation between the interface sequence of the network adapter corresponding to the slot position information in the network equipment and the interface sequence of the actual physical interface; the interface linear relation mapping function is predetermined according to the model of the network adapter.
And acquiring an interface linear relation mapping function of the network adapter corresponding to the slot position information in advance. In an embodiment of the present application, the mapping function is written asWherein, x= { X 1,x2,x3......xn } is an interface sequence of the network adapter corresponding to the slot information in the network device, X i is each interface sequence number in the interface sequence, i=1, 2,3. Y= { Y 1,y2,y3......yn } is the interface order of the actual physical interface, and Y i is each interface sequence number in the interface order. First linear relationship sequence/>The second linear relationship sequence β= { β 123......βn }.
The interface linear relation mapping function of the network adapter corresponding to the slot position information is predetermined according to the model of the network adapter. The interface linear relationship mapping functions corresponding to different models of network adapters may be different.
B2: and determining the interface sequence of the actual physical interface of the network adapter as the interface sequence of the network interface corresponding to the slot position information through the interface linear relation mapping function.
It can be appreciated that the interface linear relation mapping function provided aboveSo that the functionThis is true. Therefore, after knowing the interface sequence of the network adapter corresponding to the slot position information in the network equipment, the interface sequence of the actual physical interface of the network adapter can be determined through the interface linear relation mapping function. Further, the interface order of the actual physical interfaces of the network adapter is used as the interface order of the network interfaces corresponding to the slot information.
For example, an 8-port expansion card of model IG8011A, which corresponds to a first linear relationship sequence in an interface linear relationship mapping functionSecond linear relationship sequence/>When the interface sequence X={x1=1,x2=2,x3=3,x4=4,x5=5,x6=6,x7=7,x8=8} of the network adapter corresponding to the slot information in the network device, according to the provided first linear relation sequence and second linear relation sequence, the interface sequence of the actual physical interfaces of the network adapter can be Y={y1=2,y2=1,y3=4,y4=3,y5=6,y6=5,y7=8,y8=7}., that is, the first interface displayed in the network device is actually the second interface in the actual physical interfaces, the second interface displayed in the network device is actually the first interface in the actual physical interfaces, the third interface displayed in the network device is actually the fourth interface in the actual physical interfaces, and so on.
Based on the above content of B1-B2, it can be known that when the interface sequence of the network adapter corresponding to the slot information in the network device is different from the interface sequence of the actual physical interfaces, the interface sequence of the actual physical interfaces is obtained according to the interface linear relation mapping function, and the interface sequence of the actual physical interfaces is used as the interface sequence of at least two network interfaces corresponding to the slot information. In this way, the situation that the naming of the network adapter interfaces is inconsistent with the interface sequence of the actual physical interfaces of the network adapter can be reduced.
In a possible implementation manner, the embodiment of the present application provides a specific implementation manner for acquiring interface identification information of at least two network interfaces in S204, including:
and acquiring interface identification information of at least two network interfaces from the file directory corresponding to the slot position information.
In one possible implementation, the system directory of the network device lists the bus addresses of all other devices to which the network device is connected and each bus address corresponds to a respective file directory. The system catalog is, for example, a/sys/bus/pcb/devices/catalog.
After the bus address corresponding to the device identifier of the network adapter is obtained and the bus address corresponding to the device identifier of the network adapter is determined to be the slot information of the network adapter slot of the network device, the file directory corresponding to the slot information can be determined through the obtained slot information of the network adapter slot. The file catalogue corresponding to the slot position information comprises interface identification information of the network interface corresponding to the slot position information. Therefore, the interface identification information of the network interface corresponding to the slot information can be directly obtained from the file catalog corresponding to the slot information.
For example, when the slot information of the network adapter card slot is determined to be 00:01.0, finding 00:01.0 under the/sys/bus/pc/devices/catalogue, and entering a folder corresponding to 00:01.0, wherein the file catalogue is listed in the folder. Interface identification information of each network interface corresponding to 00:01.0 is obtained from the file catalog, for example, 4 network interfaces, and the interface identification information is 02:00.0, 02:00.1, 02:00.2 and 02:00.3 respectively.
As an alternative example, the interface identification information of each network interface corresponding to the slot information may be obtained by commanding find/sys/bus/pcb/devices/slot information/-NAME DRIVER. That is, [ < bus > ] [ < slot > ] [ < func > ] of each network interface corresponding to the slot information is determined.
In the embodiment of the application, different interface renaming modes are corresponding to different operating systems. In a possible implementation manner, the embodiment of the present application provides a specific implementation manner of changing an original naming corresponding to interface identification information of a target network interface to a standard naming of the target network interface in S205, including:
C1: when the network equipment uses the Linux operating system, the original naming corresponding to the interface identification information of the target network interface is obtained.
When the network equipment uses the Linux operating system, firstly, the interface identification information of the target network interface is acquired. And further, acquiring the corresponding original naming based on the interface identification information of the target network interface.
As an alternative example, when the network device uses the Linux operating system, the original naming corresponding to the interface identification information $ { bus $ { slot $ { func }, $ { bus }, $ { slot }, may be obtained by the ls/sys/bus/pc i/devices/0000/$ { bus }, $ { slot $ { func }/net command. Wherein ls is the command name,/sys/bus/pcb/devices/0000: $ { bus }: $ { slot }, $ { func }/net is the address space, belongs to one of the parameters, and is spaced from the address space by spaces.
For example, if eth5 is obtained through ls/sys/bus/pcb/devices/0000:02:00.1/net, the original name of the network interface corresponding to the interface information identifier 02:00.1 of the network interface is named eth5, and the original name can be changed, for example, to be changed to eth-s1p1 through a command.
In addition, the Linux system issues a command to the operating system kernel in a system call mode, and after the operating system kernel receives the command, each PCI address in the network device is obtained, and whether the device corresponding to the PCI address is a network adapter or not is judged, and whether the conditions of the PCI address, the device corresponding to the PCI address does not exist, and the like are judged. When the device corresponding to the PCI address is not the network adapter and the PCI address exists but the device corresponding to the PCI address does not exist, the error is determined to occur. At this time, an error message is returned. And if no error occurs, acquiring the original name corresponding to the interface identification information of the target network interface.
C2: and closing the target network interface.
And after the original naming corresponding to the interface identification information of the target network interface is obtained, closing the target network interface to rename the target network interface.
As an alternative example, when the network device uses the Linux operating system, the ifconfig $old_name down command may be used to close the network interface. The old_name is the original name corresponding to the interface identification information of the target network interface.
And C3: and responding to a renaming request, namely changing the original name corresponding to the interface identification information of the target network interface into the standard name of the target network interface, wherein the renaming request comprises the original name corresponding to the interface identification information of the target network interface and the standard name of the target network interface.
After the target network interface is closed, the target network interface may be renamed. And triggering a renaming request by a user through a command, and responding to the renaming request, and changing the original naming corresponding to the interface identification information of the target network interface into the standard naming of the target network interface.
As an alternative example, when the network device uses the Linux operating system, the name of the network interface may be modified using the IP LINK SET $old_name name$new_name command. The $ new_name is the standard name of the target network interface.
And C4: and opening the target network interface.
After renaming the target network interface, opening the target network interface to complete renaming of the target network interface.
As an alternative example, when the network device uses the Linux operating system, the ifconfig $new_name up command may be used to enable the network interface.
It can be understood that when the Linux operating system is used by the network device, the original naming of the target network interface needs to be obtained first, and then the original naming of the target network interface is changed based on the original naming of the target network interface.
In a possible implementation manner, the embodiment of the present application provides a specific implementation manner of changing an original naming corresponding to interface identification information of a target network interface to a standard naming of the target network interface in S205, including:
when the network device uses Dpdk user mode, responding to renaming request triggered by inter-process communication, changing original naming corresponding to interface identification information of the target network interface into standard naming of the target network interface, wherein the renaming request comprises the interface identification information of the target network interface and the standard naming of the target network interface.
Dpdk is a data plane development suite, dpdk is a specific driving framework with high performance. When the network device uses Dpdk user mode, the user can trigger renaming request through inter-process communication, and respond to the request to directly change the original naming corresponding to the interface identification information of the target network interface into the standard naming of the target network interface.
The Dpdk user state issues a command to the Dpdk program in an inter-process communication mode, and after the Dpdk program receives the command, each PCI address in the network device is acquired first, and whether the device corresponding to the PCI address is a network adapter or not is judged, and whether the situation that the PCI address exists but the device corresponding to the PCI address does not exist or not is judged. When the device corresponding to the PCI address is not the network adapter and the PCI address exists but the device corresponding to the PCI address does not exist, the error is determined to occur. At this time, an error message is returned. When no error occurs, the driver/dev/pegasus may be opened through the Open interface in Dpdk programs and a rename request may be issued through ioctl to rename the target network interface.
It can be understood that when the network device uses Dpdk user mode, the original name of the target network interface is not required to be obtained, and the corresponding original name of the target network interface can be directly changed into the standard name of the target network interface according to the interface identification information of the target network interface.
Referring to fig. 3, fig. 3 is a flowchart of another method for renaming a network adapter interface according to an embodiment of the application. As shown in fig. 3, the method may include S301-S311:
s301: the PCI address of the network adapter card slot of the network device is obtained.
It can be understood that the obtaining of the PCI address of the network adapter card slot of the network device obtains the slot information of the network adapter card slot of the network device.
S302: and obtaining the slot_index in the network interface relation five-tuple.
In the implementation process, slot_index corresponding to a network adapter card slot of the network adapter is obtained. As an alternative example, the PCI address of the network adapter card slot of the network device is determined as slot_index in the network interface relation five-tuple.
S303: the PCI address of each network interface in the network adapter is obtained.
It can be understood that the PCI address of each network interface in the network adapter is the interface identification information of the network interface corresponding to the slot information.
S304: and acquiring [ < bus > ] [ < slot > ] [ < func > ] in the network interface relation five-tuple.
When the method is implemented, the [ < bus > ] [ < slot > ] [ < func > ] of each network interface in the network adapter corresponding to the network adapter card slot is obtained. As an alternative example, the PCI address of the network interface in the network adapter is determined as [ < bus > ] [ < slot > ] [ < func > ] corresponding to the network interface.
The network interface corresponds to the network adapter card slot, and slot_index corresponding to the network adapter card slot corresponds to [ < bus > ] [ < slot > ] [ < func > ] of the network interface corresponding to the network adapter card slot. For example, the network adapter card slot corresponding to 00:01.0 corresponds to four network interfaces with PCI addresses of 02:00.0, 02:00.1, 02:00.2, and 02:00.3. Then 00:01.0 corresponds to 02:00.0, 02:00.1, 02:00.2, 02:00.3.
S305: the interface sequence of each network interface in the network adapter is obtained.
In the implementation, the interface sequence of each network interface corresponding to each network adapter card slot of the network adapter is obtained, that is, the interface sequence of the network interface corresponding to the slot position information of the network adapter card slot described in the above embodiment.
S306: the port_index in the network interface five-tuple is obtained.
In the implementation, the interface serial numbers of the network interfaces corresponding to the network adapter card slots of the network adapters are obtained. As an optional example, an interface serial number corresponding to the network interface is obtained from an interface sequence of each network interface of the network adapter, and the interface serial number of the network interface is determined as a port_index of the network interface.
S307: generating a network interface relation five-tuple.
Based on slot_index corresponding to a network adapter card slot of the network adapter, port_index corresponding to each network interface corresponding to the network adapter card slot, and [ < bus > ] [ < slot > ] [ < func > ] corresponding to each network interface corresponding to the network adapter card slot, generating a network interface relation five-tuple.
S308: and judging whether the network equipment uses the Linux operating system, if so, executing S309, and if not, executing S310.
S309: and renaming the network interface by adopting an Ip link mode.
In the implementation, the original naming of the network interface is obtained first, and then the original naming of the network interface is changed in an Ip link mode on the basis of the original naming of the target network interface.
S310: and judging whether the network equipment uses Dpdk user modes, if so, executing S311, and if not, ending.
S311: and opening the driving device/dev/pegasus by adopting an Open interface, and renaming by issuing a request through ioctl.
In specific implementation, the driving device/dev/pegasus can be directly opened through the Open interface, and the original naming of the network interface is renamed through the ioctl issuing request.
It can be appreciated that specific implementation details of S301 to S311 may refer to the above embodiments, and are not described herein.
Based on the above-mentioned content of S301-S311, the embodiment of the present application provides a more standard renaming manner for network interfaces, that is, determining a new standard naming of each network interface in the card slot according to the slot information of the card slot of the network adapter and the interface sequence of the network interfaces corresponding to the slot information, thereby improving the efficiency of renaming interfaces and being convenient for use of interfaces.
Based on the method for renaming the network adapter interface provided by the embodiment of the method, the embodiment of the application also provides a device for renaming the network adapter interface, and the device for renaming the network adapter interface is described below with reference to the accompanying drawings.
Referring to fig. 4, the structure of a device for renaming a network adapter interface according to an embodiment of the present application is shown. As shown in fig. 4, the network adapter interface renaming apparatus includes:
a first obtaining unit 401, configured to obtain slot information of a network adapter card slot of a network device;
A second obtaining unit 402, configured to obtain an interface sequence of at least two network interfaces corresponding to the slot information;
A determining unit 403, configured to determine, according to the slot information and the interface sequence, a standard interface name corresponding to each of the at least two network interfaces;
a third obtaining unit 404, configured to obtain interface identification information of the at least two network interfaces;
And a changing unit 405, configured to change an original name corresponding to the interface identification information of the target network interface to a standard name of the target network interface, where the target network interface is each of the at least two network interfaces.
In one possible implementation manner, the first obtaining unit 401 includes:
a first obtaining subunit, configured to obtain device identifiers corresponding to respective bus addresses of the network device;
a second obtaining subunit, configured to identify, from the device identifiers, a device identifier of the network adapter, and obtain a bus address corresponding to the device identifier of the network adapter;
and the first determining subunit is used for determining the bus address corresponding to the equipment identifier of the network adapter as the slot position information of the network adapter card slot of the network equipment.
In one possible implementation manner, the second obtaining unit 402 includes:
The third obtaining subunit is used for obtaining the interface linear relation mapping function of the network adapter corresponding to the slot position information; the interface linear relation mapping function characterizes the corresponding relation between the interface sequence of the network adapter corresponding to the slot position information in the network equipment and the interface sequence of the actual physical interface; the interface linear relation mapping function is predetermined according to the model of the network adapter;
And the second determining subunit is used for determining the interface sequence of the actual physical interface of the network adapter as the interface sequence of at least two network interfaces corresponding to the slot position information through the interface linear relation mapping function.
In a possible implementation manner, the third obtaining unit 404 is specifically configured to:
and acquiring interface identification information of the network interface corresponding to the slot position information from the file catalog corresponding to the slot position information.
In one possible implementation, the apparatus further includes:
a fourth obtaining unit, configured to obtain a type identifier corresponding to the device identifier of the network adapter, and determine, according to the type identifier, that the network adapter belongs to an on-board network adapter or an extended network adapter.
In one possible implementation manner, the changing unit 405 includes:
A fourth obtaining subunit, configured to obtain, when the network device uses a Linux operating system, an original name corresponding to interface identification information of a target network interface;
A closing subunit, configured to close the target network interface;
A change subunit, configured to change, in response to a renaming request, an original name corresponding to interface identification information of the target network interface to a standard name of the target network interface, where the renaming request includes the original name corresponding to the interface identification information of the target network interface and the standard name of the target network interface;
and the starting subunit is used for starting the target network interface.
In a possible implementation manner, the changing unit 405 is specifically configured to:
When the network device uses Dpdk user mode, responding to renaming request triggered by inter-process communication, changing original naming corresponding to interface identification information of the target network interface into standard naming of the target network interface, wherein the renaming request comprises the interface identification information of the target network interface and the standard naming of the target network interface.
In addition, the embodiment of the application also provides electronic equipment, which comprises: a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the method of renaming a network adapter interface as in any of the embodiments above when the computer program is executed.
In addition, the embodiment of the application also provides a computer readable storage medium, wherein instructions are stored in the computer readable storage medium, and when the instructions run on a terminal device, the terminal device is caused to execute the method for renaming the network adapter interface according to any one of the above embodiments.
Based on the above, the embodiments of the present application provide a device and an apparatus for renaming a network adapter interface, which firstly obtain slot information of a network adapter card slot of a network device and an interface sequence of at least two network interfaces corresponding to the slot information. Further, a standard naming of each of the at least two network interfaces is determined based on the slot information and the interface order. And then, acquiring interface identification information of at least two network interfaces, and changing original names corresponding to the interface identification information of the target network interfaces into standard names of the target network interfaces, wherein the target network interfaces are respectively used for each network interface. In this way, the embodiment of the application provides a more standard renaming mode of the network interface, namely, the new standard naming of each network interface corresponding to the slot position information is determined according to the slot position information of the network adapter card slot and the interface sequence of at least two network interfaces corresponding to the slot position information, thereby improving the renaming efficiency of the network interface and being convenient for the use of the network interface.
It should be noted that, in the present description, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other. For the system or device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant points refer to the description of the method section.
It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. A method of renaming a network adapter interface, the method comprising:
acquiring slot information of a network adapter card slot of network equipment, wherein the slot information comprises Peripheral Component Interconnect (PCI) addresses;
Acquiring an interface linear relation mapping function of the network adapter corresponding to the slot position information; the interface linear relation mapping function characterizes the corresponding relation between the interface sequence of the network adapter corresponding to the slot position information in the network equipment and the interface sequence of the actual physical interface; the interface linear relation mapping function is predetermined according to the model of the network adapter;
Determining the interface sequence of the actual physical interface of the network adapter as the interface sequence of at least two network interfaces corresponding to the slot position information through the interface linear relation mapping function;
determining standard naming corresponding to each network interface in the at least two network interfaces according to the slot information and the interface sequence;
Acquiring interface identification information of the at least two network interfaces, wherein the interface identification information comprises a bus number, a device number and a function block sequence;
And changing the original name corresponding to the interface identification information of the target network interface into the standard name of the target network interface, wherein the target network interface is respectively used for each of the at least two network interfaces.
2. The method of claim 1, wherein the obtaining slot information of the network adapter card slot of the network device comprises:
Acquiring device identifiers corresponding to each bus address of the network device;
Identifying the equipment identifier of the network adapter from the equipment identifiers, and acquiring a bus address corresponding to the equipment identifier of the network adapter;
And determining the bus address corresponding to the equipment identifier of the network adapter as slot position information of a network adapter card slot of the network equipment.
3. The method according to claim 1 or 2, wherein the obtaining interface identification information of the at least two network interfaces comprises:
And acquiring interface identification information of the at least two network interfaces from the file catalogue corresponding to the slot position information.
4. The method according to claim 1, wherein the method further comprises:
And obtaining a type identifier corresponding to the equipment identifier of the network adapter, and determining that the network adapter belongs to an on-board network adapter or an extended network adapter according to the type identifier.
5. The method according to claim 1, wherein changing the original naming corresponding to the interface identification information of the target network interface to the standard naming of the target network interface includes:
When the network equipment uses a Linux operating system, acquiring an original name corresponding to interface identification information of a target network interface;
Closing the target network interface;
Responding to a renaming request, changing an original name corresponding to the interface identification information of the target network interface into a standard name of the target network interface, wherein the renaming request comprises the original name corresponding to the interface identification information of the target network interface and the standard name of the target network interface;
and opening the target network interface.
6. The method according to claim 1, wherein changing the original naming corresponding to the interface identification information of the target network interface to the standard naming of the target network interface includes:
When the network device uses Dpdk user mode, responding to renaming request triggered by inter-process communication, changing original naming corresponding to interface identification information of the target network interface into standard naming of the target network interface, wherein the renaming request comprises the interface identification information of the target network interface and the standard naming of the target network interface.
7. An apparatus for renaming a network adapter interface, the apparatus comprising:
The first acquisition unit is used for acquiring slot information of a network adapter card slot of the network equipment, wherein the slot information comprises a Peripheral Component Interconnect (PCI) address;
The second obtaining unit is used for obtaining an interface linear relation mapping function of the network adapter corresponding to the slot position information; the interface linear relation mapping function characterizes the corresponding relation between the interface sequence of the network adapter corresponding to the slot position information in the network equipment and the interface sequence of the actual physical interface; the interface linear relation mapping function is predetermined according to the model of the network adapter; determining the interface sequence of the actual physical interface of the network adapter as the interface sequence of at least two network interfaces corresponding to the slot position information through the interface linear relation mapping function;
the determining unit is used for determining standard naming corresponding to each network interface in the at least two network interfaces according to the slot position information and the interface sequence;
a third obtaining unit, configured to obtain interface identification information of the at least two network interfaces, where the interface identification information includes a bus number, a device number, and a function block sequence;
and the changing unit is used for changing the original name corresponding to the interface identification information of the target network interface into the standard name of the target network interface, wherein the target network interface is respectively used for each of the at least two network interfaces.
8. An electronic device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the method of renaming a network adapter interface as claimed in any one of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium having instructions stored therein which, when run on a terminal device, cause the terminal device to perform the method of renaming a network adapter interface as claimed in any of claims 1-6.
CN202210968974.3A 2022-08-12 2022-08-12 Method, device and equipment for renaming network adapter interface Active CN115277630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210968974.3A CN115277630B (en) 2022-08-12 2022-08-12 Method, device and equipment for renaming network adapter interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210968974.3A CN115277630B (en) 2022-08-12 2022-08-12 Method, device and equipment for renaming network adapter interface

Publications (2)

Publication Number Publication Date
CN115277630A CN115277630A (en) 2022-11-01
CN115277630B true CN115277630B (en) 2024-05-17

Family

ID=83750288

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210968974.3A Active CN115277630B (en) 2022-08-12 2022-08-12 Method, device and equipment for renaming network adapter interface

Country Status (1)

Country Link
CN (1) CN115277630B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101409673A (en) * 2008-11-12 2009-04-15 北京恒光创新科技股份有限公司 Method for transmitting network adapter data, network adapter and system
WO2016144339A1 (en) * 2015-03-11 2016-09-15 Hewlett Packard Enterprise Development Lp Generate network name based on network naming standard
WO2017040706A1 (en) * 2015-09-02 2017-03-09 Cnex Labs, Inc. Nvm express controller for remote access of memory and i/o over ethernet-type networks
CN108243407A (en) * 2017-12-21 2018-07-03 深圳市宏电技术股份有限公司 A kind of method and terminal device of multiple wireless module device network interface managements
CN109412830A (en) * 2018-09-05 2019-03-01 广州视源电子科技股份有限公司 Method and device for curing internet card name, computer equipment and storage medium
CN112003960A (en) * 2020-08-06 2020-11-27 杭州安恒信息技术股份有限公司 Network interface management method and device of industrial control equipment and electronic device
CN113176866A (en) * 2019-05-25 2021-07-27 森大(深圳)技术有限公司 Data processing method, device, equipment and storage medium for ink-jet printer

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8948029B2 (en) * 2010-11-19 2015-02-03 Red Hat, Inc. Naming network interface cards

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101409673A (en) * 2008-11-12 2009-04-15 北京恒光创新科技股份有限公司 Method for transmitting network adapter data, network adapter and system
WO2016144339A1 (en) * 2015-03-11 2016-09-15 Hewlett Packard Enterprise Development Lp Generate network name based on network naming standard
WO2017040706A1 (en) * 2015-09-02 2017-03-09 Cnex Labs, Inc. Nvm express controller for remote access of memory and i/o over ethernet-type networks
CN108243407A (en) * 2017-12-21 2018-07-03 深圳市宏电技术股份有限公司 A kind of method and terminal device of multiple wireless module device network interface managements
CN109412830A (en) * 2018-09-05 2019-03-01 广州视源电子科技股份有限公司 Method and device for curing internet card name, computer equipment and storage medium
CN113176866A (en) * 2019-05-25 2021-07-27 森大(深圳)技术有限公司 Data processing method, device, equipment and storage medium for ink-jet printer
CN112003960A (en) * 2020-08-06 2020-11-27 杭州安恒信息技术股份有限公司 Network interface management method and device of industrial control equipment and electronic device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
交换机和路由器一体化的设计与实现;张晓哲, 王在方, 刘琼, 方贵明;计算机工程与应用;20061001(34);全文 *

Also Published As

Publication number Publication date
CN115277630A (en) 2022-11-01

Similar Documents

Publication Publication Date Title
US5870610A (en) Autoconfigurable method and system having automated downloading
US6636901B2 (en) Object-oriented resource lock and entry register
EP1049973B1 (en) Object-oriented global resource conflict resolver
US7082524B2 (en) I/O bus abstraction for a cluster interconnection fabric
US20060123061A1 (en) Method of accessing files in electronic devices
US20070245134A1 (en) Testing device and testing method for computer
JP2010015595A (en) Apparatus and method for modeling behavior of expansion board in computer system
CN110943872A (en) Data acquisition service configuration/performance analysis method/system, medium, and server
GB2442355A (en) Dynamic loading of protocol adapters on a client
CN113608790A (en) Linux system based self-adaptive management method and system for serial device and storage medium
CN115277630B (en) Method, device and equipment for renaming network adapter interface
US7231513B1 (en) Dynamically linked basic input/output system
IE20000024A1 (en) Method and apparatus for determining the drive letter assignment of a CD-ROM drive during initial system setup of a computer system
US6708229B2 (en) Configuring computer components
US20030023895A1 (en) Peripheral failover system
CN115664953B (en) Resource allocation method and related device of external equipment
US9367330B1 (en) Method of accessing files in electronic devices
CN115033299B (en) Method and terminal for starting production test system
CN110413311A (en) &#39; In System Reconfiguration Method and server
US5732280A (en) Method and apparatus for dynamically assigning programmable option select identifiers
US8983938B1 (en) Selecting a command file
CN117251297B (en) Equipment distribution method, electronic equipment and storage medium
CN113660248B (en) Service traffic isolation method, system, readable storage medium and device
CN117850885A (en) Operating system installation configuration method and device, PXE server and storage medium
CN118227162A (en) Network card chip firmware upgrading method, management board, management node and computing equipment

Legal Events

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