Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How to Configure Static IP Addresses on Ubuntu 18.04 Server Edition

    How to Configure Static IP Addresses on Ubuntu 18.04 Server Edition

    RahulBy RahulSeptember 10, 20182 Mins ReadUpdated:October 3, 2018

    What is Netplan?

    Ubuntu systems are now using netplan for the network configuration. Netplan enables easily configuring networking on a system via YAML files. Netplan processes the YAML and generates the required configurations for either NetworkManager or systemd-network the system’s renderer.

    This new tool replaces the static interfaces (/etc/network/interfaces) file that had previously been used to configure Ubuntu network interfaces. Now you must use /etc/netplan/*.yaml to configure Ubuntu interfaces.

    The new interfaces configuration file now lives in the /etc/netplan directory. There are two renderers. NetworkManager and networkd. Use NetworkManager renderer for desktop computers manage through GUI and networkd is used for server to manage from the console.

    The Desktop users can easily add or modify IP address using GUI interface. Read this tutorial to configure IP address on Ubuntu 18.04 Desktop.

    Setup Static IP on Ubuntu 18.04

    First of all, check the network interface name on your system using ifconfig command. In my case, the network interface name is “enp0s3”.

    Now edit the following file.

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

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

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # 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.1.110/24]
         gateway4: 192.168.1.1
         nameservers:
           addresses: [8.8.8.8,8.8.4.4]

    Save the file and apply the new settings to networkd by executing command:

    sudo netplan apply
    

    Your system is configured with an updated IP address. To view current IP of system use one of the below commands:

    sudo ifconfig
    sudo ip addr show
    
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Laravel on Debian 9
    Next Article How to Use Sleep in Python Script

    Related Posts

    What is CPU? – Definition, Types and Parts

    3 Mins Read

    How to Install Ionic Framework on Ubuntu 22.04

    3 Mins Read

    What is the /etc/hosts file in Linux

    Updated:June 27, 20222 Mins Read

    Creating DMARC Record for Your Domain

    Updated:June 29, 20223 Mins Read

    What is Computer Hardware?

    4 Mins Read

    What is Information Technology (IT)?

    Updated:June 29, 20223 Mins Read

    1 Comment

    1. Fábio on April 30, 2019 8:02 pm

      Excellent tutorial! It´s very important to maintain proper indentation when configuring the .yaml files. Thanks!

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.