Hi,
I try to configure a kvm with a NIC, but no attached network to this
NIC.
I tried following methods:
1. Create a generic ethernet connection
I configured the VM with following interface section:
<interface type='ethernet'>
<script path='/root/noscript.sh'/>
<target dev='myvm_nic0'/>
<interface/>
The script /root/noscript.sh exists and is executable and has only an
exit 0 statement. When I try to start the VM, virsh aborts with
following error:
error: Failed to start domain myvm
error: internal error process exited while connecting to monitor:
qemu-kvm: -netdev tap,script=/root/noscript.sh,id=hostnet1: could not
configure /dev/net/tun (tap%d): Operation not permitted
qemu-kvm: -netdev tap,script=/root/noscript.sh,id=hostnet1: Device 'tap'
could not be initialized
The tun module is loaded and I can create tap devices with tunctl. So
there might be no problem...
2. I configurerd a network with no forward element.
I've defined and started following network on the host with virsh
net-define / net-start
<network>
<name>myvm_isolated</name>
<bridge name='virbr_myvm_1' />
</network>
The documentation says: "If there is no forward element, the network
will be isolated from any other network (unless a guest connected to
that network is acting as a router, of course)."
The interface configuration of the domain was this:
<interface type='network'>
<mac address='00:12:67:bb:bb:11'/>
<source network='myvm_isolated'/>
<model type='e1000'/>
</interface>
The VM starts as expected. But the interface is connected to an host
bridge like a NAT interface. There is a DHCP server in the network and
the VM gets an IP Address and can ping and ssh to the VM-Server...
I used following version of libvirt and qemu on SuSE Enterprise Linux
Server SP2:
# virsh version
Compiled against library: libvir 0.9.6
Using library: libvir 0.9.6
Using API: QEMU 0.9.6
Running hypervisor: QEMU 0.15.1
Can you please tell me how to configure a not connected (isolated)
network interface card for my VM?
Regards,
Christian