• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Configure Static IP Addresses on Ubuntu 18.04 Server

Written by Admin, Updated On May 7, 2019
network, ubuntu

Ubuntu 18.04 LTS has a new method to configure static ip addresses. Unlike the previous versions, the Ubuntu 18.04 uses Netplan, a new command line network configuration utility, to configure IP address. Netplan enables easily configuring networking on a system via YAML files.

Configure Static IP Addresses on Ubuntu 18.04 Server

The default configuration files of Netplan are found under /etc/netplan/ directory. In this tutorial, we are going to learn how to configure static in Ubuntu 18.04 LTS server.

Configure Static IP Addresses on Ubuntu 18.04#

To configure a static IP addresses on your Ubuntu 18.04 server you need to modify a relevant netplan network configuration file within /etc/netplan/ directory. For instance you might find there a default netplan configuration file called 01-netcfg.yaml or 50-cloud-init.yaml.

To do so, Edit following file.

sudo nano /etc/netplan/01-netcfg.yaml

Add below content to file with your address, gateway and dns details:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   enp0s3:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.56.201/24]
     gateway4: 192.168.56.1
     nameservers:
       addresses: [8.8.8.8,8.8.4.4]

As you can see, I already added my ip address. like that, you have to add your own server ip address. After that, Save the file and apply the new settings to networkd by executing command:

sudo netplan apply

Now your server is updated with new IP address. You can check current IP address by executing following command :

sudo ifconfig
sudo ip addr show

Finally, you can see that static IP address is configure to your server.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install MySQL on Ubuntu 18.04
Next Article   How to Install LAMP Stack on Ubuntu 18.04

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Python 3.11 on Debian 11
    How to Install Python on Debian 11 January 25, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook