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)

About: John Borhek

John Borhek is the CEO and Lead Solutions Architect at VMsources Group Inc. John has soup-to-nuts experience in Mission Critical Infrastructure, specializing in hyper-convergence and Cloud Computing, engaging with organizations all over the United States and throughout the Americas.

7 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

  1. Very nice writeup.
    Using an OS that you can load in < 1 minute is very attractive and I've been trying to use it.
    Strangest issue with assigning an IP that I couldn't fix the other day; assigning DNS – tried to assign and but it still would not ping a non-ip.
    suggestion of a batch file that would assign fixed ip/dns, then enable ssh, and close the iptables to everything except http/https and a local ssh?

  2. Hi John,
    Great article. For Windows guys like me with no vi skills easy way to bypass vi editor one-command example:

    cat > /etc/systemd/network/ << "EOF"

    chmod 644 /etc/systemd/network/
    systemctl restart systemd-networkd

    BTW, "mv" is not needed. OS starts the network configuration files with the lowest priority filename, but'' will not overwrite eth0 from, just will setup DHCP for interface(s) with name e* not including eth0.


Leave a Reply

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