CN106817439A - A kind of method for obtaining MAC Address - Google Patents

A kind of method for obtaining MAC Address Download PDF

Info

Publication number
CN106817439A
CN106817439A CN201710072895.3A CN201710072895A CN106817439A CN 106817439 A CN106817439 A CN 106817439A CN 201710072895 A CN201710072895 A CN 201710072895A CN 106817439 A CN106817439 A CN 106817439A
Authority
CN
China
Prior art keywords
vlan
mac address
tag
ipc
network
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.)
Pending
Application number
CN201710072895.3A
Other languages
Chinese (zh)
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.)
Wuhan Zhuo Wei Video Technology Co Ltd
Original Assignee
Wuhan Zhuo Wei Video Technology Co Ltd
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 Wuhan Zhuo Wei Video Technology Co Ltd filed Critical Wuhan Zhuo Wei Video Technology Co Ltd
Priority to CN201710072895.3A priority Critical patent/CN106817439A/en
Publication of CN106817439A publication Critical patent/CN106817439A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
    • H04N7/181Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast for receiving images from a plurality of remote sources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Abstract

The invention provides a kind of method for obtaining MAC Address, comprise the following steps:Network data frame is got based on VLAN modules in operating system nucleus;VLAN Tag are obtained by the network data frame and packet is originated and records MAC Address;The VLAN Tag of above-mentioned acquisition are marked and corresponding MAC Address is recorded, the present invention can conveniently obtain the LAN mouthfuls of MAC Address of corresponding IPC, and by VLAN network interface cards can not also be normally carried out network communication with the IPC in VLAN.

Description

