DHCP time leases

Hello!

I’m not understanding how the time lease input field when setting up a new interface works. I’ve seen somewhere that the default lease is 1 hour, so I assumed that putting 8766 in the field would make it last a year, but the lease of a new VM becomes ~7h30min.

I wanted new VMs to have long leases, so I can avoid the manual work of setting up all leases to be fixed and have all machines not changing IP.

Thanks for the help! :slightly_smiling_face:

@Joel

Hello Joel

I think you don’t understand the basics of networking, VMs and a lot more in IT…

For one, a DHCP allocated IP will be “held” to the VM as long as it runs, even reboots. Leases just get renewed, not a completly new deal! If you rent a car, and extend your rental, you won’t have to get a new car and contract… Same thing here…

Second: Servers, as VMs generally aren’t “workstations” with someone in front of a screen, should always use the same IP, and as such it’s often better to set this once and for all - manually, or with a DHCP reserved IP. NethServer makes this simple, as you can reallocate the IP to what you want when you reserve it.

DHCP - in all known operating systems to me (And that’s a lot!) use seconds when defining the scope. 3600 is an hour 86400 a day. What’s so complicated about that?

You’re simply wasting your time and ours!!!

Sorry if I sound a bit harsch here, maybe just had a hard day and am exhausted!

My 2 cents
Andy

Hi Andy!

I’m sorry that I don’t really know much.
I have a situation that I don’t know how should I solve it.
What will happen to the DHCP lease and the vm’s IP if something like this happens?
0. VM created

  1. DHCP lease given and VM gets IP
  2. VM deleted
  3. DHCP lease expires
  4. VM equal to the first one (equal MAC) that I want it to have the same IP.

Will the VM get the same IP after the lease expires?

I forgot to say I tried seconds first, sorry for that. I tried to put a year in seconds and it made the lease one week, so I assumed I made some error testing and went to try minutes and hours. Also, 8766 seconds is 2 hours, which is far from 7h :upside_down_face: (math might be wrong). I might be doing something wrong, I made the post to verify if I was, and by your answer, I am, I’ll try again tomorrow.

For the second topic, I will have more than 100+ VMs.
My problem requires the VM to never change IP, or change only in x time.
Manually setting the IP in the VM or creating the fixed lease, might be good in some cases, but I don’t believe this is the correct way, but you might disagree.

Thanks for reading,
Joel :slightly_smiling_face:

Hi

It takes a single click in NethServer to switch a host from a “pool” dhcp IP address to a dhcp-reservation.
At the same time you can allocate the IP as needed or preferred.

The allocation is by MAC, so this would work as you want.

Sorry, I really am tired… :slight_smile:

My 2 cents
Andy

1 Like

You don’t have to be sorry about that, I think Andy was really tired.
But reading a little bit about networking with DHCP, DNS and IP networks could really help you to save much hours.

Do you use these vm’s as server or client or both?
Like @Andy_Wismer said, a server should have a static IP because of the dependency from other devices to the server. If they are clients and you won’t have them to change the IP, you should do a reservation at the DHCP menu of nethserver.

But perhaps you can tell us a little bit more about your config. It could help to know what the 100 vm’s are and for what you need them. I think with these infos we would find the best solution for you.

Your problem with the lease time I can’t test at the moment, I didn’t use DHCP here. Perhaps somebody from @support_team can test it.

Hi,
I’ll just follow your suggestions.
Thanks to both for the help! :slightly_smiling_face:

1 Like

I was indeed doing something incorrectly, the leases are of 1 year, when I place a year in seconds.

Thanks for everything,
Joel