Method capable of automatically inputting card number and MAC address to network card

Through automated network card MAC address flashing scripts, the problems of low efficiency and unstable quality caused by manual input in network card production are solved, and efficient and accurate batch input of network card models, serial numbers and MAC addresses is realized, improving production efficiency and product quality. quality.

CN118740798APending Publication Date: 2024-10-01EMDOOR CHINESE ACAD OF SCI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410981746.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the existing technology, network card production requires manual input of the network card model, network card serial number and MAC address, which results in low production efficiency, high cost and error-prone, affecting product quality stability.

Method used

By creating the nowmac.txt file and the network card information storage file, write the network card MAC address flash script and use the shell's echo command to automatically read and flash the network card model, serial number and MAC address, realizing batch input without manual intervention, and automatically increasing the MAC address to accommodate multiple NIC units.

Benefits of technology

It greatly improves production efficiency, reduces costs, improves the quality stability of network card products, and avoids manual input errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740798A_ABST
    Figure CN118740798A_ABST
Patent Text Reader

Abstract

The invention provides a method capable of automatically inputting a card number and an MAC address to a network card. The method comprises the steps of storing initial addresses of MAC addresses needing to be flashed in batches in a nowmac.txt file, creating a network card MAC address flashing script to automatically read the last row of MAC addresses in the nowmac.txt file, and inputting a network card model, a network card serial number and the MAC address of the network card to a target network card in batches by using an echo instruction of a shell. The method has the advantages that the network card models, the network card serial numbers and the MAC addresses of the network cards can be automatically input to the target network cards in batches, manual input is not needed, the production efficiency is greatly improved, the production cost is reduced, errors are not prone to occurring due to automatic input, and the quality stability of network card products is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of MAC addresses, and in particular to a method capable of automatically inputting a card number and a MAC address into a network card. Background Art

[0002] With the continuous development of computers, computers are now needed in many fields, and the network function of computers is extremely important. Communication between users and the control of many devices need to be completed through the network, and the network is based on the network card. The network cards are interconnected through the network. The MAC address is very important, which is equivalent to everyone's ID card; MAC (Media Access Control or Medium Access Control) address, translated as media access control, or called physical address, hardware address, is used to define the location of network devices. In the OSI model, the third layer network layer is responsible for IP addresses, and the second layer data link layer is responsible for MAC addresses. Therefore, a host will have a MAC address, and each network location will have an IP address that belongs to it. The MAC address is determined by the network card and is fixed.

[0003] With the continuous breakthroughs in domestic technology, there are more and more domestic products, and the demand for network cards is also increasing. However, the tools provided with the network cards on the market can only be operated manually. After executing the tool, you need to manually enter the network card model, network card serial number and network card MAC address. During mass production, each network card needs to be manually entered with the network card model, network card serial number and network card MAC address, which becomes extremely inconvenient and consumes a lot of manpower and material resources. It not only leads to an increase in production costs, but also makes it difficult to improve production efficiency. In addition, it is easy to make mistakes when manually entering the data, resulting in unstable quality of the network card. Summary of the invention

[0004] In order to solve the problems in the prior art, the present invention provides a method for automatically inputting card numbers and MAC addresses for network cards, which can realize automatic batch input of network card models, network card serial numbers and MAC addresses of network cards for target network cards without manual input, greatly improving production efficiency and reducing production costs, and automatic input is not prone to errors, thereby improving the quality stability of network card products, and solving the problem in the prior art that network card production requires manual input of network card models, network card serial numbers and MAC addresses of network cards, resulting in low production efficiency and unstable network card quality.

[0005] A method for automatically inputting a card number and a MAC address to a network card of the present invention comprises the following steps:

[0006] Step 1: Create a nowmac.txt file and a network card information storage file. Create a txt file named nowmac.txt, and store the starting address of the MAC address used for batch flashing to the network card in the nowmac.txt file; create a network card information storage file, and store the network card model and network card serial number corresponding to the MAC address used for batch flashing to the network card in the network card information storage file;

[0007] Step 2: Create a flashing script. Create a flashing script in the Linux system and name it the network card MAC address flashing script. Use the network card MAC address flashing script to read the last line of MAC address in the nowmac.txt file, and obtain the network card type and network card serial number corresponding to the MAC address in the network card information storage file.

[0008] Step 3: Automatically flash the MAC address. The network card MAC address flashing script uses the shell's echo command to flash the read MAC address and the corresponding network card type and network card serial number into the target network card. At the same time, the MAC address is incremented by N bits and stored at the end of the last line of the nowmac.txt file to complete the network card type, network card serial number and network card MAC address flashing operation, where N is a natural number, N≥1.

