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

Frilox picture Frilox · Jan 11, 2017 · Viewed 7k times · Source

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.

Answer

Frilox picture Frilox · Mar 2, 2017

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