[kwlug-disc] Networking on libvirt vs. VirtualBox

Khalid Baheyeldin kb at 2bits.com
Fri Aug 1 13:46:50 EDT 2014


I found a partial solution by adding the following to the host's
/etc/networking/interfaces

auto br0iface br0 inet dhcp        bridge_ports eth0        bridge_stp
off        bridge_fd 0        bridge_maxwait 0

Then use this snippet on the virt-install command line.

--network bridge=br0


However, it still requires sudo to run virt-install, which is unnecessary,
and causes side effects (e.g. the disk image is not owned by the regular
user, rather owned by libvirt-qemu:kvm).

Is there a trick for getting bridging (and virt-install, and virsh, ..etc.)
to work with pure non-root? E.g. adding my user to a group for example?






On Fri, Aug 1, 2014 at 12:27 PM, Khalid Baheyeldin <kb at 2bits.com> wrote:

> On VirtualBox, I was able as non-root to get bridged networking by doing:
>
> vboxmanage createvm --name p1 --ostype Ubuntu_64 --register
> vboxmanage modifyvm p1  ... --nic1 bridged --bridgeadapter1 eth0
> --nictype1 82543GC
>
> And that provided me functional two-way networking, assigning a new IP
> address from the router, and allows incoming and outgoing networking
> transparently.
>
> On KVM, I did:
>
> virt-install --name p1 --ram 512 --disk path=~/p.img,size=2 --cdrom
> ./media/precise64/ubuntu-12.04.4-server-amd64.iso --boot cdrom --network
> bridge=eth0
>
> That would not work because it requires root (VirtualBox worked without
> sudo).
>
> So, I need to use sudo before that command. But when I do this, I get the
> error:
>
> ERROR    Unable to add bridge eth0 port vnet0: Operation not supported
>
> Googling for that error suggests that this command should fix it:
>
> virsh iface-bridge eth0 br0
>
> But it does not work, with or without sudo, with the following error:
>
> error: failed to get interface 'eth0'
> error: this function is not supported by the connection driver:
> virInterfaceLookupByName
>
> So, the question is, using libvirt and kvm, how does one get bridged
> networking to work?
> --
> Khalid M. Baheyeldin
> 2bits.com, Inc.
> Fast Reliable Drupal
> Drupal optimization, development, customization and consulting.
> Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
> Simplicity is the ultimate sophistication. --   Leonardo da Vinci
> For every complex problem, there is an answer that is clear, simple, and
> wrong." -- H.L. Mencken
>



-- 
Khalid M. Baheyeldin
2bits.com, Inc.
Fast Reliable Drupal
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
For every complex problem, there is an answer that is clear, simple, and
wrong." -- H.L. Mencken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20140801/cff3c6f6/attachment.htm>


More information about the kwlug-disc mailing list