Updated – December 9th, 2019 with DNS configuration.
So I’ve been playing with Photon OS recently with a few of our Cloud Provider solutions, very nice lightweight appliance.
However, one thing that surprised me is the minimal/lightweight install does not have ping installed nor can you ping it (ICMP echo replies). In my opinion, this is a basic function for any type of network troubleshooting. I understand it’s minimal…but go cut something else out. 🙂
So how do we set up some basic network functions?
Setting up a Static IP
cd to /etc/systemd/network
vi (or use your preferred text editor) a file called 10-eth0.network
There’s three sections required: Match, Network, and DHCP
Below is the code required:
[Match] Name=eth0 [Network] Domains=HOSTNAME domain.local Gateway=192.168.110.1 Address=192.168.110.61/24 DHCP=no [DHCP] UseDNS=false
Save it (wq!), and now it’s time to chmod the file so it can be read by the OS
chmod 644 10-eth0.network
Now restart the network daemon service.
systemctl restart systemd-networkd
Installing Ping on Photon OS
Now there’s two different versions of Photon – version 1 and 2. On version 1, it’s pretty easy – type in the following:
yum install iputils
Now for Photon 2.0 (which I’m currently using), repos are disabled by default and so I was getting a message stating “package not found” which was odd. However, digging in further, I found the repos were not enabled.
Enabling Repos so we can pull iputils
I enabled three repos:
We need to edit each file and change the enabled=0 to enabled=1
Now let’s install it!
tdnf install iputils
Sucess! Ping is available now, along with netstat too.
Allow ICMP echo responses
This is a change in the firewall table. By default, ICMP echo and replies are dropped.
Here are the two commands required to enable ICMP traffic:
iptables -A OUTPUT -p icmp -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
Currently, I found a DNS issue with the vami_config_net file with a Photon 3.0 appliance deployment – it was not setting the DNS correctly and resorting to a 127.0.0.53 address. Moreover, the /etc/resolv.conf file should not be modified and if it is, changes do not persist post-reboot.
- Set DNS inside of the /etc/systemd/network/10-eth0-static.network network configuration file
- Change it under /etc/systemd/resolved.conf
Option 1 Example:
root@vcav [ ~ ]# more /etc/systemd/resolved.conf ....... # See resolved.conf(5) for details [Resolve] DNS=10.96.88.2 #DNS= #FallbackDNS=22.214.171.124 126.96.36.199 2001:4860:4860::8888 2001:4860:4860::8844 #Domains= LLMNR=false #MulticastDNS=yes #DNSSEC=no #DNSOverTLS=no #Cache=yes DNSStubListener=yes
Resetting the Root Password
I’ve had situations where I’ve locked myself out of a Photon instance. The process is pretty simple – follow this link: https://github.com/vmware/photon/blob/master/docs/photon_troubleshoot/resetting-a-lost-root-password.md
Setting the Hostname
Need help changing it from the default photon-appliance hostname?
Hostnamectl is the command for permanently changing the name – not just editing the /etc/hosts file.
hostnamectl set-hostname DanielApp-B
Reboot the system.
One last tidbit – SSHD not starting?
During some of my testing, my lab environment went bottoms up – thanks, Timo 😉
After my Photon appliances started back up, I could not SSH to them. So after some troubleshooting and help from the VMware internal team, figured out what happened.
Steps to resolve:
Log into the console and ls -l /var/vmware/skip_sshd and you can also check the status of sshd by typing “systemctl status sshd”
If the file does exist, you need to remove it. No clue why it was added when I had a hard power outage, but it did.
Now start up ssh..
systemctl start sshd
Voila! we can now see it’s started
Other great details on Photon commands can be found here: Photon OS Troubleshooting Guide