linux kvm qemu network bridge tap configure

  1. userspace network : -net nic,model=virtio,macaddr=xx-xx-xx-xx-xx -net user
  2. bridge network: -net nic,xxxx -net -tap

Kvm network bridge tap

  1. edit /etc/network/interfaces
    Install :
    sudo apt-get install bridge-utils uml-utilities
auto lo
iface lo inet loopback

#auto eth0
#iface eth0 inet dhcp
# add by hz 

auto waln0
iface wlan0 inet dhcp

auto br0
iface br0 inet dhcp
    bridge_ports eth0
    bridge_stp off
    bridge_maxwait 0
    bridge-fd 0

  1. edit /etc/qemu-ifup
ip=$(which ip)

if [ -n "$ip" ]; then
   ip link set "$1" up
else
   brctl=$(which brctl)
   if [ ! "$ip" -o ! "$brctl" ]; then
     echo "W: $0: not doing any bridge processing: neither ip nor brctl utility not found" >&2
     exit 0
   fi
   ifconfig "$1" 0.0.0.0 up
fi

switch=$(ip route ls | \
    awk '/^default / {
          for(i=0;i

you can follow this link to get it

Start the KVM

kvm -smp 4 -m 2048 -name f15 -drive file=~/cn_winxp_pro_sp3_x32.4G.qcow2,if=virtio -vga qxl  -net nic,model=virtio,macaddr=00-11-22-33-55-44 -net tap  -localtime -soundhw es1370 -spice port=5900,addr=192.168.3.148,disable-ticketing

你可能感兴趣的:(linux,kvm,qemu,network,tap)