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
network;
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.
Tsu
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:
Hello,
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
Class
A Private Network using the default subnet mask (which means that
only
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
to
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
user,net=176.27.0.0/12,host=176.27.2.2,dhcpstart=176.27.0.20
<http://176.27.0.0/12,host=176.27.2.2,dhcpstart=176.27.0.20>
All qemu-kvm (and qemu) options need to be on the same command line
that
actually runs the virtual machine.
Since you are using libvirt, you should not (at your skill level) try
to
change the command line directly, what youneed to do is change the
network
definition used by libvirt using libvirt user interfaces, as a
libvirt user,
you canonly use the qemu(-kvm) command line option documentation to
double
check what libvirt is passing to qemu.
Unable to determine my command simply contains a syntax error, or if
I
should be running a different command.
You should be using a different command altogether. Though I am not
sure
what the libvirt commandis to redefine the network parameters (I
cannot
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
than
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
address
spaces, QEMU-KVM networking is rendered inoperable so I need to make
a
change to the default address spaces used and make the changes
persistent.