1

my vm is centos 4.8 and it came from a physical server. All is great except I can't seem to get bridged networking working. The default user mode networking is fine, from the guest I can reach the internet but I want to bridge so the host can see the guest.

I've read some docs about it but it feels like I'm missing the big picture and am getting confused. Am I setting up the bridge network interface on the host? And what role does the config files in /etc/libvirt play? I see that when I use the virtual machine manager, it adds xml files there but what about the network interface stuff. Is that modifying the host system when the libvirt service starts?

1 Answers1

1

The bridge network interface is setup on the host computer. When you use bridging the guest network interface uses the host bride interface. The .xml files in /etc/libvirt/qemu define the VM, and therefore play an all important role. If you are using bridging, there should be lines similar to:

<interface type='bridge'>
  <mac address='52:54:00:87:d2:f4'/>
  <source bridge='br0'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

I do not use virt manager, but this and this might help you.

Doug Smythies
  • 15,448
  • 5
  • 44
  • 61
  • Thanks for the reply. This is a confusing topic because you have addons like bridge helper and bridge utils, plus libvirt doing things for you as well as docs which step you through using -net and more recent ones saying -net is obsoleted. I'm looking for the command line syntax, here's what I have: – Bob Frank Dec 06 '15 at 17:04
  • here's what I have: kvm -m 4096 -hda sda.img -device e100,netdev=net0 -netdev tap,id=net0. I don't know what I'm doing there. I have a bridge interface br0 setup on host and working, tied to eth0. – Bob Frank Dec 06 '15 at 17:11
  • Oh and I did get this working in libvirt but I want to do this from shell and then turn it into a script for turning my machine on and off. I'm trying not to use libvirt – Bob Frank Dec 06 '15 at 17:13
  • Did you consider to do a virt-install of your disk image and thereafter just use virsh start vname to start it? You could use virsh shutdown vname to turn it off, but it would make more sense to shutdown the VM from within the VM itself. Have a look at the basic command here – Doug Smythies Dec 06 '15 at 18:11
  • I got it solved. Thanks for the hints. So final script that works for me is kvm -m 4096 -hda sda.img -device e1000,netdev=net0 -netdev=tap,id=net0. Prior to this I set up bridging on host as described here: https://help.ubuntu.com/community/BridgingNetworkInterfaces – Bob Frank Dec 06 '15 at 18:28