Ubuntu 18.04 uses now Netplan to configure the network interfaces, so the configuration must be done in the file /etc/netplan/50-cloud-init.yaml

sudo vi /etc/netplan/50-cloud-init.yaml

DHCP address:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: true

Static address:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses:
        - 10.10.10.2/24
      gateway4: 10.10.10.1
      nameservers:
          addresses: [10.10.10.1, 1.1.1.1]

You can find more example here: https://netplan.io/examples#using-dhcp-and-static-addressing

NOTE:

  • It’s using yaml format, you should use space rather than tab.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

I’m Hung

Welcome to my personal space. This is a small corner where I share ideas and things I find interesting,..

Let’s connect

Don’t hesitate to reach out if there’s anything we can discuss, or simply to connect :)