You are not logged in.

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

treeh0rse
Member
Registered: 2022-06-09
Posts: 30

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.

Description:
https://virt.kernelnewbies.org/MacVTap

My story here in the forum:
https://bbs.archlinux.org/viewtopic.php?id=277623


The following script (vmscript.sh) is here:

cat vmscript.sh

# VMimage
hdf="/home/username/arch.qcow2"

# 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:

/usr/bin/sudo vmscript.sh

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:

vmscript.sh: 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?

Offline

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

treeh0rse
Member
Registered: 2022-06-09
Posts: 30

Re: Create and use macvtap in Qemu as user

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

Offline

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

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 10,245

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)

Offline

Board footer

Powered by FluxBB