November 26, 2018 Vignesh Sathiyanantham 0Comment

By default Photon OS comes with DHCP enabled, this is good enough for testing. In some case if you want to set static IP to your PhotonOS VM

To get list of interfaces

networkctl

My network device name is eth0

ls /etc/systemd/network

You will get a DHCP configuration file (99-dhcp-en.network in my case), take a backup of that file and create a new file 99-static-en.network

root@photon-machine [ ~ ]# vi /etc/systemd/network/99-static-en.network

[Match]
Name=eth0
[Network]
Address=10.0.0.110/8
Gateway=10.0.0.1

Save and restart the service systemd-networkd

systemctl restart systemd-networkd

If you are getting “Could not load configuration files: Permission denied” error change the permission of the file to 644

chmod 644 /etc/systemd/network/*


Run ip address to make sure the static address is applied

ip address

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.