VM Created is unable to connect internet by using openvswitch

Front end and node on same machine
–version 5.2

OS-- Ubuntu 14.04 LTS
any how i need to connect vm to internet …no matter to use openvswitch
both vm and host must ping with each other

any thoughts on solution
thank you…

Not 100% sure (by your question) if you want to use Open vSwitch or not but the easiest method is to setup a virtual network connected to a bridge on the host.

That will allow each VM which is deployed on that virtual network in OpenNebula to reach the network as well as ping the host (node).

Here is some information about Debian and network bridges (assuming you use either Ubuntu or Debian as a guest)

Make sure to either provide a dhcp server for the virtual network or setup the correct ip / netmask and gateway manually in the guest.

ok i will try for it and get you soon …
thank you so much for your reply

I created br0 as bridge network and added it the eth0
but by doing this only vm is connected to internet not the host .

thank you…

Okay sounds not too bad yet!

On the host (“the physical machine”) the bridge configuration should look something like this:

# The primary network interface
auto br0
iface br0 inet static
	address 1.2.3.4
	netmask 24
	gateway 1.2.3.1
	dns-nameservers 8.8.8.8
	bridge_ports eth0
	bridge_fd 0

Make sure to change the IP addresses according to your network. In this example I used googles DNS servers which is in most cases a good option.

After editing your interfaces config like stated above you should reboot your server (easiest option). After a reboot, you should be able to connect to the internet from your host (try ping google.com).

In OpenNebula your virtual network may look something like this:

Hi, as Bent_Haase said, you need to configure IP address and gateway on br0 interface, you just copy that from eth0 interface.

And remove the config for the eth0 interface, else wise the server would have two gateways / tries to configure both virtual interfaces on one physical interface.

Thanks a lot… both host and vm are pinging with each other
but when i restart machine each time i have to add br0 with eth0 after configuring interface file with br0 as said by Bent.

thank you once again.

Thank you Sir
both host and vm are pinging with each other .
only thing is that each time after machine restarts i have to add the br0 and eth0
by cammands ( " brctl addbr br0 AND brctl addif br0 eth0").
i have configured the /etc/network/interface file as you said with only br0 .
vm is connected to internet and host isn’t connected
but both are pinging…
thank you once again

What OS are you using? (CentOS 7 ? Ubuntu 16.04.1? Debian? …?)

if you don’t mind, post your /etc/network/interface here.

both vm as well as host are having ubuntu 14.04
and here is my inteface file
interfaces (240 Bytes)

my host IP is 192.168.0.20 …selected manual method for wired connection

Looking all good so far, after a reboot your host should be able to connect to the internet (if your router is configured properly and allows outgoing connections/servers as a gateway).

Your VM connected to the br0 interface should also be able to connect to the internet.

If neither of them is able to connect to the internet, check your router / check if your servers (hosts) IP 192.168.0.20 is not used somewhere else (for example in a VM). I suggest putting the hosts IP on hold in OpenNebulas virtual network settings to avoid it being allocated.

Except that, my setup is working with basically the same settings, host and VM’s being able to interconnect and connect to the internet.