当前位置:网站首页>How to distinguish virtual network card and physical network card?
How to distinguish virtual network card and physical network card?
2022-07-21 09:35:00 【51CTO】
One 、 What are physical network card and virtual network card ?
Here is the following : The red part contains VMWare Of is virtual network card .
Usually , We deploy VMWare virtual machine 、VMSphere Virtual cluster 、XenCenter Virtual clusters involve virtual network cards .
Two 、 Identify the application scenarios of physical network card and virtual network card
Scene one : Generally, when deploying virtual clusters .
Scene two : Through packet capturing analysis, the source of the data request is the data packet sent by the physical network card , It is also used when sending packets from the virtual network card address . Identification is through mac Address sensitive .
Scene three : Other scenarios that need to distinguish network cards .
3、 ... and 、 How to distinguish between physical network card and virtual network card ?
Method 1 : Old fashioned and applicable only to windows operating system .
The principle is roughly as follows :
First of all GetAdaptersInfo Get the basic information of all network cards . Then use the network card name to find the corresponding hardware information in the registry . If it is a physical network card , Its hardware information usually includes PCI .
for example , The name of a network card is {ACA306D0-1D69-4116-BC2B-919B428AD084}.
The location of his information in the registry is :
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Network/{4D36E972-E325-11CE-BFC1-08002BE10318}/{ACA306D0-1D69-4116-BC2B-919B428AD084}/Connection
if PnpInstanceID The value of PCI start , Description is physical network card ,MediaSubType by 01 Is a common network card ,02 For wireless network card .
This method is only applicable to windows operating system , Not universal .
Method 2 : comprehensive stackoverflow and github obtain (2016 year 10 month 8 Japan ).
1、 Contains the following MAC Address before 8 Bytes ( front 3 paragraph ) It's a virtual network card :
Take the following network card address for example :
The last two are marked with 00:50:56 It starts with VMWare Virtual network card address .
Based on this : The implementation is also very simple , Ideas as follows :
After obtaining the network card address , Before judgment 8 Bytes , The list above the loop variable , If the former 8 Same bytes , To terminate the program , That is, the virtual network card address ; Otherwise, it is the physical network card address .
2、 The following links discuss the classification of virtual network cards :
3、 The following link gives the interface implementation of full classification of virtual network cards :
4、 May be in doubt ?
1) Will it be inaccurate if it does not include all .
Yes , Need to brainstorm , Collect more information , Make it as comprehensive as possible .
Four : Summary
When I first started, I analyzed the data package , Architects can tell which is at a glance VMWare Sent by the machine , Now I know it's based on Mac The first few digits of the address come to the conclusion .
And I know this principle much later than architects 2 year , this , Maybe it's the gap and something worth working on !
author : Mingyi world
边栏推荐
猜你喜欢
7.24聚会通知
(作業)C語言做題:結構體對齊數、比特段、聯合體
rank函数的功能有哪些
高並發的深入理解
Deep understanding of high concurrency
Observability improves the quality of software engineering, and observation cloud attends the 2022 qecon global software quality & effectiveness conference
我是如何毕业就失业的?
Unity Panel 控件
Nacos custom extended data ID configuration
【Unity基础知识】基础游戏单位GameObject中常用的属性和API
随机推荐
MySQL乐观锁
百度地图截图
我是如何毕业就失业的?
SAP HANA Cloud 学习教程之一: 如何在 SAP BTP 上创建 SAP HANA Cloud 实例
教育事件
Summary and practice of MySQL optimistic lock (I)
最短 hamilton 路径 题解
暑期总结1
云速直播凭何荣获企业青睐?
Several ways to open SAP Hana Database Explorer in different locations
A typical Fiori application developed using SAP cloud application programming model
瓜分30万奖金!DeepRec CTR模型性能优化天池挑战赛来啦
WireShark 抓包及快速定位数据包技巧
几种在不同的位置打开 SAP HANA Database explorer 的办法
Unity Image控件和RawImage
BisinessCardGen
我国科学家在高安全量子密钥分发网络方面取得新进展
如何只将人体步态轮廓中的人给裁剪出来
matlab基础语法总结
2012.4.13 360笔试总结