[Top][All Lists]

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

Re: [Qemu-discuss] How to change default network address spacces?

From: Jakob Bohm
Subject: Re: [Qemu-discuss] How to change default network address spacces?
Date: Mon, 07 Jan 2013 12:11:27 +0100
User-agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 1/5/2013 7:23 PM, Tony Su wrote:
Thx Jakob

Explains in part why I can't find any QEMU config files.
Yes, I've been exploring the idea of setting up a "normal" virtual
network as you describe, but am disappointed that I can't modify User
Mode Networking, I assume now that those settings are hard coded
during compilation

Am still unsure whether the command I originally posted was supposed
to work, if there is a bug for the code compiled for my distro or
something else.


On Fri, Jan 4, 2013 at 11:35 AM, Jakob Bohm <address@hidden> wrote:
On 1/4/2013 4:10 PM, Tony Su wrote:
Hello Jakob,

Thx for responding.

Clarifying before I ask elsewhere,

It was my impression that libvirt is only a universal frontend (both gui
and cli) to the underlying virtualization technology. For that reason I
wouldn't expect that libvirt should support all underlying
functionality, and is only an option for managing.

Also, it's my understanding that specific virtualization settings
including network settings are set at the lower virtualization
technology layer, not at the higher libvirt management layer. I don't
think (but could be corrected) that libvirt can make changes that
conflict with the lower virtualization layer, only modify.

Actually, libvirt really tries to override native settings, at least for
qemu.  qemu itself doesn't have a configuration storage, it does what it
is told on the command line and via its "monitor" interface, and forgets
about it when exiting the virtual machine.  libvirtd takes full and mostly
exclusive control of both the command line and the "monitor" interface, so
there is very little that can be done directly to a qemu
virtual machine while it is running under libvirt.

If my reasoning is correct, I really would have expected that modifying
default virtual network settings (including User Mode Networking which
is uniquely QEMU-KVM) should be done using QEMU-KVM commands, not
necessarily libvirt, and indeed I think the command I quoted probably
should be what I want but does not work.

The command you tried didn't "modify default settings", because there are no
modifiable defaults in qemu itself, every run of the virtual machine starts
with a clean slate as far as qemu is concerned.

libvirt uses its own configuration files to simulate the existence of
persistent settings, but those exist only in libvirt itself and thus
cannot be changed from the outside.

If you really cannot find a libvirt feature to set up network the way
you like, there is another way:

1. In the ordinary (non-virtualization) network setup of the host machine,
use the ordinary config files of your Linux distribution
(such as /etc/network/interfaces on Ubuntu and Debian) to create
a "bridge" device with no real network cards as members (you may
or may not need to add a dummy network card as a member).  Configure
that bridge device (not any of its dummy members) with the desired
network settings (IP address, routing on/off, NAT access to the
outside real network, an installed DHCP server etc.)

2. In the libvirt general configuration, "define" that now existing
bridge as a network which virtual PCs can connect to.

3. In virt-manager, configure the virtual machines to use that bridge

4. Now the Hosts Linux kernel will simulate a 10Gb Ethernet switch
connected to the virtual machines and the Host computer.  The virtual
machines can talk to each other and the host like on a normal network,
and can see any servers (such as DHCP servers and NAT routing) on this
network, including those on the Host that are configured to serve the
virtual network.

5. This can easily expand to more bridges if you want to simulate a
network with multiple subnets.

If my assumptions or unerstandings are incorrect, welcome correction.


On Jan 3, 2013 5:28 AM, "Jakob Bohm" <address@hidden
<mailto:address@hidden>> wrote:

     On 1/3/2013 2:13 AM, Tony Su wrote:

     I need to change the default address spaces for virtual networks,
     particularly for User Mode Networking since a network this laptop
     frequently connects to recently changed its address space to the
     A Private Network using the default subnet mask (which means that
     one networkID is supported so no other network also using the Class A
     Private network address space can route.

     System: x64 openSUSE 12.2
     QEMU emulator version 1.1.1 (kvm-1.1.1-1.8.1

     Believe the following command should have changed the address space
     a Class B Private Network, but the command tries to launch an empty
     VM. Have tried running with the libvirtd service running then
     restarting and also stopping the service before running the command,
     and of course also with a reboot.

     # qemu-kvm -net
     All qemu-kvm (and qemu) options need to be on the same command line
     actually runs the virtual machine.

     Since you are using libvirt, you should not (at your skill level) try
     change the command line directly, what youneed to do is change the

     definition used by libvirt using libvirt user interfaces, as a
     libvirt user,
     you canonly use the qemu(-kvm) command line option documentation to

     check what libvirt is passing to qemu.
     Unable to determine my command simply contains a syntax error, or if
     should be running a different command.
     You should be using a different command altogether.  Though I am not
     what the libvirt commandis to redefine the network parameters (I

     find it in my own libvirt-manager GUI, but then I mostly use that for
     simpler tasks these days).  Also, I believe detailed discussion of the
     libvirt commandsand user interface belongs to a different forum/list

     qemu-discuss, so try asking there.
     Note, I have some success creating new virtual networks using
     virt-manager but only if not connected to this problem physical
     network. It seems that if there is a conflict with the default
     spaces, QEMU-KVM networking is rendered inoperable so I need to make
     change to the default address spaces used and make the changes

No, they are not hard coded.

When using "bare qemu", the options you tried should work fine, if you add
 them to the command line that starts you guest OS.

When using libvirt, you need to use the commands listed in the help text

$ virsh help network


Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

reply via email to

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