Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the vm name to bhyveload guests as a variable. #479

Merged
merged 1 commit into from
Oct 25, 2022
Merged

Pass the vm name to bhyveload guests as a variable. #479

merged 1 commit into from
Oct 25, 2022

Conversation

madpilot78
Copy link
Contributor

Hi,

I'm using vm-bhyve with a NAT configuration, and using dnsmasq to perform DHCP. I also allowed it to serve names for the virtual machines and query it using a separate subdomain, forcing local_unbound to query the internal dnsmasq for that special domain.

This is very useful, allows me to ssh to freebsd hosts by name, simplifying key management for example.

As you may know, dnsmasq assigns dynamically the IP to the hostname submitted by the host. It works fine, but when I clone a machine multiple time the names clash.

With this patch the name of the machine is passed to the guest via loader env, then I can set it in the guest with this line in rc.conf:

hostname="$(/bin/kenv bhyve_vm_name).internal.vm"

and every clone automatically sets the correct hostname.

I'm using this with FreeBSD only, since I need this only there.

Not sure if anything like this can be done with windows guests, but I guess linux guests could get some similar functionality via grub.

Hope this is deemed useful!

@churchers
Copy link
Owner

Looks useful. Thanks!

@churchers churchers merged commit 84bbd04 into churchers:master Oct 25, 2022
@madpilot78 madpilot78 deleted the bhyveload_pass_vm_hostname branch October 25, 2022 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants