Full Stack Web Developer


Setup Static IP on Ubuntu 18.04 Server

Useful when you're working on an Intranet site.

Ads: Register now via this link to receive $100 credit from Vultr

I was playing around with setting up my own Ubuntu server for an intranet system to use within the company.

Everything works out of the box, almost like Windows ;). The thing that I think would be very much useful in the future is to set a static IP so that even if the server is moved or changed within the network, everyone can still access it without changing the IP.

To do so, go to /etc/netplan and you’ll find a file called 50-cloud-init.yaml (the file name might be different on your server). Edit it to match the following setting:

#This file is generated from information provided by
#the datasource. Changes to it will not persist across an instance.
#To disable cloud-init's network configuration capabilities, write a file
#/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
#network: {config: disabled}

renderer: networkd
addresses: []
dhcp4: no
optional: true
addresses: []
addresses: []
dhcp4: true
version: 2

Save and type the following command: sudo netplan --debug apply

Leave a Reply

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