Quickly configure PhotonOS virtual machines with static IPs

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Email -- 0 Flares ×
Sometimes, we all need a large group of small virtual machines for our tests in vSphere. I tried in the past several linux distributions that claim to be small and easy to be deployed, but they usually failed in one of the two aspects, and it’s usually the ease of deployment. They are all fine if there’s a DHCP server around, but setting up a static IP configuration has always been a problem: mouse drivers in graphical mode are horrible, there’s little to no documentation about which distribution they are based on (in order to find out which commands and configuration files should be used), in summary, a living hell.
So, I decided to spend an afternoon doing some research and tests, and I came out with “my own” preferred procedure. It may be good for you too, or maybe not, depending on your own needs. I documented all the steps I’ve done, so that I (and you) can follow them start to end in order to obtain a working tiny VM with a static IP address.
1- Get PhotonOS
My choice has been the VMware PhotonOS appliance. I’ve seen other OVA templates that are even smaller, but they are usually ugly and not easy to be used. PhotonOS appliance is only 110MB in size, which is ok for my needs. Even on my smallest lab, I can easily deploy a dozen of these. You can freely obtain the OVA file here.
Once you have the OVA file, just deploy a new virtual machine using it.
2- configure PhotonOS
The initial configuration is done with just two steps. The first one is to change the root password. The default is “changeme”, and at the first login, the system asks to change it with a new one:
Once we are inside the machine, we need to configure a static IP addres, which can be accomplished quickly with this commands:
networkctl (to check the name of the interface which will be used later, in my example is eth0)
cd /etc/systemd/network (you will find here already a configuration file for dhcp settings)
vi 10-static.network , and put this text (edit it where needed) in the newly created file:
chmod 644 10-static.network
systemctl restart systemd-networkd
Our machine is now correctly connected to the network and ready to be used:
0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Email -- 0 Flares ×