# ip link show dev tap037: tap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 500
link/ether d2:b0:af:7b:23:0f brd ff:ff:ff:ff:ff:ff
如果想和外界通信,可以手动执行生效,如下所示当前与br0桥接的设备,并没有tap相关的网卡
12345
# brctl show br0bridge name bridge id STP enabled interfaces
br0 8000.b8975a626020 no eth0
vnet0
vnet1
我们需要把tap0也桥接到br0下以便和外界通信,方法如下
12345678
# ip link set tap0 up //使tap0状态变为up# brctl addif br0 tap0 //桥接tap0到br0# brctl show br0 bridge name bridge id STP enabled interfaces
br0 8000.b8975a626020 no eth0
tap0
vnet0
vnet1
# cat /tmp/qemu-ifup.sh #!/bin/bash# 桥接网络设备switch=br0
if[ -n $1]; then //$1为qemu-kvm传递值,这里是tap
ip link set$1 up
brctl addif ${switch}$1exit 0
elseecho"no interface!"exit 1
fi