You are not logged in.

#1 2022-07-23 06:06:22

Registered: 2022-06-09
Posts: 31

Create and use macvtap in Qemu as user

I want to be able to use macvtap in Qemu as a user. Preferably I would like to be able to create it as a user as well.


My story here in the forum:

The following script ( is here:


# VMimage

# I create a MacVtap1 with:
#ip link add link eth1 name macvtap1 type macvtap
#ip link set macvtap1 address 1a:46:0b:ca:bc:7b up
#ip link show macvtap1

# Alternatively with mode:
link add link eth1 name macvtap1 type macvtap mode bridge
ip link set macvtap1 up
ip link show macvtap1

# I start Qemu with:
qemu-system-x86_64 -drive file=$hdf,format=qcow2 -enable-kvm -machine q35 -device intel-iommu -cpu host -m 4G -net nic,model=virtio,macaddr="$(cat /sys/class/net/macvtap1/address)" -net tap,fd=3 3<>/dev/tap"$(cat /sys/class/net/macvtap1/ifindex)"

I start the script with:


This works fine so far. But I would like to start Qemu as user.

If I now only want to start the Qemu line in the script as user, the following message comes up: line XX: /dev/tap8: Permission denied

Unfortunately I don't know how to change the permissions accordingly. Can someone point me to the right way?


#2 2022-08-06 05:17:28

Registered: 2022-06-09
Posts: 31

Re: Create and use macvtap in Qemu as user

Can't any of you nice people help me? smile


#3 2022-08-10 13:05:58

From: Netherlands, Europe
Registered: 2005-10-04
Posts: 10,256

Re: Create and use macvtap in Qemu as user

Try running a libvirt VM with a macvtap device attached and post the output of ls -l /dev/ | grep tap .
Maybe that will help to figure out how libvirt does it.

I also think that you should edit the title to reflect you want to run qemu from cli .
I may have given bad advise by recommending kernel & hardware, in hindsight networking seems a better fit

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
Did you use the guided installer ? If yes, I can't help you.

(A works at time B)  && (time C > time B ) ≠  (A works at time C)


#4 Yesterday 16:55:59

Registered: 2016-01-06
Posts: 74

Re: Create and use macvtap in Qemu as user

@treeh0rse: Unfortunately no help from my side, but in case you have found a way to finally accomplish this without libvirt, please post back. I have asked this same question twice on the qemu mailing list, without any reply so far. That was sometime before corona. I just have come so far, that the file descriptor way does not work any more.

I assume, you have used the same link (I have found only one), and that is horribly outdated.

Again, no help here, sorry, but in case you go down the libvirt route, any feedback would be highly appreciated.


#5 Today 16:24:38

Registered: 2022-06-09
Posts: 31

Re: Create and use macvtap in Qemu as user


ls -l /dev/ | grep tap
crw-------   1 root root      509,     1 Aug 15 06:26 tap8

Qemu started from Libvirt runs as user. I will try to find out how Qemu is started from libvirt.

I'll wait a bit and then ask the question again in the other section if necessary, if I can't solve the problem myself.


Thanks for your reply. Yes, I will report here. Nice to know I'm not alone in my concern. It's really strange, I find it a basic functionality from a VM "system" to be able to use a defined network card. VMware and VBox... Simple and no problem.

Qemu from virt-manager works fine and can do everything I want. But Qemu-cli is a very little bit faster. big_smile


Board footer

Powered by FluxBB