On 07/25/2016 02:49 AM, Vincent Bernat wrote:
❦ 25 juillet 2016 08:44 CEST, Martin Kletzander
<mkletzan(a)redhat.com> :
>>> "Just a vnet interface, no bridge" means you want no network.
Where
>>> should the vnet be connected?
>> The host is able to handle the routing. It seems I could just declare an
>> interface of type "ethernet" instead of "network" to get the
effect I
>> want.
> I'm sorry, but I have no idea what is the end result you are trying to
> achieve. Could you describe what are your trying to set up without
> libvirt technicalities?
I have a process watching libvirt event to add a route like "ip route
add 192.0.2.147/32 dev vnet18" once the VM is spawned. The host is then
responsible for any routing to/from the VM. I don't want the VM to be
part of a bridge.
Note that once libvirt 2.1.0 is released (just entered freeze
yesterday), you will be able to specify the host-side IP address for the
tap device, as well as any routes to add to the host, right within the
<interface> element, e.g.:
<interface type='ethernet'>
<source/>
<ip address='192.1.2.147' prefix='32'/>
<route family='ipv4' address='192.0.2.147' prefix='32'
gateway='192.1.2.147'/>
<source/>
...
</interface>
This will avoid the need to watch a libvirt event.
(it's interesting that you're apparently adding a route to the tap
device without assigning an IP address to it. I'd never tried that, and
didn't realize it would work.)