Netplan has been introduced by Ubuntu developers in Ubuntu 17. 10. In this particular new approach, we no longer use /etc/network/interfaces document to configure IP address instead we use a YAML file. The particular default configuration files of Netplan are found under /etc/netplan/ directory. In this brief guide, we are going to learn to configure static and dynamic IP address in Ubuntu 18. 04 LTS server and desktop editions.
Configure Static IP Address In Ubuntu 18. 04 LTS Server
Let us find out the default network configuration document:
$ ls /etc/netplan/ 50-cloud-init. yaml
As you can see, the default network configuration file is 50-cloud-init. yaml and it is obviously the YAML file.
Now, let check the contents of this file:
$ cat /etc/netplan/50-cloud-init. yaml
Add the configuration for available interfaces like eth0: and eth1:
network: ethernets: eth0: addresses: - 192. 168. 1 . 9/24 dhcp: false gateway4: 192. 168. 1 . one nameservers: addresses: - 192. 168. 1 . 1 - 8. 8. 8. 8 - 8. 7. 4. 4 search: [] eth0: addresses: - 192. 168. 1 . 9/24 dhcp: fake version: 2