News
Spin into 2026: join the New Year Wheel of Fortune

THE NEW YEAR
WHEEL OF FORTUNE

Tap the button and win a guaranteed prize right now!

By registering, you are signing up to receiving e-mails.
WB
April 20 2020
Updated November 30 2025

How to Configure Network Interfaces in Ubuntu 18.04 Using Netplan and Traditional Methods

Ubuntu

Using another OS?

Select the desired version or distribution.

Network interface configuration in Ubuntu 18.04 via netplan

    Network management in Ubuntu 18.04 has undergone significant changes compared to earlier releases. While the traditional configuration file /etc/network/interfaces still exists, it now plays a minimal role, serving mainly as a reference. The actual network settings are now managed through YAML files located in the /etc/netplan directory, which have become the primary method for defining and controlling network interfaces:

    Screenshot 1: Configuring the network interface in Ubuntu 18.04

    Let's look at this:

    ls /etc/netplan

    Screenshot 2: content of the directory /etc/netplan

    Then take a look at the file structure:

    cat /etc/netplan/50-cloud-init.yaml

    Screenshot 3: checking content of the directory /etc/netplan

    The netplan settings is described in YAML (Yet Another Markup Language). Let's look inside:

    • network — a "marker" word that means the start of a logical block of the settings;
    • ethernets — this parameter means that the Ethernet network will be configured further;
    • enp0s3 — the name of the interface to be setup. Yours will probably look different. All network interfaces present on the computer will be displayed after the following command:
    ifconfig -a
    • addresses — an IP addresses that the interface has. Addresses should be set in CIDR format. The first IP is written as at the screenshot, and when more than one address is required, they are placed in square brackets, a comma is placed between the addresses;
    • gateway4 — IPv4 gateway;
    • nameservers — this "marker" indicates that the section below contains the names or IP-addresses of servers that processes DNS queries;
    • addresses — names (or addresses) of hosts that resolve DNS names to IP addresses. If necessary, they may be written in square brackets as described above, one address is separated from another by a comma;
    • version — YAML language version.

    To activate new settings, run this:

    netplan apply

    Network configuration without netplan

    Before the setup, I advice you to clarify which interfaces are really present in the system:

    ifconfig -a

    Screenshot 4: get a list of available interfaces Ubuntu 18.04

    In the screenshot above, you can see that there are two interfaces without assigned IP's present, cause the machine is waiting for settings from the DHCP server. In a situation where there is no such DHCP-server in the network segment, you should assign the IP manually. So, change the config-file so that it looks like the one shown in the picture:

    sudo nano /etc/network/interfaces

    Screenshot 6: customization of DHCP Ubuntu 18.04

    Let's talk about the parameters:

    • auto enp0s3 - this instruction "tells" the computer to automatically start the network after reboot;
    • iface enp0s3 inet static - parameter indicating that the network address should be set manually;
    • address 10.10.2.6 - assigned IPv4 address;
    • netmask 255.255.255.0 - subnet mask
    • gateway 10.10.2.1 - IPv4 gateway
    • dns-nameservers 8.8.8.8 - hosts that process DNS requests.

    To confirm the changes, you should run this:

    sudo /etc/init.d/networking restart

    Screenshot 7: applying settings and restarting network Ubuntu 18.04

    After the service restart, the computer should be available via assigned IP address. If not, reboot the server entirely, it will help.

    Conclusion

    In this guide, we explored two approaches for configuring network interfaces in Ubuntu 18.04: using Netplan and the traditional /etc/network/interfaces method. Netplan provides a modern, YAML-based configuration system that integrates seamlessly with NetworkManager and systemd-networkd, making it easier to manage network settings. At the same time, the classic method remains available for scenarios where manual static configuration is required or DHCP is not accessible. By understanding both approaches, you can confidently manage and troubleshoot network connectivity on Ubuntu servers, ensuring stable and reliable access for your system and applications.

    FAQ

    • Q1: What is Netplan and why is it used in Ubuntu 18.04?
      A1: Netplan is a YAML-based network configuration tool introduced in Ubuntu 17.10. It allows administrators to define network interfaces and settings in a simple, structured way, working with NetworkManager or systemd-networkd as backends.
    • Q2: How can I check which network interfaces are available on my Ubuntu server?
      A2: Use the command ifconfig -a or ip addr show to list all available network interfaces, including those without assigned IP addresses.
    • Q3: How do I apply changes made to Netplan configuration files?
      A3: After editing a YAML file in /etc/netplan/, run sudo netplan apply to apply the new network settings immediately.
    • Q4: How can I manually assign a static IP without Netplan?
      A4: Edit /etc/network/interfaces with the desired IP, netmask, gateway, and DNS entries, then restart the networking service using sudo /etc/init.d/networking restart.
    • Q5: What should I do if network changes don’t take effect immediately?
      A5: Ensure the configuration syntax is correct. If the issue persists, restart the network service or reboot the server to apply settings.
    Vote:
    4 out of 5
    Аverage rating : 4.6
    Rated by: 19
    1101 CT Amsterdam The Netherlands, Herikerbergweg 292
    +31 20 262-58-98
    700 300
    ITGLOBAL.COM NL
    700 300

    You might also like...

    We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
    Use of Cookies and Privacy Policy.