[libvirt] [PATCH] lxc: support <interface type='ethernet'>

Vasiliy Tolstov v.tolstov at selfip.ru
Wed May 25 12:58:08 UTC 2016

2016-05-24 19:33 GMT+03:00 Laine Stump <laine at laine.org>:
> So ignoring the IPv6 addresses for now. You now have a tap device on the
> *host* that has the following IP addresses:
>         $HOST_IP peer $VM_IP/32
>         $VM_GW
> I'm guessing that in the guest you configure its ethernet to have
>            $VM_IP peer $HOST_IP/24   (or some other prefix < 32)
>           route add default $VM_GW   ($VM_GW on same subnet as $HOST_IP/24)

No, inside guest i'm assign address via dhcp to  $VM_IP/24 (not using peer)
and  route add default $VM_GW

peer only used on host machine to determine on which interface kernel
needs to send traffic

> (I'm not sure what the guest does with
> What if you instead set the host to:
>         $HOST_IP peer $VM_IP/32
> and set the guest to:
>         $VM_IP peer $HOST_IP/32
>         route add default $HOST_IP
> ??

I don't use this scheme... If i set $VM_IP peer $HOST_IP/32 on host
machine i think kernel recieves packet and drop it =)

> Anyway, it's important to know if you set the IP config on host and guest to
> exact mirrors of each other. It seems like the answer is "no", though, so
> i'm going to make a patch that allows what I was talking about last week:
>        <interface type='ethernet'>
>           <source>
>             <ip address='HOST_IP' family='ipv4' peer='VM_IP' prefix='32'/>
>             <ip address='VM_GW' family='ipv4' prefix='32'/>
>           </source>
>           <ip address='VM_IP' family='ipv4' peer='HOST_IP' prefix='24'/>
>           <route family='ipv4' address='' gateway='HOST_IP'/>
>           ...
>       </interface>
> On qemu only the address info inside <source> would be used, since we don't
> have control over the guest's network config. On LXC, we can set both.
> Does that sound usable?

Yes, but don't cleanup please  <ip address='VM_IP' family='ipv4'
peer='HOST_IP' prefix='24'/> in qemu case, because on somedays we can
launch dnsmasq or orhet software that can provide dhcp and use this

Vasiliy Tolstov,
e-mail: v.tolstov at yoctocloud.net

More information about the libvir-list mailing list