VM IP assignment with DHCP uses node IP

So I just recently found out about opennebula and I’m sorta looking for a replacement for vagrant. I have a bunch of spare servers in my lab and I’ve been fiddling with using openstack or proxmox to basically provision VM’s as needed.

Unfortunately, I’m saddled with an issue where I cannot get reserved (floating) IP addresses from IT. DHCP is the only way to get IP addresses for my infra needs. But what I’ve seen doing light googling, it seems like opennebula supports DHCP.

Basically, the idea is that whenever I spool up a new VM, that VM should automatically get an IP from my corporate DHCP server.

I’m following the guide: Tutorial: Automated Cloud Deployment with Local Storage — OpenNebula 6.10.2 documentation

I have 3 nodes - 1 frontend and 2 nodes. All running Alma Linux 9.5

My controller node is another machine that I’m using to execute the playbook on.

This is my example.yml conf

all:
  vars:
    ansible_user: root
    one_version: '6.10'
    one_pass: opennebulapass
    vn:
      admin_net:
        managed: true
        template:
          VN_MAD: bridge
          PHYDEV: eno1
          BRIDGE: br0
          AR:
            TYPE: ETHER
            SIZE: 20
          NETWORK_ADDRESS: NET_ADDR
          NETWORK_MASK: NET_MASK
          GATEWAY: NET_GATEWAY
          DNS: DNS1 DNS2

frontend:
  hosts:
    f1: { ansible_host: FRONT_END_IP, ansible_ssh_user: user, ansible_ssh_pass: password, ansible_become_password: password}

node:
  hosts:
    n1: { ansible_host: NODE_1_IP, ansible_ssh_user: user, ansible_ssh_pass: password, ansible_become_password: password}
    n2: { ansible_host: NODE_2_IP, ansible_ssh_user: user, ansible_ssh_pass: password, ansible_become_password: password}


All nodes have a single eno1 network interface and a br0 bridge interface.

Here’s where I get stuck. Whenever I try to create a VM, it creates a VM with an IP address that’s one of the 2 node ip addresses, either NODE_1_IP or NODE_2_IP.

I was hoping that when I create a new VM, a free IP from the DHCP address pool would be leased out to this VM.

I haven’t fully dived into opennebula, just spending about 1 or 2 hours messing around. Is this just a configuration issue or is this not possible?

Based on some remarks from my googling, I have the NETWORK = yes context configuration set according to the alpine VM template as well as a Ubuntu 24.04 VM template I tried.

Any thoughts?

Hello @hexamehcimal and welcome to this forum!!

Nice to see a new user trying to test and experiment a bit with OpenNebula, so feel free to ask any question here.

In any case, I would strongly suggest to check our documentation:
https://docs.opennebula.io/6.10/management_and_operations/references/template.html#context-section

There’s also a post that might help you:

And this one:

If that’s not what you were looking, let me know :wink:

Cheers,

Hi Francisco,

Thanks for the quick reply. I actually made a mistake. I was misreading the dashboard where the IP was reported.

It turns out, the VM WAS geting an IP from DHCP. I was reading the “host” field as assumed that was the IP of the VM and not the host the VM was deployed on.

After doing some digging, I was able to access the VM and check the IP and found that it’s an IP from DHCP.

Thanks again though!

2 Likes