These scripts are used for simple management of hostnames for several VirtualBox VMs comprising a test or sandbox environment on your local machine.
Architecture:
-
each VM is configured to use bridged network adapter, so all VMs and the host can see each other
-
a script is installed in each VM to run on post-ifup, which grabs VM's IP, puts "$IP $desired-hostname $desired-fully-qualified-hostname" into /etc/hosts, changes hostname correspondingly, and puts VM's hostname and fq-hostname into VM's properties
-
a script is used on the host machine, which loops through running VMs, and updates /etc/hosts on the host machine and on the VMs
Setup:
- On CentOS/RedHat VM:
1.1. put "ifup-local.sh" to /etc/sysconfig/network-scripts directory
1.2. change HN and FQHN variable values to desired hostname and fully qualified hostname for this VM
1.3. make soft link to the file from /sbin: ln -s /etc/sysconfig/network-scripts/ifup-local.sh /sbin/ifup-local
- On the host use update-vms script to update VMs and host's /etc/hosts files when VMs are started, stopped, or network configuration (IPs) is updated