Why qemu failled to create private network with private virtual bridge? I got "network script /etc/qemu-ifup failed with status 256""
Asked Answered
S

2

8

I want to create one vm on a private network.

I am following this website http://www.linux-kvm.org/page/Networking to help in configuring my qemu.

I used the following command to create a vm:
sudo qemu-system-x86_64 -hda image.qcow2 -enable-kvm -netdev tap,id=tap1 -device rtl8139,netdev=tap1
and I got:
qemu-system-x86_64: -netdev tap,id=tap1: network script /etc/qemu-ifup failed with status 256

I am using arch. I create a bridge: sudo ip link add br0 type bridge

By default, I didn't have file in /etc/qemu-ifup:
So, I created my own, like recommanded on this website http://www.linux-kvm.org/page/Networking:

#!/bin/sh
set -x

switch=br0

if [ -n "$1" ];then
    ip tuntap add $1 mode tap user `whoami`
    ip link set $1 up
    sleep 0.5s
    ip link set $1 master $switch
    exit 0
else
    echo "Error: no interface specified"
    exit 1
fi

I got the same error.
What am I doing wrong?

Edit: I needed to add permission to qemu-ifup. So it works now. Thank Karthik Prasad.

Shulem answered 11/1, 2017 at 10:5 Comment(2)
Hope you've given executable permission to qemu-ifup fileSammie
No. I just tryed with it and it worked. Thank you!Shulem
S
10

I needed to add executable permission to qemu-ifup. So it works now. Thank Karthik Prasad.

Shulem answered 2/3, 2017 at 19:45 Comment(2)
Thanks your question helped me setup network for my qemu virtual machineElectropositive
Glad it helps you!Shulem
S
0

You can also disable using ifup/ipdown scripts and setup the tap network your self.

If you do use something like: -nic tap,ifname=tap0,script=no,downscript=no

Sconce answered 17/11, 2023 at 17:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.