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

Hi all, I've been playing with the recently added support for adding ips and routes to a type"ethernet" kind of device. My goal is to get rid of bridging and use host routes (/32) combined with Bird for a pure layer3 setup. Something similar to what https://www.projectcalico.org/ is doing Instead of p2p addresses with peers they use device routes (ip route add 192.168.0.1/32 dev vnet0) combined with static arp entries. 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: root@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@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? Any help is greatly appreciated. Kind regards, Ruben Kerkhof

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.
I feel like I'm missing a step. Who is responsible for setting the
root@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@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 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

Hi Cedric, On Tue, Jul 19, 2016 at 10:28 AM, Cedric Bosdonnat <cbosdonnat@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@laine.org> Date: Tue Jun 21 18:00:45 2016 qemu: support setting host-side IP addresses/routes For type='ethernet' interfaces only.
I feel like I'm missing a step. Who is responsible for setting the
root@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@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 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
participants (2)
-
Cedric Bosdonnat
-
Ruben Kerkhof