Set Static IP Address On Ubuntu Server 20.04

This post will show you how to set a static IP address on Ubuntu Server 20.04 using the netplan utility.

Netplan

With Ubuntu Server 20.04 we use the netplan utility to configure a static IP address. Netplan is a new YAML based network configuration tool.

Note: Make sure you note down the name of your network adapter after running the following command.

ip a

To get started and configure a static IP address on a server open the netplan directory in the following location.

 /etc/netplan

In the location, you will find a YAML with a name that is different from each system. Open config file (yaml).

Configuration

In the below example, I am setting a static IP address on my Ubuntu server.

network:
   version: 2
   renderer: networkd
   ethernets:
   eth0:
    dhcp4: no
    addresses: [192.168.0.2/24]
    gateway4: 192.168.0.1
nameservers:
    addresses: [8.8.8.8, 192.168.0.1]

After saving the file, apply the IP configuration using the following command.

netplan apply

Processing…
Success! You're on the list.

Posted

in

,

by