[0009] The present invention is further improved, in said step 3, further comprising the following steps:

[0010] Step 301: The network card MAC address flashing script determines the specific number of network card units in the target network card that need to have the MAC address flashed;

[0011] Step 302: The network card MAC address flashing script uses the shell's echo command to flash the read MAC address and the corresponding network card type and network card serial number into the first network card unit of the target network card;

[0012] Step 303: The network card MAC address flashing script increments one bit in sequence according to the specific number of network card units of the target network card, obtains the network card type and network card serial number corresponding to the incremented MAC address in the network card information storage file, and flashes them into the remaining network card units of the target network card in sequence;

[0013] Step 304: The network card MAC address flashing script increments one digit based on the last MAC address flashed into the target network card and generates the MAC address to be flashed and stores it in the nowmac.txt file.

[0014] The present invention is further improved in that, in step 1, the multiple MAC address segments used for batch flashing to the network card are incremented in sequence.

[0015] The present invention is further improved, in step 1, each MAC address corresponds to the network card model and the network card serial number.

[0016] The present invention is further improved, in step 2, the last line of MAC addresses in the nowmac.txt file is the only MAC address in the nowmac.txt file that has not been used.

[0017] The present invention is further improved. In the step 303, when the number of specific network card units in the target network card that need to write MAC addresses is 2, the network card MAC address writing script will increment the MAC address in the first network card unit of the target network card by one to generate a second MAC address, obtain the network card type and network card serial number corresponding to the second MAC address in the network card information storage file, and then write them into the second network card unit of the target network card.

[0018] The present invention is further improved. In the step 303, when the number of specific network card units in the target network card that need to write MAC addresses is ≥3, the network card MAC address writing script will increment the MAC address written into the second network card unit of the target network card by one to generate a third MAC address, obtain the network card type and network card serial number corresponding to the third MAC address in the network card information storage file, and then write them into the third network card unit of the target network card, and then incrementally generate new MAC addresses and write them into the remaining network card units of the target network card until all network card units of the target network card are written with the MAC address and the corresponding network card type and network card serial number.

[0019] The present invention is further improved. In step 304, the MAC address to be flashed is generated by incrementing one bit and stored in the next line of the last line of MAC addresses in the nowmac.txt file, becoming the new last line in the nowmac.txt file.

[0020] The beneficial effects of the present invention are as follows: the present invention provides a method for automatically inputting card numbers and MAC addresses for network cards, by storing the starting addresses of MAC addresses that need to be batch-written in the nowmac.txt file, creating a network card MAC address writing script to automatically read the last line of MAC addresses in the nowmac.txt file, and using the shell echo command to batch-input the network card model, network card serial number and MAC address of the network card to the target network card, so that the network card model, network card serial number and MAC address of the network card can be automatically input to the target network card in batches without manual input, which greatly improves the production efficiency and reduces the production cost, and the automatic input is not prone to errors, which improves the quality stability of the network card product, and solves the problem that the network card production in the prior art requires manual input of the network card model, network card serial number and MAC address of the network card, resulting in low production efficiency and unstable network card quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A flow chart of a method for automatically inputting a card number and a MAC address to a network card according to the present invention;

[0022] Figure 2 The present invention is a flow chart of a method for automatically inputting a card number and a MAC address into a network card. DETAILED DESCRIPTION

[0023] The present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0024] See also Figure 1-2 A method for automatically inputting a card number and a MAC address to a network card of the present invention comprises the following steps:

[0025] Step 1: Create a nowmac.txt file and a network card information storage file. Create a txt file named nowmac.txt, and store the starting address of the MAC address used for batch flashing to the network card in the nowmac.txt file; create a network card information storage file, and store the network card model and network card serial number corresponding to the MAC address used for batch flashing to the network card in the network card information storage file; among them, the multiple MAC address segments used for batch flashing to the network card are incremented in sequence, and each MAC address corresponds to the network card model and network card serial number.

[0026] Step 2: Create a flashing script. Create a flashing script in the Linux system and name it the network card MAC address flashing script. Use the network card MAC address flashing script to read the last line of MAC address in the nowmac.txt file, and obtain the network card type and network card serial number corresponding to the MAC address in the network card information storage file; among them, the last line of MAC address in the nowmac.txt file is the only MAC address in the nowmac.txt file that has not been used.

