How to map vNIC MAC to pNIC MAC address in OVM x86 ?

Today I was supposed to find on which physical NIC my vNIC assigned to VM is created. I used the below method to find the mapping of vNIC to pNIC.

Its little bit tricky we need to careful about that.

Step 1 : First of all we need to find the interface number on VM for which we are finding the physical NIC.

In case of Windows NICs are starting from 1.
In case of Unix/Linux NICs most of the time are starting from 0.

Please note the above point.

Step 2 : I have taken the putty session to physical server on which VM is hosted. First command we can issue is below one.

thn1smsmosovs01 ~> xm list
Name ID Mem VCPUs State Time(s)
0004fb00000600008e46c0bb7f5e9e1f 1 2051 2 -b—- 1192.5
0004fb0000060000f21b125580290ca9 2 2051 2 -b—- 1187.6
Domain-0 0 3789 20 r—– 22494.1
From the above output we can find domain ID of VM.

In my case I have found that domain ID of VM from GUI and matched that ID on putty session. My VM (for which I am finding mapping between vNIC to pNIC) has domain ID 1.

If you are not having GUI access then you can look for vm.cfg file of VM and find the uuid then with help of above command map that uuid to domain ID.

Step 3 : Need to issue the below command.
thn1smsmosovs01 ~> brctl show
bridge name bridge id STP enabled interfaces
10.132.189.0 8000.90e2ba3dfda5 no bond0.60
10432f2397 8000.0010e02262f9 no eth1
vif1.0
vif2.0
Above output is showing that vif interfaces. vif stands for virtual interface this will cme incase of HVM VMs.

vif1.0 can be read as interface associated with domain ID 1 and it is for first ethernet of VM in case of Windows and eth0 in case of Linux
vif2.0 can be read as interface associated with domain ID 2 and it is for first ethernet of VM in case of Windows and eth0 in case of Linux

My Windows machine 1 interface is mapped to vif1.0. That means the physical interface is eth1.

Step 4 : Just to make sure that our investigation is right. Below command can be issued it will help us to show the MACs which are registered on bridge (10432f2397).
thn1smsmosovs01 ~> brctl showmacs 10432f2397
port no mac addr is local? ageing timer
2 00:21:f6:00:00:02 no 16.35
4 00:21:f6:00:00:0a no 0.45
1 54:7f:ee:e7:16:9c no 1.02
2 fe:ff:ff:ff:ff:ff yes 0.00
Now you can search for the MAC which is showing in VM for ethernet 1 if its found that we are on right track.

Step 5 : Now we can find the MAC address of bridge and physical NIC from which vNIC is created.
thn1smsmosovs01 ~> ifconfig 10432f2397
10432f2397 Link encap:Ethernet HWaddr **:**:**:22:62:F9
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:108790 errors:0 dropped:5156 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7664727 (7.3 MiB) TX bytes:0 (0.0 b)
thn1smsmosovs01 ~> ifconfig eth1
eth1 Link encap:Ethernet HWaddr **:**:**:22:62:F9
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:112189 errors:0 dropped:5009 overruns:0 frame:0
TX packets:2156 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10478666 (9.9 MiB) TX bytes:333958 (326.1 KiB)

Thanks for reading it 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s