2

I was following the directions here to set up a VM in CentOS 6.4 i386/686. But I'm getting this error:

$ sudo virt-install --network-bridge:br0 --name vm1 --ram=1024 --vcpus=1 --disk path=/var/lib/libvirt/images/vm1.img,size=10 --cdrom ~/winxp.iso
Usage: virt-install --name NAME --ram RAM STORAGE INSTALL [options]

virt-install: error: no such option: --network-bridge:br0

Sure enough, virt-install --help doesn't list that as an option. But it also doesn't list --cdrom, --disk...

Does it mean I didn't set up br0 right? (I followed the guide pretty closely. I wasn't sure how to verify that what it's looking for is present.)

I ought to specify, I have no GUI installed--used the 'minimal' ISO.

UPDATE

$ sudo -i brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.0040caab50b8       no              eth0
virbr0          8000.525400dfd8ac       yes             virbr0-nic

Maybe I don't understand--I thought a VM needed an OS to be created? Or I guess you create the VM, and it's pretending to be bare metal, and then you can go into the VM and tell it to use a CD ISO as the CD drive, and install the OS from there?

So at this point with your modified XML file and restarted libvirtd, I have KVM running and vm1 running on it, ready to have an OS installed?

The thing is, virt-install still gives this error. IMO it for some reason doesn't have the switch named --network-bridge built into it, but I have no idea why that would be. Wrong version? Compiled without an option? I forgot to install a dependency of some kind? These all seem improbable to me, I thought network bridging is pretty standard for a VM, hence my posting a question here in the first place. :) Sorry if I'm babbling but I'm really just stuck on the virt-install command step.

1
  • see my comments in my answer, the switch you're using, --network-bridge:br0 should be --network bridge:br0.
    – slm
    Jul 11, 2013 at 15:52

1 Answer 1

1

typo

I see no reference to --network-bridge when I search either the URL you reference to the PDF nor the original that the PDF derives from. Fixing the switch to virt-install should resolve your issue. Here's the example from the documentation that I believe you're using:

# virt-install \
--network bridge:br0 \
--name vm1 \
--ram=1024 \
--vcpus=1 \
--disk path=/vm-images/vm1.img,size=10 \
--graphics none \ 
--location=http://my.server.com/pub/rhel6.1/install-x86_64/ \
--extra-args="console=tty0 console=ttyS0,115200"

Other methods for setting up the network

Below are other ways that the bridge device can be created for a VM instead of using virt-install.

virt-manager

You can create the br0 network prior to spinning up VM's that use it. See here:

    ss of virt-manager

virsh

If you don't have access to a GUI or can't remote display virt-manager to another system that does you can create a network device using the command line tool, virsh.

First add the eth0 network device to the bridge, br0, by editing the file /etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0
BRIDGE=br0
BOOTPROTO=none
HWADDR=[[your mac address]]
ONBOOT=yes
USERCTL=yes
PEERDNS=yes
NM_CONTROLLED=no

Then create the file /etc/sysconfig/network-scripts/ifcfg-br0 and add the following:

DEVICE=br0
ONBOOT=yes
BOOTPROTO=dhcp 
TYPE=Bridge
PEERNTP=yes

Next restart the network:

$ sudo service network restart

Now create a libvirt VM config /etc/libvirt/qemu/<vmname>.xml and add the following to it:

<interface type='bridge'>
  <mac address='11:22:33:44:55:66'/>
  <source bridge='br0'/>
  <model type='virtio'/>
</interface>

Now you can start up libvirtd, and the VM, you should see the br0 network when you run this command:

$ sudo -i brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.bcaec534c9e8   no      vnet5
                            vnet4
                            vnet3
                            vnet2
                            vnet1
                            vnet0
                            eth0
virbr0      8000.000000000000   yes     
7
  • @Kev - yes if you don't have a GUI, you can use the command virsh to do things with KVM. Check out the man page, man virsh.
    – slm
    Jul 11, 2013 at 1:13
  • 1
    @Kev - sorry it's a bit confusing. Without using the GUI virt-manager it's a bit of a trial by committee and you have to use a couple of tools to do the work. virsh is used mainly to make modifications to the VM's config file, as I've described above.
    – slm
    Jul 11, 2013 at 1:40
  • sorry & thanks for letting me know. I'll post an update in the question.
    – Kev
    Jul 11, 2013 at 15:02
  • 1
    @Kev - I just reread your comments about the switch, --network-bridge, I don't have that switch in my version of virt-install on CentOS 5.8. My virt-install is part of this package, python-virtinst, version 0.400.3-13.el5.
    – slm
    Jul 11, 2013 at 15:15
  • Weird that that Dell guide mentions it, eh? Oh you know what, I just figured it out. Thanks for your help though.
    – Kev
    Jul 11, 2013 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .