Assign a static IP on Ubuntu server 20

Ubuntu 17 and later versions control the networking by a feature called “Netplan“. The configuration files are located in the /etc/netplan. Under the directory, you will find either 50-cloud-init.yaml or 00-installer-config.yaml 

Step 01: First locate the configuration file under /etc/netplan

Step 02: In my enviornment, the file is 00-installer-config.yaml. So, edit the configuration file with either nano or vim. sudo nano /etc/netplan/00-installer-config.yaml

Step 03: Update the networking configuration as appropriately. A sample configuration will look like below

dhcp4: no
addresses: []
addresses: [,]

Step 04: Save & exit the configuration editor. And then apply the netplan configuration. sudo netplan apply

Finally, reboot the server and verify the changes by running ifconfig or ip a

How to set the IP address on Photon OS

By default, the Photon OS comes with 2 pre configured network configuration files.


First of all, list down the network interfaces with the command networkctl

Then, based on your network configuration you may select the relavent configuration file (Static IP – | DHCP – You may have to access the network configuration related directory.


Edit the Network configuration appropriately

vi /etc/systemd/network/

The changed configuration will look like this below

Save and restart the networking services

systemctl restart systemd-networkd