Static IP Address in ubuntu 18.04 with NetPlan

Ubuntu 18.04 Bionic Beaver has switched to Netplan for configuring network interfaces and please refer to the steps below on how to configure statis IP Address with NetPlan

#Edit the default yaml file
sudo vi /etc/netplan/50-cloud-init.yaml

    # 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:
        ethernets:
            ens160:
                addresses: [192.168.1.252/24]
                gateway4: 192.168.1.1
                nameservers:
                    addresses: [8.8.8.8,8.8.4.4]
                optional: true
        version: 2

Apply changes and verify the IP Address is configured successfully

#Apply the changes
sudo netplan apply

#Show IP Address 
ip addr show

Leave a Comment

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

Scroll to Top