How to set static ip ubuntu 18.04 LTS

Setting up a static ip address in ubuntu 18.04 LTS is completely different than the previous versions. The ip configuration file name and locations are also changed. Ubuntu 18.04 LTS use “netplan” command for managing interfaces and ip address. This article explains how to set static ip ubuntu 18.04.

Set static ip Ubuntu 18.04

The configuration file which you need to edit is located as /etc/netplan/50-cloud-init.yaml. You have to edit this .yaml configuration file in order to manage interfaces and static ip addresses etc on your Ubuntu server. The default interface name is ‘end33’ for me (Ubuntu 18.04 LTS). Was set to dhcp mode by default.

The below screenshot shows the default configuration of /etc/netplan/50-cloud-init.yaml (interface: ens33 ; ip address: DHCP)

[email protected]:~# vi /etc/netplan/50-cloud-init.yaml

ubuntu 18.04 LTS 50-cloud-init.yaml fle

Here is the file which i changed for a static ip address, gateway and 2 nos DNS servers.set static ip ubuntu 18.04

Note:  take an extra care about the spacing of each configuration lines. otherwise you will get errors and configuration will not work.

Save the /etc/netplan/50-cloud-init.yaml file and run the below command to take effect the ip configuration changes immediately.

[email protected]:~# netplan apply

[email protected]:~# ifconfig    //to view complete ip details//

Read linux related articles

One Response

  1. Abhi 09/04/2019

Leave a Reply

Are you a human being ? *