Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

My network is

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 dev tap0
sudo route add -host dev tap0
sudo parprouted wlan0 tap0

on the guest:

auto eth0
iface eth0 inet static

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?


share|improve this question
Wonderful! Worked great for me too! Thank you very much for this great tip! – Avio Jul 17 '12 at 12:00

I think you are trying to setup bridged networking in a round-about way by creating tap devices etc. In Linux you can create a virtual bridge device for a physical interface using simple configuration changes. Once done the KVM VMs can be configured to use this virtual bridge device to connect to normal LAN as if they were directly connected to it. It gives illusion that all VMs and base/host machine are all connected to LAN directly.

If that is what you want then modify your /etc/sysconfig/network-scripts/ifcfg-eth0 (assuming eth0 is the host network device having IP in network in your case) to have lines


among other configuration lines. Copy ifcfg-eth0 to ifcfg-br0 where ifcfg-br0 should differ from ifcfg-eth0 in below mentioned lines


Now when you use 'service network restart' you will have to network interfaces br0 and eth0 and your LAN IP in range would seem to be assigned to br0. Now all you have to do is to edit VM settings and ask it to connect using br0 network.

share|improve this answer
thanks Saurabh, but this round-about way is because wireless interfaces don't support normal bridging, like you would with a wired eth0 interface. – DaveO Nov 2 '10 at 9:33
Oops! My bad. Was not aware that bridging does not works for wireless interfaces as they do for wired. – Saurabh Barjatiya Nov 7 '10 at 4:59
Instead of bridging. You can also setup complete wireless network with its own DHCP and use some unused private IP range. Then to make this wireless network connect outside you can use source/destination NAT on machine which has both wireless and wired connection. If wireless VMs wont have any servers then only source PAT would do. If it is necessary to connect to wireless VMs from rest of the network then source and destination NAT combo should do. – Saurabh Barjatiya Nov 12 '10 at 13:19

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

share|improve this answer
Macvlan / macvtap is great for wired interfaces but it seems to not work on wireless interfaces, based on my own experience and experience read online. – lgaggini Nov 14 '13 at 11:05
@lgaggini You can't bridge to wireless interfaces because the AP will reject the MAC addresses of the virtual machines. In that case you just do something else. – Michael Hampton Nov 14 '13 at 13:03

try to follow this: libwirtwiki - guest tap

and fix /etc/libvirt/qemu/example.xml

<interface type='ethernet'>
  <mac address='26:c7:a9:96:a7:7a'/>
  <target dev='tap0'/>
  <model type='virtio'/>
  <script path='no'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

in my case it works

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.