[one-users] Virtual Machine Static IP Address

hector hector at convivencial.org
Thu Nov 18 09:01:07 PST 2010

Hi, I'm new to this so I might be wrong, but I'm going to try to give a
few answers below... hopefully someone will correct me if needed.

El 18/11/10 17:27, Daniel.MOLDOVAN at cs.utcluj.ro escribió:
> Hy,
> Is there any method of assigning a fixed/static IP to a virtual machine? I
> have tried anything, even creating a virtual network with only one IP as
> lease like below and assign this network to the virtual machine in the vm
> template.
> NAME = "VM2_net"
> BRIDGE = virbr0
> LEASES = [IP=]

I guess you have tried including the ip in the NIC section of the VM
template? And had a look
to http://opennebula.org/documentation:rel2.0:vgg

NIC = [
  network = "name_of_the_virtual_network",   #Optional, XEN, KVM
  ip      = "ip_address",                    #Optional, XEN, KVM
  bridge  = "name_of_bridge_to_bind_if",     #Optional, XEN, KVM
  target  = "device_name_to_map_if",         #Optional, KVM
  mac     = "HW_address",                    #Optional, XEN, KVM
  script  = "path_to_script_to_bring_up_if"] #Optional, KVM

You might need to use the contextualization feature as well:

> Nomather what i try, the virtual machine will always get a random IP
> located in the subnet of the virbr0 bridge. Although using onevm show, the
> IP i have requested is reported as assigned, inside the virtual machine
> things are different.
> Can there be issues regarding the host/guest OS? I am running CentOS as
> host and currently experimenting with Ubuntu JeOs and Desktop editions as
> guest systems.The network configuration inside the hosts states that the
> IP is assigned by DHCP.
Another way may be to configure your guests directly with the fixed IP
address you want, but this is not so elegant as letting opennebula do it
for you, of course.
> P.S. And just of curiosity(i am new to bridging/networking) how difficult
> it is to perform some bridging or connection in order to be able to ping 
> the virtual machine from any opennebula node or client, not just from the
> current host of the virtual machine?
Not too difficult but it can get tricky the first time. You may need to
look on
if you're using kvm, to check that libvirt is correctly setup for that.

Good luck,

> Thank you,
> Daniel
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


More information about the Users mailing list