[0027] Step 3: Automatically flash the MAC address. The network card MAC address flashing script uses the shell's echo command to flash the read MAC address and the corresponding network card type and network card serial number into the target network card. At the same time, the MAC address is incremented by N bits and stored at the end of the last line of the nowmac.txt file to complete the network card type, network card serial number and network card MAC address flashing operation, where N is a natural number, N≥1. In this embodiment, by storing the starting addresses of the MAC addresses that need to be batch-written in the nowmac.txt file, storing the network card model and network card serial number corresponding to the MAC address in the network card information storage file, creating a network card MAC address flashing script to automatically read the last line of MAC addresses in the nowmac.txt file and the network card model and network card serial number corresponding to the MAC address in the network card information storage file, and using the shell's echo command to batch-input the network card model, network card serial number and network card MAC address to the target network card, it is possible to automatically batch-input the network card model, network card serial number and network card MAC address to the target network card without manual input, thereby greatly improving production efficiency and reducing production costs. In addition, automatic input is not prone to errors, thereby improving the quality stability of network card products.

[0028] See also Figure 2 In step 3, the following steps are also included:

[0029] Step 301: The network card MAC address flashing script determines the specific number of network card units in the target network card that need to have the MAC address flashed. In this embodiment, the number of network card units in the target network card is 2.

[0030] Step 302: The network card MAC address flashing script uses the shell's echo instruction to flash the read MAC address and the corresponding network card type and network card serial number into the first network card unit of the target network card; wherein the Linux Shell is the user interface of the system, providing an interface for the user to interact with the kernel, it receives the command input by the user and sends it to the kernel for execution, in fact, the Shell is a command interpreter, it interprets the command input by the user and sends them to the kernel, not only that, the Shell has its own programming language for editing commands, it allows the user to write programs composed of shell commands, the Shell programming language has many characteristics of ordinary programming languages, for example, it also has loop structures and branch control structures, etc., the Shell program written in this programming language has the same effect as other application programs, echo is the most commonly used and widely used command built into Linux's bash and C shell, usually used in script languages ​​and batch files to display a line of text or string in the standard output or file, in this embodiment, the echo instruction is used to flash the read MAC address and the corresponding network card type and network card serial number into the network card unit of the target network card.

[0031] Step 303: The network card MAC address flashing script increments one bit in sequence according to the specific number of network card units of the target network card, obtains the network card type and network card serial number corresponding to the incremented MAC address in the network card information storage file, and flashes them into the remaining network card units of the target network card in sequence; when the specific number of network card units in the target network card that need to flash the MAC address is 2, the network card MAC address flashing script will flash the MAC address in the first network card unit of the target network card by one bit to generate a second MAC address, obtains the network card type and network card serial number corresponding to the second MAC address in the network card information storage file, and then writes into the second network card unit of the target network card; when the number of specific network card units in the target network card that need to write MAC addresses is ≥3, the network card MAC address writing script will increment the MAC address written into the second network card unit of the target network card by one to generate a third MAC address, obtain the network card type and network card serial number corresponding to the third MAC address in the network card information storage file, and then write them into the third network card unit of the target network card, and then incrementally generate new MAC addresses and write them into the remaining network card units of the target network card until all network card units of the target network card are written with the MAC address and the corresponding network card type and network card serial number.

[0032] Step 304: The network card MAC address flashing script automatically increments one digit to generate the MAC address to be flashed based on the last MAC address flashed into the target network card and stores it in the nowmac.txt file, that is, it is stored in the next line of the last MAC address in the nowmac.txt file, becoming the new last line in the nowmac.txt file, which is convenient for reading next time. In this embodiment, the implementation code of the network card MAC address flashing script is as follows:

[0033] #! / bin / bash

[0034] password=a123123#machine password

[0035] filename=`pwd`