A kind of method for obtaining MAC Address
Technical field
The present invention relates to network configuration management field, and in particular to a kind of method of acquisition MAC Address.
Background technology
The configuration management of the network equipment includes one group to distinguishing, defining, control and monitoring the right of one communication network of composition As necessary correlation function.Distinguish, monitor that the network equipment is then generally basede on the detection of the network equipment.Network Personal Video Recorder (NVR) Need the web camera (IPC) of management different type and different IP addresses and audio/video flow and video recording can be obtained, need first Various video cameras can be detected.
For the Network Personal Video Recorder of tape swap machine function, then need to know the corresponding IPC of each switch ports themselves (LAN mouthful) MAC Address, by MAC Address obtain IPC relevant information, such that it is able to the passage of IPC and NVR is associated, carry out The configuration of IPC, the acquisition of audio frequency and video, display, video recording etc. are operated.
The association of switch ports themselves and video recorder passage is typically realized by two schemes:
1st, interchanger carries MAC writing functions, and the MAC Address of IPC is obtained by interchanger configuration feature.
2nd, interchanger is recorded without MAC, by the MAC Address of VLAN (VLAN) technical limit spacing IPC.
The exchanger chip hardware cost that the first scheme needs is higher, therefore is used second current most of NVR more Scheme.NVR based on VLAN schemes and IPC to interact schematic diagram as shown in Figure 1.
VLAN is VLAN (Virtual Local Area Network), is a kind of by by setting in LAN For logically rather than the technology for being physically divided into the network segment one by one.Vlan technology allows network manager by physics LAN is logically divided into different broadcast domains (or virtual lan, i.e. VLAN), and each VLAN has identical comprising one group The computer workstation of demand, has identical attribute with the LAN for physically forming.
VLAN is proposed to solve the broadcast issue and security of Ethernet, and it increases on the basis of ethernet frame User, smaller working group is divided into VLAN Tag by VLAN heads, and each working group is exactly a VLAN.Virtually The benefit of LAN is can to form virtual workgroup, dynamic management network.Different VLAN are put under by LAN mouthfuls, IPC is accessed After LAN mouthfuls, VLAN is contained in VLAN frame heads for packet adds VLAN frame heads automatically when the packet of IPC is by interchanger Tag.CPU is automatically forwarded to corresponding Microsoft Loopback Adapter after receiving the packet of band VLAN frame heads.As a example by Fig. 1, should With program from VLAN1 correspondence virtual nets eth0:1 data for receiving must just come from IPC1, by parsing the source in packet MAC Address is it is known that the MAC Address of IPC.And then the operations such as the IP settings of IPC are carried out by MAC Address, set IPC's IP is with Microsoft Loopback Adapter in the same network segment, it is possible to a series of management are carried out to IPC by the IP of IPC and is operated.
The MAC Address of IPC is obtained using virtual network card technology scheme at present and is had with the subject matters that communicate of IPC:(1) it is empty The management for intending network interface card is complex.Need to add or delete virtual in an operating system by Microsoft Loopback Adapter specialized configuration instrument Network interface card.Each Microsoft Loopback Adapter needs IP sections different and subnet mask of configuration, when system needs to change the IP of itself, then owns Microsoft Loopback Adapter IP and subnet mask be required for change, if the subnet that miscarriage easily occurs belonging to each Microsoft Loopback Adapter goes out Now conflict causes to be gone wrong with the communication of video camera.(2) need to send packet to all of Microsoft Loopback Adapter during detecting devices And response bag is detected, and multithreading realization is generally required, increased to system resources consumption.(3) needed during the IP of modification video camera The corresponding relation of video camera and Microsoft Loopback Adapter is specified, otherwise needs to send management bag to all Microsoft Loopback Adapters.Problem above causes NVR network configuration management complexities based on Microsoft Loopback Adapter are higher, and R&D costs increase.And use and carry MAC writing functions Exchange hardware cost is also higher.
The NVR of tape swap machine function typically has following steps to the record of the MAC Address of IPC in existing technology:
(1), each LAN mouthfuls of interchanger be put into different VLAN by Network Personal Video Recorder, and sets different VLAN Tag, interchanger adds VLAN frame heads automatically to the packet for receiving after setting.
Shown in the form table 1 of VLAN frame heads (4 bytes):
Table 1
PRI:Frame priority.
CFI:Specification flag.
TAG:VLAN ID.
(2), the different VLAN of the multiple Microsoft Loopback Adapters correspondences of video recorder itself establishment, corresponding LAN mouthfuls so as to correspond to, i.e., The packet received from certain Microsoft Loopback Adapter must send from the video camera of corresponding LAN mouthfuls access;
(3), Network Personal Video Recorder is that all of LAN mouthfuls form by broadcasting sends detection data to all of Microsoft Loopback Adapter Bag;
(4) after the detection bag that, web camera is received, the correspondence is sent by the form of broadcast, multicast or unicast Response bag to send detection bag Network Personal Video Recorder;
(5), Network Personal Video Recorder collects probe response bag on each Microsoft Loopback Adapter and parses corresponding video camera information, So as to video camera and Microsoft Loopback Adapter are mapped, and Microsoft Loopback Adapter and LAN according to (2) mouthful corresponding relation derivation Go out video camera MAC Address and LAN mouthfuls of relation.
For the Network Personal Video Recorder of tape swap machine function, each passage is one-to-one relationship with LAN mouthfuls, is determined by detecting After the MAC Address of IPC and LAN mouthful of corresponding relation, the relation of each passages of NVR and IPC is just specify that, by IPC's and NVR Each passage binding, has just reached the purpose that convenience manages video camera, can easier realize the automatic management of video camera.
Shown in reference picture 2, the acquisition IPC MAC Address flows of prior art cause existing scheme more complicated Reason is the packet that must could receive each VLAN from kernel using Microsoft Loopback Adapter.Therefore application program needs management each VLAN network interface cards, and data read-write operation is carried out respectively to each network interface card.
The content of the invention
In order to solve the defect of above-mentioned deficiency, the invention provides a kind of method for obtaining MAC Address, can directly in Core inquires the MAC Address of VLAN correspondences IPC, wherein the MAC Address for obtaining IPC is an a kind of implementation method therein, but Including but not limited to IPC, substantially ethernet device can be realized.
The invention provides a kind of method for obtaining MAC Address, comprise the following steps:
Network data frame is got based on VLAN modules in operating system nucleus;
VLAN Tag are obtained by the network data frame and packet is originated and records MAC Address;
The VLAN Tag of above-mentioned acquisition are marked and corresponding MAC Address is recorded.
Above-mentioned method, wherein, it is described that the VLAN Tag of above-mentioned acquisition are marked and corresponding MAC Address is recorded In step, application program is marked by above-mentioned VLAN Tag and directly can inquire the MAC ground that VLAN modules correspond to IPC by inside core Location.
Above-mentioned method, wherein, it is described that the VLAN Tag of above-mentioned acquisition are marked and corresponding MAC Address is recorded In step, VLAN Tag are set to 0.
Above-mentioned method, wherein, it is described based on the step of VLAN modules get network data frame in operating system nucleus Including:Each LAN mouthfuls of interchanger be put into different VLAN modules by Network Personal Video Recorder, and sets different VLAN Tag, Interchanger adds VLAN frame heads automatically to the packet for receiving after setting.
The present invention has advantages below:(1) the LAN mouthfuls of MAC Address of corresponding IPC can conveniently be obtained.(2) do not pass through VLAN network interface cards can also be normally carried out network communication with the IPC in VLAN.
Brief description of the drawings
By the detailed description made to non-limiting example with reference to the following drawings of reading, the present invention and its feature, outward Shape and advantage will become more apparent upon.Identical mark indicates identical part in whole accompanying drawings.Not deliberately proportionally Draw accompanying drawing, it is preferred that emphasis is purport of the invention is shown.
Fig. 1 is the VLAN schematic diagrames of the NVR of tape swap machine function in the prior art.
Fig. 2 is the flow chart for obtaining each LAN mouthfuls of corresponding MAC in the prior art.
Fig. 3 is the flow chart that the present invention obtains IPC MAC Address.
Specific embodiment
In the following description, a large amount of concrete details are given to provide more thorough understanding of the invention.So And, it is obvious to the skilled person that the present invention can be able to without one or more of these details Implement.In other examples, in order to avoid obscuring with the present invention, do not enter for some technical characteristics well known in the art Row description.
In order to thoroughly understand the present invention, detailed step and detailed structure will be proposed in following description, so as to Explaination technical scheme.Presently preferred embodiments of the present invention is described in detail as follows, but in addition to these detailed descriptions, this Invention can also have other embodiment.
Shown in reference picture 1- Fig. 3, the invention provides a kind of method for obtaining MAC Address, comprise the following steps:
Step S1:Network data frame is got based on VLAN modules in operating system nucleus, including based on operation system The step of VLAN modules get network data frame in system kernel includes:Each LAN mouthfuls of interchanger be put into by Network Personal Video Recorder In different VLAN modules, and different VLAN Tag are set, interchanger adds VLAN automatically to the packet for receiving after setting Frame head.
Step S2:VLAN Tag are obtained by the network data frame and packet is originated and records MAC Address.
Step S3:The VLAN Tag of above-mentioned acquisition are marked and corresponding MAC Address is recorded, further preferably, will VLAN Tag are set to 0, wherein, application program is marked by above-mentioned VLAN Tag and directly can inquire VLAN modules by inside core The MAC Address of correspondence IPC.
The present invention is based on the basis of using vlan technology, and the corresponding VLAN of packet of acquisition is recorded in kernel After Tag and MAC Address Tag in VLAN frames is set to 0, it is to avoid application program carries out the Microsoft Loopback Adapter operation of complexity, subtracts Development amount is lacked.Being required for the interchanger with MAC Address writing function can also easily carry out the detection of video camera And management, reduce hardware cost.That is it is of the invention to it is critical only that VLAN modules get in operating system nucleus Network data frame, obtains VLAN Tag and packet carrys out source MAC and records, then by the VLAN of data frame from data frame Tag is changed to 0. application program and directly can inquire the MAC Address that VLAN corresponds to IPC by inside core, can reach two purposes:(1) may be used The LAN mouthfuls of MAC Address of corresponding IPC is obtained to facilitate.(2) can also normally not entered with the IPC in VLAN by VLAN network interface cards Row network communication.
Below for the industry name being related in the present invention is explained.With reference to shown in table 2.
Table 2
Presently preferred embodiments of the present invention is described above.It is to be appreciated that the invention is not limited in above-mentioned Particular implementation, wherein the equipment and structure that do not describe in detail to the greatest extent are construed as giving reality with the common mode in this area Apply;Any those of ordinary skill in the art, in the case where technical solution of the present invention ambit is not departed from, all using the disclosure above Methods and techniques content make many possible variations and modification to technical solution of the present invention, or be revised as equivalent variations etc. Effect embodiment, this has no effect on substance of the invention.Therefore, every content without departing from technical solution of the present invention, foundation Technical spirit of the invention still falls within the present invention to any simple modification, equivalent variation and modification made for any of the above embodiments In the range of technical scheme protection.

