set tap0 using virt-manager for bridged wireless

DaveO asked:

After 3 days I finally have kvm guests working on the network via wireless (link below – thanks!):

My network is 192.168.1.0/24

on the host:

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo tunctl -t tap0
sudo ip link set tap0 up
sudo ip addr add 192.168.1.25/24 dev tap0
sudo route add -host 192.168.1.30 dev tap0
sudo parprouted wlan0 tap0

on the guest:

auto eth0
iface eth0 inet static
  address 192.168.1.30
  netmask 255.255.255.0
  network 192.168.1.0
  broadcast 192.168.1.255
  gateway 192.168.1.25

and start the guest:

sudo kvm /path/to/guest.img -net nic,macaddr=DE:AD:BE:EF:90:26 -net tap,ifname=tap0,script=no

This works great and I can ping the local network and the internet back and forth between the guest.

But how do I add these settings to the guest’s xml config so I can start the guest via virt-manager with the same nic settings?

ref:

My answer:


What’s wrong with using macvtap? This is completely painless and doesn’t require any further configuration on the host.

macvtap selection in virt-manager


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.