1

I have create a macvtap interface like that :

$ ip link add link wlan0 name gitea type macvtap
$ ip link set gitea address 68:61:6b:67:69:74 up
$ ip link show gitea

10: gitea@wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 500
    link/ether 68:61:6b:67:69:74 brd ff:ff:ff:ff:ff:ff

And i have a xml template for my gitea container like that :

    <devices>
        <emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
        <filesystem type='mount'>
            <source dir='/containers/prod/gitea' />
            <target dir='/' />
        </filesystem>
        <console type='pty' />
        <interface type='??'>
            <source dev='gitea'/>
        </filesystem>
    </devices>

But what should I write in the interface part to pass the created macvtap interface to the container or what should I write to recreate the interface if we can not pass it directly.

Thanks in advance for your consideration.

Aisenp
  • 13
  • 3

1 Answers1

0

libvirt has native support for creating macvtap interfaces on demand. See: https://libvirt.org/formatdomain.html#elementsNICSDirect

In your case it would look something like:

<interface type='direct'>
  <source dev='wlan0' mode='bridge'/>
</interface>

But that won't give you the 'gitea' naming. The other option might be type='ethernet' but I don't have much experience with that, I'm not sure if it will work for you. I think the XML would look like

<interface type='ethernet'>
  <target dev='gitea'/>
</interface>

(Also IIRC macvtap doesn't work with wifi devices so not sure if your setup will actually work either way)