Claims (4)

1. it is a kind of obtain MAC Address method, it is characterised in that comprise the following steps:
Network data frame is got based on VLAN modules in operating system nucleus;
VLAN Tag are obtained by the network data frame and packet is originated and records MAC Address;
The VLAN Tag of above-mentioned acquisition are marked and corresponding MAC Address is recorded.
2. a kind of method for obtaining MAC Address as claimed in claim 1, it is characterised in that the VLAN by above-mentioned acquisition In the step of Tag is marked and records corresponding MAC Address, application program by above-mentioned VLAN Tag mark can directly to Kernel inquires the MAC Address of VLAN modules correspondence IPC.
3. a kind of method for obtaining MAC Address as claimed in claim 1, it is characterised in that the VLAN by above-mentioned acquisition In the step of Tag is marked and records corresponding MAC Address, VLAN Tag are set to 0.
4. a kind of method for obtaining MAC Address as claimed in claim 1, it is characterised in that described based on operating system nucleus The step of middle VLAN modules get network data frame includes:Each LAN mouthfuls of interchanger be put into different by Network Personal Video Recorder In VLAN modules, and different VLAN Tag are set, interchanger adds VLAN frame heads automatically to the packet for receiving after setting.
CN201710072895.3A 2017-02-10 2017-02-10 A kind of method for obtaining MAC Address Pending CN106817439A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710072895.3A CN106817439A (en) 2017-02-10 2017-02-10 A kind of method for obtaining MAC Address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710072895.3A CN106817439A (en) 2017-02-10 2017-02-10 A kind of method for obtaining MAC Address

