[libvirt-users] Basic Network Connections

Hi, If I have these fragments in a domain definition, the guest will start with "eth0" assigned by dhcp to an address on my lan. Things seem to work according to the documentation I can find. <network> <name>direct-macvtap</name> <forward mode='bridge'> <interface dev='eth0' /> </forward> </network> <devices> <interface type='direct'> <mac address='00:15:17:A6:BC:C9' /> <source dev='eth0' mode='bridge' /> <model type='virtio' /> </interface> </devices> I don't understand the <network> part here. It doesn't seem to be documented. I inherited these pieces so I do not know why they are as they are. If, instead, I have the following, the guest comes up with no network interface at all (except lo). On the host, interfaces vnet0 and virbr0 exist and virbr0 is 192.168.122.1. <devices> <interface type='network'> <source network='default'/> </interface> </devices> Adding in <model type='virtio' /> makes it start with "eth0", but no address has been assigned. I can manually do that and then I can communicate with the host but it's kind of a pain to add the address and routing manually. Oddly enough, though, ping from host to guest works normally, but ping guest to host seems to succeed once then hang (with no timeout). It is not at all obvious to me how virtio magically creates eth0. Am I doing something wrong, here? And, if anyone could advise how to use openvswitch I'd appreciate it. I've seen adding <virtualport type='openvswitch/> might be enough, presumably with an appropriate name for the source network. Joe

Hi. I guess the best way to proceed here is to explain a little bit how do you want your networking setup. You csn have a subnet for VM's and Hypervisor, you can have NAT, you can have bridge. Do you want to leave IP addresses and routes to Operating System or do you prefer to leave it to KVM? Regards. Javier El 27/04/2013 18:05, "Slater, Joseph" <joe.slater@windriver.com> escribió:
Hi,****
** **
If I have these fragments in a domain definition, the guest will start with "eth0"****
assigned by dhcp to an address on my lan. Things seem to work according to the documentation****
I can find.****
** **
<network>****
<name>direct-macvtap</name>****
<forward mode='bridge'>****
<interface dev='eth0' />****
</forward>****
</network>****
<devices>****
<interface type='direct'>****
<mac address='00:15:17:A6:BC:C9' />****
<source dev='eth0' mode='bridge' /> ****
<model type='virtio' />****
</interface>****
</devices>****
** **
I don't understand the <network> part here. It doesn't seem to be documented. I inherited these pieces****
so I do not know why they are as they are.****
** **
If, instead, I have the following, the guest comes up with no network interface at all****
(except lo). On the host, interfaces vnet0 and virbr0 exist and virbr0 is 192.168.122.1.****
** **
<devices>****
<interface type='network'>****
<source network='default'/> ****
</interface>****
</devices>****
** **
Adding in****
** **
<model type='virtio' />****
** **
makes it start with "eth0", but no address has been assigned. I can manually do that and then****
I can communicate with the host but it's kind of a pain to add the address and routing manually.****
Oddly enough, though, ping from host to guest works normally, but ping guest to host seems to succeed once****
then hang (with no timeout).****
** **
It is not at all obvious to me how virtio magically creates eth0.****
** **
Am I doing something wrong, here? And, if anyone could advise how to use openvswitch****
I'd appreciate it. I've seen adding****
** **
<virtualport type='openvswitch/>****
** **
might be enough, presumably with an appropriate name for the source network.****
** **
Joe****
** **
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

