[libvirt-users] Creating network interfaces with specific name in LXC

Martin Kletzander mkletzan at redhat.com
Mon Nov 2 16:05:32 UTC 2015

On Fri, Oct 30, 2015 at 10:09:51PM +0530, Harish Vishwanath wrote:
>Thanks Martin. What I would like to achieve is govern the interface name
>created within the container, so that my application can take different
>actions on different interfaces (such as eth0, eth1 etc.,).

  <guest dev='devicename'/>

That is what you're looking for.  Although I usually recommend not
relying on the name, but rather using the MAC address.

Also <target dev='othername'/> says how the device will be named on
the host.

>Libvirt's lxc driver seems to create interfaces as eth0, eth1 and so on,
>when there are multiple <interface /> entries in the domain xml. How can I
>request for a particular interface name?
>I saw that in some of the examples in https://libvirt.org/formatdomain.html,
><source dev=" " network=" "> is specified. I tried setting the "dev"
>attribute of source tag, but it doesn't look like that is being parsed and
>stored either.
>On Fri, Oct 30, 2015 at 8:32 PM, Martin Kletzander <mkletzan at redhat.com>
>> On Fri, Oct 30, 2015 at 08:16:33PM +0530, Harish Vishwanath wrote:
>>> Hello
>>> I am trying to create interfaces within an LXC container with specific
>>> name. I am using the following XML:
>>>    <interface type='network' name='blah'>
>>>      <source network='dpbr_n_0'/>
>>>    </interface>
>> That name='' is not parsed, it won't get saved, it doesn't mean
>> anything to libvirt.  This particular configuration doesn't say much,
>> because type=network means all the settings will get set from the
>> network dpbr_n_0.  See https://libvirt.org/formatdomain.html for all
>> the things you can configure in <interface/> and what does each option
>> mean.
>> This doesn't seem to work; it always ends up creating interface with name
>>> as "eth0".
>>> I found some examples here:
>>> http://libvirt.org/guide/html/Application_Development_Guide-Network_Interfaces-XML_Format.html
>>> That uses interface type as "ethernet" and specifies name also, If I do
>>> that, I get back an error while starting the container as "Unsupported
>>> network type ethernet".
>>> Appreciate your help.
>>> Regards,
>>> Harish
>> _______________________________________________
>>> libvirt-users mailing list
>>> libvirt-users at redhat.com
>>> https://www.redhat.com/mailman/listinfo/libvirt-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20151102/e4ff57d4/attachment.sig>

More information about the libvirt-users mailing list