Setting static IP for Photon OS

Photon OS installs by default with DHCP enabled. This is perfect for building and distributing Photon OS OS as a Virtual Appliance, but for most practical applications, you’ll want to set a static IP address.

Changing the IP of Photon OS involves a newer, albeit standardized procedure of editing files located in: /etc/systemd/network that will be unfamiliar to many RHEL and Debian users.

I am going to begin in the VMRC of Photon OS, so I can set the IP without losing my SSH session. As soon as I have set the IP address, I am going to connect with SSH, which both confirms the success of my work, and will facilitate easier editing of the network properties.


  • Set a static IP address:
  • Set a gateway:


1. To begin, open a VMRC to your Photon OS

photon login

2. Login with the user: root and the password you set (mine is: photon appliance)

3. List your networking interfaces



Take note of the device name. In this case, it’s eth0

4. change to /etc/systemd/network and list files

cd /etc/systemd/network


5. Move the DHCP configuration to a backup file


6. Create a new static configuration file


7. Enter appropriate values for your network, save and quit






8. List the files, with permissions

ls –la

Notice that the file we just made (as root),, has permissions only for the user and group (-rw-r—-), but no permissions for anyone else

File (-) or directory (d) User (rwx) Group (rwx) Other (rwx)
rw- r – – – – –

9. Since system-network runs an an unique user, we need to make sure that user can read the file we just created by adding read ( r ) permissions for Other users

chmod o+r

ls –la

You can see that Other now has ( r ) permission

File (-) or directory (d) User (rwx) Group (rwx) Other (rwx)
rw- r – – r – –

10. Now restart networking

systemctl restart systemd-networkd

11. Run ip address to see if the address has applied

ip address

The IP address was successful

12. Now logon with SSH to be sure, provided you have enabled SSH access for Photon OS

13. Since this is the first time we are connecting to this IP, there will be a Security Alert.

14. Use the user: root and the password you assigned (mine is: photon appliance)

John Borhek

About: John Borhek

John Borhek (VCP 3-6.5) is the IT Director and Lead Solutions Architect at VMsources Group Inc. John has soup-to-nuts experience in Mission Critical Infrastructure and GxP systems, specializing in Datacenter Infrastructure Management (DCIM) and Operational Technology (OT) all over the United States and throughout the Americas.

2 thoughts on “Setting static IP for Photon OS”

    1. [Esc] to leave editor mode
      :w to write
      :wq to write and quit at the same time
      :q! to exit without saving changes

Leave a Reply

Your email address will not be published. Required fields are marked *