Hi Javier, I got guest networking going in 3 modes -- "direct", "default network", and "openvswitch bridge". Most of the issues turned out to be in getting dhcp addresses assigned. Things like having to add ip=dhcp to cmdline sometimes and specifying <model type='virtio'/> interfering with dhcp sometimes. Joe
-----Original Message----- From: javilegido@gmail.com [mailto:javilegido@gmail.com] On Behalf Of Javi Legido Sent: Saturday, April 27, 2013 11:52 AM To: Slater, Joseph Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] Basic Network Connections
Hi.
I guess the best way to proceed here is to explain a little bit how do you want your networking setup. You csn have a subnet for VM's and Hypervisor, you can have NAT, you can have bridge. Do you want to leave IP addresses and routes to Operating System or do you prefer to leave it to KVM?
Regards.
Javier
El 27/04/2013 18:05, "Slater, Joseph" <joe.slater@windriver.com> escribió:
Hi,
If I have these fragments in a domain definition, the guest will start with "eth0"
assigned by dhcp to an address on my lan. Things seem to work according to the documentation
I can find.
<network>
<name>direct-macvtap</name>
<forward mode='bridge'>
<interface dev='eth0' />
</forward>
</network>
<devices>
<interface type='direct'>
<mac address='00:15:17:A6:BC:C9' />
<source dev='eth0' mode='bridge' />
<model type='virtio' />
</interface>
</devices>
I don't understand the <network> part here. It doesn't seem to be documented. I inherited these pieces
so I do not know why they are as they are.
If, instead, I have the following, the guest comes up with no network interface at all
(except lo). On the host, interfaces vnet0 and virbr0 exist and virbr0 is 192.168.122.1.
<devices>
<interface type='network'>
<source network='default'/>
</interface>
</devices>
Adding in
<model type='virtio' />
makes it start with "eth0", but no address has been assigned. I can manually do that and then
I can communicate with the host but it's kind of a pain to add the address and routing manually.
Oddly enough, though, ping from host to guest works normally, but ping guest to host seems to succeed once
then hang (with no timeout).
It is not at all obvious to me how virtio magically creates eth0.
Am I doing something wrong, here? And, if anyone could advise how to use openvswitch
I'd appreciate it. I've seen adding
<virtualport type='openvswitch/>
might be enough, presumably with an appropriate name for the source network.
Joe
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

On 04/26/2013 02:41 PM, Slater, Joseph wrote:
Hi,
If I have these fragments in a domain definition, the guest will start with "eth0"
assigned by dhcp to an address on my lan. Things seem to work according to the documentation
I can find.
<network>
<name>direct-macvtap</name>
<forward mode='bridge'>
<interface dev='eth0' />
</forward>
</network>
<devices>
<interface type='direct'>
<mac address='00:15:17:A6:BC:C9' />
<source dev='eth0' mode='bridge' />
<model type='virtio' />
</interface>
</devices>
I don't understand the <network> part here. It doesn't seem to be documented. I inherited these pieces
so I do not know why they are as they are.
The <network> part shouldn't be in the domain's XML. It should be used to separately define a libvirt network. Put that part in "direct.xml" (for example) and run: virsh net-define direct.xml virsh net-autostart direct-macvtap virsh start direct-macvtap However, your <interface> definition isn't even using that network; it's specifying the macvtap connection directly (with <source dev='eth0' mode='bridge'/>) so the network definition isn't even needed. (btw, the <network> xml is documented here: http://www.libvirt.org/formatnetwork.html )
If, instead, I have the following, the guest comes up with no network interface at all
(except lo). On the host, interfaces vnet0 and virbr0 exist and virbr0 is 192.168.122.1.
<devices>
<interface type='network'>
<source network='default'/>
</interface>
</devices>
Adding in
<model type='virtio' />
makes it start with "eth0", but no address has been assigned. I can manually do that and then
I can communicate with the host but it's kind of a pain to add the address and routing manually.
That could be caused by one of the problems described here: http://wiki.libvirt.org/page/PXE_boot_%28or_dhcp%29_on_guest_failed In general, take a look at http://wiki.libvirt.org/page/Troubleshooting
Oddly enough, though, ping from host to guest works normally, but ping guest to host seems to succeed once
then hang (with no timeout).
It is not at all obvious to me how virtio magically creates eth0.
Am I doing something wrong, here? And, if anyone could advise how to use openvswitch
I'd appreciate it. I've seen adding
<virtualport type='openvswitch/>
might be enough, presumably with an appropriate name for the source network.
(you're really jumping all over the place here :-) You need a new enough version of libvirt to support openvswitch (at least 0.9.11, or 0.10.0 if you're using vlans), as well as a new enough kernel, and you need to have the openvswitch package(s) installed. There are several guides for doing this. Here's one that came up on Google: http://blog.scottlowe.org/2012/11/07/using-vlans-with-ovs-and-libvirt/
participants (3)
-
Javi Legido
-
Laine Stump
-
Slater, Joseph