Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at: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

    By RahulOctober 3, 20182 Mins Read

    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.

    Advertisement

    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

    Related Posts

    How to List Manually Installed Packages in Ubuntu & Debian

    10 Bash Tricks Every Developer Should Know

    How to Validate Email Address in JavaScript

    View 1 Comment

    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

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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