qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] virt-install and bridged interfaces


From: Dan MacDonald
Subject: Re: [Qemu-discuss] virt-install and bridged interfaces
Date: Wed, 29 Nov 2017 22:20:53 +0000

Hi Don

It seems you misread my question. I already have bridged networking
working under qemu. I'm trying to use virt-install to import the image
into virt so that I can manage it using virsh and virt-manager. The
command line arguments used by virt-install differ greatly from those
used by qemu but I'm hoping that someone on this list is fluent in
translating between the two or might know why I could be having issues
with this process (under Ubuntu 17.10).

I've also tried a network.xml config like this:

<network connections='1'>
  <name>hostbridge</name>
  <uuid>d0e9964a-f91a-40d0-b769-a609aee41bf2</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:60:f8:6e'/>
  <ip address='192.168.143.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.143.2' end='192.168.143.254'/>
    </dhcp>
  </ip>
</network>

and importing it like so:

virt-install -n centos6test -r 1024 --disk
/home/dan/PackerTest/output_centos6test/c6test,device=disk,bus=virtio
--network=network:hostbridge --vnc --noautoconsole --import

(note the different format used in the network switch)

but that hasn't worked for me either. The bridged guest net interface
never gets assigned an address after importing into virt but it works
fine under qemu.

Thanks

Dan

On Wed, Nov 29, 2017 at 12:14 PM, Donald R Laster Jr
<address@hidden> wrote:
>
> Dan MacDonald wrote on 11/28/2017 01:57 PM:
>>
>> Hi qemu list
>>
>> I have a CentOS 6 disk image I created with Packer which I would like
>> to use with a network manager bridged network interface (virbr0) under
>> libvirt/KVW/qemu.
>>
>> I can run the image under qemu/KVM with working bridged networking
>> using a command such as this:
>>
>> qemu-system-x86_64 -enable-kvm -cpu host -m 1024 -net nic,model=virtio
>> -net bridge,br=virbr0,helper=/usr/lib/qemu/qemu-bridge-helper -drive
>> file=c6test,if=virtio
>>
>> Despite the two -net options used, only one net interface is present
>> on the VM and it gets assigned a local IP which I can ping from my
>> host. This is what I'm hoping to achieve but I have not been able to
>> so far when importing the image into libvirt using virt-install. I
>> have been trying many variations upon a command like this:
>>
>> virt-install -n centos6test -r 1024 --connect qemu:///system
>> --os-type=linux --cpu host --os-variant=rhel6 --disk
>> /home/dan/PackerTest/output_centos6test/c6test,device=disk,bus=virtio
>> --network bridge=virbr0 --vnc --noautoconsole --import
>>
>> I have also tried defining a bridged network with virsh, like so:
>>
>> <network>
>>    <name>hostbridge</name>
>>    <forward mode="bridge"/>
>>    <bridge name="virbr0"/>
>> </network>
>>
>>
>> Then importing that with `virsh net-define` and setting the network
>> device to use that virsh network. I've also tried using two net
>> devices, one bridged and one not etc etc but nothing has worked for me
>> so far in that none of the interfaces ever get assigned an address
>> after being imported into libvirt and started with virt-install whilst
>> everything works fine if I just run the image with the first qemu
>> command I gave.
>>
>> I would like to be able to control my VM with virsh but this issue is
>> stopping me. I'm running Ubuntu 17.10 on the host.
>>
>> Thanks for your help
>>
>> Dan
>>
>
> Dan,
>
>   You may need to add a second set of this command set:
>
>         -net nic,model=virtio
>         -net bridge,br=virbr0,helper=/usr/lib/qemu/qemu-bridge-helper
>
> On my systems that run the VMs when I want two Ethernet device I have the
> following:
>
>         -net nic,macaddr=52:54:00:10:01:2E,vlan=0,model=e1000
>         -net tap,vlan=0,helper=/usr/libexec/qemu-bridge-helper
>
>         -net nic,macaddr=52:54:00:10:01:23,vlan=0,model=e1000
>         -net tap,vlan=0,helper=/usr/libexec/qemu-bridge-helper
>
> I am still running an older version of QEMU since it is doing everything I
> need without any problems so the "-net tap" might not be correct for what
> you are doing.  So I would try the following:
>
>         -net nic,model=virtio
>         -net bridge,br=virbr0,helper=/usr/lib/qemu/qemu-bridge-helper
>
>         -net nic,model=virtio
>         -net bridge,br=virbr0,helper=/usr/lib/qemu/qemu-bridge-helper
>
> when you start the VM (yes, a duplicate of the -net commands).
>
>   Depending upon your environment setting the MAC address might be useful as
> well.  The MAC address prefix of 52:54:00 in the options above were selected
> based what was being used in a virtual machine environment that supposedly
> does not conflict with physical/real hardware MAC addresses 4 or 5 years
> ago.  The last 3 octets of the MAC correspond to the last 3 octets of the
> intended IPv4 address of the network interface inside of the VM.  It helps
> prevents any potential conflicts with MACs being generated on the systems
> running VMs.
>
>   A quick check has indicated the prefix 52:54:00 is used by
> "Realtek/Uptech?" so you might want to use a different prefix.  A check at
> https://code.wireshark.org indicates 00:00:6C, 00:01:01, and 00:05:78 are 3
> of around 250 or so private MAC address prefixes (word Private in the list).
>
>   But I do believe you need to add the second "-net nic" set of options.
>
>    Don



reply via email to

[Prev in Thread] Current Thread [Next in Thread]