Publications (1)

Publication Number Publication Date
CN106817439A true CN106817439A (en) 2017-06-09

Family

ID=59113102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710072895.3A Pending CN106817439A (en) 2017-02-10 2017-02-10 A kind of method for obtaining MAC Address

Country Status (1)

Country Link
CN (1) CN106817439A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108683701A (en) * 2018-04-03 2018-10-19 浙江大华技术股份有限公司 A kind of connection method and rear end equipment, IPC
CN110381178A (en) * 2019-08-02 2019-10-25 杭州巨峰科技有限公司 NVR module and its out drawing method and POE-NVR mould group

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1674545A (en) * 2004-03-26 2005-09-28 联想(北京)有限公司 Address setting system and address setting method
CN1925497A (en) * 2006-01-19 2007-03-07 莱克斯信息技术(北京)有限公司 Binding method based on VID, MAC, IP and users
US20120063306A1 (en) * 2010-09-10 2012-03-15 Futurewei Technologies, Inc. Use of Partitions to Reduce Flooding and Filtering Database Size Requirements in Large Layer Two Networks
CN103312908A (en) * 2013-06-04 2013-09-18 武汉烽火网络有限责任公司 Data transmission method used for Voice VLAN (virtual local logic network)
CN103905787A (en) * 2012-12-27 2014-07-02 广州市九安光电技术股份有限公司 Straight connection type plug-and-play network video recorder system and realization method
CN104486589A (en) * 2014-12-25 2015-04-01 浙江宇视科技有限公司 Assess method and device of GVRP-based video monitoring system
WO2016023443A1 (en) * 2014-08-12 2016-02-18 烽火通信科技股份有限公司 Method for supporting vlan by means of linux soft bridge
CN105634903A (en) * 2015-12-31 2016-06-01 深圳市磊科实业有限公司 NVR and IPC port corresponding method
CN105847147A (en) * 2016-03-17 2016-08-10 浙江宇视科技有限公司 Data transmission method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1674545A (en) * 2004-03-26 2005-09-28 联想(北京)有限公司 Address setting system and address setting method
CN1925497A (en) * 2006-01-19 2007-03-07 莱克斯信息技术(北京)有限公司 Binding method based on VID, MAC, IP and users
US20120063306A1 (en) * 2010-09-10 2012-03-15 Futurewei Technologies, Inc. Use of Partitions to Reduce Flooding and Filtering Database Size Requirements in Large Layer Two Networks
CN103905787A (en) * 2012-12-27 2014-07-02 广州市九安光电技术股份有限公司 Straight connection type plug-and-play network video recorder system and realization method
CN103312908A (en) * 2013-06-04 2013-09-18 武汉烽火网络有限责任公司 Data transmission method used for Voice VLAN (virtual local logic network)
WO2016023443A1 (en) * 2014-08-12 2016-02-18 烽火通信科技股份有限公司 Method for supporting vlan by means of linux soft bridge
CN104486589A (en) * 2014-12-25 2015-04-01 浙江宇视科技有限公司 Assess method and device of GVRP-based video monitoring system
CN105634903A (en) * 2015-12-31 2016-06-01 深圳市磊科实业有限公司 NVR and IPC port corresponding method
CN105847147A (en) * 2016-03-17 2016-08-10 浙江宇视科技有限公司 Data transmission method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108683701A (en) * 2018-04-03 2018-10-19 浙江大华技术股份有限公司 A kind of connection method and rear end equipment, IPC
CN110381178A (en) * 2019-08-02 2019-10-25 杭州巨峰科技有限公司 NVR module and its out drawing method and POE-NVR mould group
CN110381178B (en) * 2019-08-02 2022-04-01 杭州巨峰科技有限公司 NVR module and drawing method thereof and POE-NVR module

