Add ip address to VM

Hi, I have created a new VM. How to add ip address to that VM? So I can ping from VM OS terminal to my physical system ip (I am experimenting in standalone system).

Cloud you please provide some more details?
What OS is your VM? Are you trying to set a static address to get one through DHCP? Do you have the context package installed in the VM?

What have you already tried?

Please provide version numbers of software where relevant

Thanks Morgan for replying.
I want a static ip address. My physical OS is ubuntu 16.04. For time being my VM OS is tty linux(I tried with ubuntu-16.04 for VM OS, but in VNC mood it is showing “No Bootable Device”, so I tried with tty linux). I’m using Opennebula 5.6.2.

You need to do the following:

  • Ensure that the Ubuntu Context Package is installed on your VM template
  • Define you static IP address (or a range of addresses) in your Virtual Network in OpenNebula, under the Addresses tab
  • When creating the VM from a template (depending on your configuration this must be done through the admin interface, not the cloud interface), open up the “Network” section, open up the adaptor, and then enter the IP you want in the “Force IP”. The IP you use must be in the address range you set for that network.

Thank you for replying.
Now, ip is assigned to my VM OS, using the method you told. But one issue is there : From my VM OS it’s not pinging to my physical system ip address and vice-versa.

I know this is an old topic, but I would like to achive the same (set IP address inside a VMWare VM, set hostname maybe)
I have set up the IP range in virtual network already and forced the IP address too. I think I’m missing this “Context Package” could you please a bit more specific, which package do I need to install to ubuntu? Or to CentOS 7? Is there a documentation about this, which packages do I need to install and which configuration steps need to take? I found the documentation for the netwroking setup on vonecloud side only, and done that steps already.

Okey, I think I found the answer:
Based on this documentation I made my setup, but it don’t work on Debian10 and Centos7 guests. Network = Yes also done in contextualization, but the network interface file (/etc/network/interfaces.d/filename.conf or /etc/sysconfig/network-scripts/ifcfg-XY.cfg) will not created after the VM is created. How can I debug this? In the /var/log I don’t see any useful thing.