Welcome to Ubuntu 18.04 Tutorial. Today we are going to configure Static IP address on Ubuntu 18.04 Server. Ubuntu 18.04 has a different way to handle the network interfaces. On the previous Ubuntu version, we can easily edit the file /etc/network/interfaces and modify the content. But now, how Ubuntu manage network interface has completely changed. Ubuntu 18.04 introduces NetPlan, a new way to manage network in Ubuntu. Well, most of you may haven’t heard about this NetPlan. But here we are going to use it to configure static IP on Ubuntu. Personally, I prefer the old way but seems Ubuntu has their own decision.
Previously, we use the /etc/network/interfaces configuration file to configure Ubuntu network, now we use /etc/netplan/*.yaml. There are two renderers NetworkManger and networkd. The NetworkManager is used in Ubuntu Desktop and networkd is used in Ubuntu Server.
The following steps are used to change or configure static IP address on Ubuntu 18.04 Server. First, open Terminal and then use “nano” or your favorite editor to edit the file .yaml.
sudo nano /etc/netplan/00-installer.yaml
I changed the content into something like this:
# This is the network config written by 'subiquity' network: ethernets: enp0s3: dhcp4: no addresses: [192.168.1.4/24] gateway4: 192.168.1.1 nameservers: addresses: [192.168.1.1,188.8.131.52] version: 2
As you can see, my new static IP is: 192.168.1.4, gateway: 192.168.1.1 and DNS Servers are: 192.168.1.1, 184.108.40.206. You can adjust and change this section with your own settings.
To apply, use this command
sudo netplan apply
Make sure there is no error shown after the command. Thanks for reading how to configure static IP address on Ubuntu 18.04 Server.