Similar Documents

Publication Publication Date Title
US9385923B2 (en) Configuration management method of logical topology in virtual network and management server
CN104883547B (en) Method and NVR based on network access equipment physical port access IPC
CN104468219B (en) Virtual networking method for discovering network topology and equipment
CN103036692B (en) The method and device of network topology is generated for IT supporting network
CN104486589B (en) Access method and device in video monitoring system based on GVRP
CN104837179B (en) A kind of method and device showing hotspot equipment manufacturer information
CN108696452A (en) A kind of container levels network flow acquisition, network quality identification method, device, system
CN104660511B (en) The transmission method and equipment of multicast message in a kind of SDN
CN107333260A (en) A kind of method and device for the real MAC address for obtaining terminal
EP2093950A1 (en) A METHOD AND DEVICE FOR REALIZING AUTOMATICAL DISTRIBUTION OF QinQ BUSINESS LABEL TERMINAL TO TERMINAL
CN106383736A (en) Port extension method and apparatus
CN105634903A (en) NVR and IPC port corresponding method
CN108111910A (en) A kind of method and system for adjusting video playing clarity
CN106817439A (en) A kind of method for obtaining MAC Address
CN109995639A (en) A kind of data transmission method, device, interchanger and storage medium
CN107345951A (en) A kind of air quality methods of exhibiting and device
CN104144069B (en) The method and apparatus that wireless side Call Data Record associates with customer service behavior
CN107018360A (en) A kind of IPC adding method, apparatus and system
CN106330616A (en) Method of realizing railway data business classification monitoring
CN109039947A (en) Network packet De-weight method, device, network shunt equipment and storage medium
CN104811334A (en) Multi-CEC-communication-equipment management method
KR101264951B1 (en) Device for intercepting and analyzing traffic for a terminal
CN108965093B (en) VLAN (virtual local area network) distribution method and device
CN108259338B (en) Private network application identification method and device
JPH11146003A (en) Network monitor and method for recognizing terminal connected to repeater hub

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170609