[libvirt] Adding ips and routes to type="ethernet" devices

Ruben Kerkhof ruben at rubenkerkhof.com
Tue Jul 19 08:56:34 UTC 2016


Hi Cedric,

On Tue, Jul 19, 2016 at 10:28 AM, Cedric Bosdonnat <cbosdonnat at suse.com> wrote:
> Hi Ruben,
>
> On Mon, 2016-07-18 at 19:48 +0200, Ruben Kerkhof wrote:
> [...]
>
>> I am a bit stuck though. I've created the vm with a tap device:
>>
>>  <interface type='ethernet'>
>>             <mac address='00:1a:4a:1b:d9:cc'/>
>>             <model type='virtio'/>
>>             <rom bar="off"/>
>>             <source>
>>                 <ip address='192.168.42.41' family='ipv4'
>> peer='192.168.42.42' prefix='32'/>
>>                 <route family='ipv4' address='192.168.100.0'
>> prefix='24' gateway='192.168.42.42'/>
>>             </source>
>> </interface>
>>
>> After starting, the link stays down and no ips or routes are being created:
>
> No surprise to me: this feature has been implemented for the lxc driver and
> the qemu driver doesn't care about these config bits.

These are host side ips. Unless I'm misinterpreting this,
this should be supported since:

commit fe8567f6ad0055f38141f473071b30f3fe8df728
Author: Laine Stump <laine at laine.org>
Date:   Tue Jun 21 18:00:45 2016
    qemu: support setting host-side IP addresses/routes
    For type='ethernet' interfaces only.

>
>> root at test1: ~# ip link show dev vnet0
>> 15: vnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode
>> DEFAULT qlen 1000
>>     link/ether fe:1a:4a:1b:d9:cc brd ff:ff:ff:ff:ff:ff
>> root at test1: ~# ip route show
>> default via 10.10.5.1 dev br1010
>> 10.10.5.0/24 dev br1010  proto kernel  scope link  src 10.10.5.2
>> > I feel like I'm missing a step. Who is responsible for setting the
>> link up, it this libvirtd, qemu, or do I need to write a qemu-ifup
>> script?
>
> Qemu has the possibility to set up the ip address directly only with -net nic.
> For a tap device, this has to be handled by qemu-ifup / qemu-ifdown.
>
> --
> Cedric

Is there any reason why libvirt couldn't set the link up?
That would be one less shell-script people have to write.

Kind regards,

Ruben




More information about the libvir-list mailing list