Setup Static IP on Ubuntu 18.04 Server

On  

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 to the 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 in 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}

network:
renderer: networkd
ethernets:
eno1:
addresses: [xxx.xxx.xxx.xxx/nn]
dhcp4: no
gateway4: xxx.xxx.xxx.1
optional: true
nameservers:
addresses: [xxx.xxx.xxx.xxx]
eno2:
addresses: []
dhcp4: true
version: 2

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

About Author:

I am a WordPress lover. I make my living by using WordPress.

Leave A Comment

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