Page 1 of 1
How to interrogate Host Only DHCP leases
Posted: 31. Oct 2016, 03:35
by avidscavenger
Hi there,
Can anyone tell me how to interrogate the leases for a DHCP server running on a Host Only network (eg vboxnet0)?
What I want to do is to access my guests by name without having to create static IP's. Ideally i would configure domain resolution so that guests are found by simply using their name, but I'd settle for being able to run a script to find an IP from the guest name.
Thanks!
Re: How to interrogate Host Only DHCP leases
Posted: 31. Oct 2016, 05:37
by BillG
That is what DNS is for, not DHCP.
Re: How to interrogate Host Only DHCP leases
Posted: 31. Oct 2016, 07:25
by avidscavenger
Of course it would be nice if the domain server would do the job, but since it is the DHCP that allocates the IPs, the IPs can be retrieved by examining the DHCP leases even without a DNS.
Re: How to interrogate Host Only DHCP leases
Posted: 31. Oct 2016, 09:28
by BillG
The DHCP server certainly knows about IP addresses but it knows nothing about names. Perhaps you could tell use what you are really trying to do here?
You can certainly run a group of vms as a domain with DHCP and DNS. The best option is to use an internal virtual network. That is how mine runs.
Re: How to interrogate Host Only DHCP leases
Posted: 31. Oct 2016, 09:42
by avidscavenger
Ah OK I had imagined the DHCP server recording hostnames as dhcpd does. If that isn't the case then I guess I am back to square one.
What I want to do is simply avoid having to check the on IP my guests have been assigned before I can access them over a Host Only network. Not only is this procedure a pain in the neck but it's impossible (well maybe not strictly but not easy) to automate because you have to have a connection to your guest before you can ask it what its IP is. Still even if the lease only records the MAC address I could still script something... if I could just work out where those leases are stored. It's a bit confusing why they aren't neatly sitting next to NAT leases which are in ~/.config/VirtualBox/NatNetwork.leases (on Linux/Debian at least).
Setting up a VPN sounds like a sledgejammer to crack a nut to me. My guests do not need to communicate with one another, all i want to do is easily connect to my guests from my host.
Thanks for the replies btw.
Re: How to interrogate Host Only DHCP leases
Posted: 31. Oct 2016, 10:50
by Martin
The default host only network is using the 192.168.56.0/24 subnet. The DHCP server of this network is running on 192.168.50.100 and distributing addresses in the .101-.254 range.
If you can assign static addresses you could use addresses between .10 and .99 (leave the low addresses for Vbox) and you wouldn't need to care about DHCP.
Re: How to interrogate Host Only DHCP leases
Posted: 1. Nov 2016, 00:17
by avidscavenger
For what it's worth, my last post gave me an idea - using a standard DHCP server (eg isc-dhcp-server on Debian) instead of Virtualbox's built-in one. All I had to do was disable the DHCP server on Virtualbox's Host-Only networking configuration and configure isc-dhcp-server to work on the vboxnet0 interface. Works perfectly. Also let's me configure extra things like router, DNS server, and all the other goodies that a full-blown DHCP server can do.