[0036] mac1=`cat nowmac.txt|awk'END{print}''

[0037] echo 2$mac1 ffffffffffffffffff|. / wxtool_arm64-F SF200HT_10016.img-UP

[0038] dec_mac=`echo"obase=10;ibase=16;$mac1"|bc`

[0039] let dec_mac+=2

[0040] hex_mac=`echo"obase=16;ibase=10;$dec_mac"|bc`

[0041] echo$hex_mac

[0042] echo$hex_mac>>nowmac.txt.

[0043] As can be seen from the above, the beneficial effects of the present invention are as follows: the present invention provides a method for automatically inputting card numbers and MAC addresses for network cards, by storing the starting addresses of the MAC addresses that need to be batch-written in the nowmac.txt file, creating a network card MAC address flashing script to automatically read the last line of MAC addresses in the nowmac.txt file, and using the shell's echo command to batch-input the network card model, network card serial number and MAC address of the network card to the target network card, which can automatically input the network card model, network card serial number and MAC address of the network card to the target network card in batches without manual input, greatly improving production efficiency and reducing production costs, and automatic input is not prone to errors, thereby improving the quality stability of network card products, and solving the problem that the production of network cards in the prior art requires manual input of the network card model, network card serial number and MAC address of the network card, resulting in low production efficiency and unstable network card quality.

[0044] The specific implementation modes described above are preferred implementation modes of the present invention, and are not intended to limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to the specific implementation modes, and all equivalent changes made according to the present invention are within the protection scope of the present invention.

Claims

1. A method for automatically inputting the card number and MAC address for a network card. It is characterized in that The following steps are included: Step 1: Create a nowmac.txt file and a network card information storage file. Create a txt file named nowmac.txt and store the starting address of the MAC address used for batch flashing to the network card in the nowmac.txt file. Create a network card information storage file, and store the network card model and network card serial number corresponding to the MAC address used for batch flashing into the network card information storage file; Step 2: Create a flashing script. Create a flashing script in the Linux system and name it the network card MAC address flashing script. Use the network card MAC address flashing script to read the last line of MAC address in the nowmac.txt file, and obtain the network card type and network card serial number corresponding to the MAC address in the network card information storage file. Step 3: Automatically flash the MAC address. The network card MAC address flashing script uses the shell's echo command to flash the read MAC address and the corresponding network card type and network card serial number into the target network card. At the same time, the MAC address is incremented by N bits and stored at the end of the last line of the nowmac.txt file to complete the network card type, network card serial number and network card MAC address flashing operation, where N is a natural number, N≥1.

2. The method for automatically inputting a card number and a MAC address to a network card as claimed in claim 1, It is characterized in that In step 3, the following steps are also included: Step 301: The network card MAC address flashing script determines the specific number of network card units in the target network card that need to have the MAC address flashed; Step 302: The network card MAC address flashing script uses the shell's echo command to flash the read MAC address and the corresponding network card type and network card serial number into the first network card unit of the target network card; Step 303: The network card MAC address flashing script increments one bit in sequence according to the specific number of network card units of the target network card, obtains the network card type and network card serial number corresponding to the incremented MAC address in the network card information storage file, and flashes them into the remaining network card units of the target network card in sequence; Step 304: The network card MAC address flashing script increments one digit based on the last MAC address flashed into the target network card and generates the MAC address to be flashed and stores it in the nowmac.txt file.

3. The method for automatically inputting a card number and a MAC address to a network card as claimed in claim 2, Features: In step 1, the multiple MAC address segments used for batch flashing to the network card are incremented in sequence.

4. The method of automatically inputting a card number and a MAC address to a network card as claimed in claim 3, Features: In step 1, each MAC address corresponds to a network card model and a network card serial number.

5. The method for automatically inputting a card number and a MAC address to a network card as claimed in claim 4, Features: In step 2, the last line of MAC addresses in the nowmac.txt file is the only MAC address in the nowmac.txt file that has not been used.

6. The method of automatically inputting a card number and a MAC address to a network card as claimed in claim 5, Features: In step 303, when the number of specific network card units in the target network card that need to write MAC addresses is 2, the network card MAC address writing script will increment the MAC address in the first network card unit of the target network card by one digit to generate a second MAC address, obtain the network card type and network card serial number corresponding to the second MAC address in the network card information storage file, and then write them into the second network card unit of the target network card.

7. The method for automatically inputting a card number and a MAC address to a network card as claimed in claim 6, Features: In step 303, when the number of specific network card units in the target network card that need to write MAC addresses is ≥ 3, the network card MAC address writing script will increment the MAC address written into the second network card unit of the target network card by one to generate a third MAC address, obtain the network card type and network card serial number corresponding to the third MAC address in the network card information storage file, and then write them into the third network card unit of the target network card, and then incrementally generate new MAC addresses and write them into the remaining network card units of the target network card until all network card units of the target network card are written with the MAC address and the corresponding network card type and network card serial number.

8. The method of automatically inputting a card number and a MAC address to a network card as claimed in claim 7, Features: In step 304, the MAC address to be flashed is generated by incrementing one bit and stored in the next line of the last line of MAC addresses in the nowmac.txt file, becoming the new last line in the nowmac.txt file.