[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting domU vif's MAC address from dom0


  • To: xen-users@xxxxxxxxxxxxxxxxxxxx
  • From: Andy Smith <andy@xxxxxxxxxxxxxx>
  • Date: Wed, 25 Sep 2024 22:37:22 +0000
  • Delivery-date: Wed, 25 Sep 2024 22:38:12 +0000
  • List-id: Xen user discussion <xen-users.lists.xenproject.org>
  • Openpgp: id=BF15490B; url=http://strugglers.net/~andy/pubkey.asc

Hi,

Is there an easy way of programmatically obtaining the domU-side MAC of
a vif, from the dom0?

Example:

A domU called debtest1 with a vif named v-debtest1, in dom0:

$ ip --brief link show dev v-debtest1
v-debtest1       UP             fe:ff:ff:ff:ff:ff 
<BROADCAST,MULTICAST,UP,LOWER_UP>

in domU:

$ ip --brief link show dev enX0
enX0             UP             00:16:5e:00:02:39 
<BROADCAST,MULTICAST,UP,LOWER_UP>

Easiest way to get 00:16:5e:00:02:39 in dom0?

I know I can get it from xenstore if I know the domain ID:

$ sudo xenstore-read /local/domain/0/backend/vif/60/0/mac
00:16:5e:00:02:39

So, I can resolve domU name to domain ID and do that I guess.

I want this from a vif script. Is the domU domain ID exposed to the vif
scripts at all (e.g. vif-route)?

I can also parse it out of the domU's config file, but that seems quite
hacky.

The purpose of this is in order to add a route via the IPv6 link-local
address inside the domU, which can be calculated from the MAC address
of the domU's interface.

Thanks,
Andy



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.