If this is a home lab, I would recommend setting up a DNS/DHCP server for a good learning exercise, as mentioned in the comment above by user1794469. This way, anytime the ip address is changed, the DNS record would be updated dynamically. The most important thing to do after that is to configure your client machines to point to your DNS server first, before they look else where.
DNS and DHCP were created to solve this exact problem. If you setup JUST a DNS server, you would still have to manually update the records anytime you add a new machine or a machine gets a different IP.
When you setup DNS and DHCP, the DHCP daemon will "Dynamically" update the records.
There are plenty of guides online for setting this up so make sure you find a guide for your choice of Linux distro
hostsis fine. Assuming this is your network you can give the machines static addresses, dhcp reservations, or run your own dhcp && dns server which seems way overkill for your problem (but would be a good learning exercise).