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

Cedric Bosdonnat cbosdonnat at suse.com
Tue Jul 19 08:28:30 UTC 2016


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.

> 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
> 




More information about the libvir-list mailing list