about the script /etc/qemu-ifup with nmcli command

Yalan Zhang yalzhang at redhat.com
Wed Oct 21 10:31:50 UTC 2020


Hi,

I have tried the qemu-ifup script as below with nmcli command as brctl is
deprecated on rhel8, but the guest network can not work.
I think the script needs update. Could you please help to have a look?
Thank you in advance.

1. prepare a linux bridge on the host named br0;

2. prepare the qemu-ifup script as below:
# cat /etc/qemu-ifup
#!/bin/bash
# A br0 bridge should be already set up.
# Compare with:
# http://en.wikibooks.org/wiki/QEMU/Networking#qemu-ifup
#
# For the bridge setup, see:
# http://wiki.libvirt.org/page/Networking#Fedora.2FRHEL_Bridging
# http://gist.github.com/393525
ip link set "$1" up
nmcli c add type bridge-slave ifname $1 con-name $1 master br0 autoconnect
yes

3. start vm with below interface setting:
# virsh dumpxml rh | grep /interface -B5
    <interface type='ethernet'>
      <mac address='52:54:00:79:ba:dd'/>
      <script path='/etc/qemu-ifup'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00'
function='0x0'/>
    </interface>
# virsh start rh
Domain rh started

4.check on guest, the interface can not get dhcp ip address;

5. check on host,
# nmcli con
NAME    UUID                                  TYPE      DEVICE
br0     f68f73c7-10ee-40c1-bb09-3366d11ac896  bridge    br0
...
vnet0   90a48d77-dccc-4b59-98f5-09f8cbd62458  ethernet  --

# nmcli dev
DEVICE      TYPE      STATE                   CONNECTION
br0         bridge    connected               br0
...
vnet0       tun       unmanaged               --

6. hotplug a bridge type interface and compare the tap devices:
# virsh attach-interface rh bridge br0 --model virtio
Interface attached successfully

# nmcli con
NAME    UUID                                  TYPE      DEVICE
br0     f68f73c7-10ee-40c1-bb09-3366d11ac896  bridge    br0
vnet1   07c2a1f8-396f-4d5f-b61f-ef2ddb42ed93  tun       vnet1    --->the
hot-plugged one
...
vnet0   90a48d77-dccc-4b59-98f5-09f8cbd62458  ethernet  --       ----> the
ethernet one

# nmcli dev
DEVICE      TYPE      STATE                   CONNECTION
vnet1       tun       connected (externally)  vnet1         --->the
hot-plugged one
vnet0       tun       unmanaged               --     ----> the ethernet one
...

7. from the outputs above, the back-end tun device for ethernet type
interface is unmanaged.
I don't know how to update the script to fix it. Could you please help?


-------
Best Regards,
Yalan Zhang
IRC: yalzhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20201021/e442a455/attachment.htm>


More information about the libvirt-users mailing list