Photon OS in the Lab

Here’s a few tips from what I do when deploying Photon OS in the lab. Keep in mind this is only for troubleshooting and testing, so don’t make the same changes to anything outside of your lab.

When I need to test connectivity across hosts or sites, I need a VM that’s quick to deploy and boot up. I’m sure everyone has their favourites, there’s lots to choose from. The trouble is trying to remember specifics on how to assign IP’s, update firewall, and what other troubleshooting commands are available for each variant.

It seems pointless to learn another OS just for testing and troubleshooting. That’s why I use Photon OS, because it’s the base OS for many of the VMware appliances, you can use the same commands you’re familiar with. Or it’s a good excuse to learn some of those commands for next time you’re troubleshooting on a VMware appliance.

Format

Photon OS is available as an ISO to install manually, but it’s available as a pre-built image in the following formats:

  • OVA
  • Amazon Machine Image
  • Google Compute Engine Image
  • Azure VHD
  • Raspberry Pi3

Deployment

Photon OS is fairly fast to deploy. The OVA is 170MB.

Call me lazy, but if I don’t have the OVA locally, or I can’t remember when I saved it to last time, I specify the URL when deploying it. (http://dl.bintray.com/vmware/photon/3.0/Rev2/ova/photon-hw13_uefi-3.0-9355405.ova)

Deploy OVA

It deploys a VM with 1vCPU, 2 GB memory, 16GB disk by default.

Initial Configuration

Once it’s booted, login with root / changeme, and it will prompt you to change the password. Don’t forget to read the prompts as you need to enter the current password before you put in a new one.

The password policy requires something more complex than VMware1! which is what a lot of us may use, so I go with my more complex variant of VMware1!VMware1!. Once you have changed the password and logged in, you can simply change it again to a less complex password.

Welcome to Photon 3.0 (x86_64) - Kernel 4.19.79-1.ph3-esx (tty1)
photon-machine login: <root>
Password: <changeme>
You are required to change your password immediately (administrator enforced)
Changing password for root.
Current password: <changeme>
New password: <VMware1!VMware1!>
Retype new password: <VMware1!VMware1!>
root@photon-machine [ ~ ]# passwd
New password: <VMware1!>
Retype new password: <VMware1!>
passwd: password updated successfully
root@photon-machine [ ~ ]#

Break all the rules

When testing connectivity, you need to ping! By default, Photon is locked down, so lets open it up. To do it properly, you should only open ports you plan to use.

Stop the firewall

root@photon-machine [ ~ ]# systemctl stop iptables

Disable the firewall

root@photon-machine [ ~ ]# systemctl disable iptables

Connect to the network

The official Photon doco is pretty good at explaining how to do this.

Create the network configuration file:

cat > /etc/systemd/network/10-static-en.network << "EOF"

[Match]
Name=eth0

[Network]
Address=198.51.0.2/24
Gateway=198.51.0.1
EOF

Change the new file’s mode bits by running the chmod command:

chmod 644 10-static-en.network

Apply the configuration by running the following command:

systemctl restart systemd-networkd

Clone it

It’s no fun pinging by yourself. If you need a source & destination VM for pings, now is the time to clone it.

Shut down your photon VM, clone it, and set it to power on. Once booted up, use vi to edit the network file above to use a different IP.

Once that’s been saved and network restarted, you can power on the first Photon VM.

Troubleshooting commands

Because Photon is cut down, a lot of your usual commands aren’t there.

View IP address: ip addr ifconfig

traceroute = tracepath

Install additional tools

tndf install tcpdump

tndf install netcat

Andrew Dauncey
Andrew Dauncey
Senior Consultant at VMware PSO

Every day I’m shuffling

Next
Previous