How to set static ip on ubuntu server using yaml file.
$ cd /etc/netplan/50-cloud-init.yaml $ sudo su
$ cp 50-cloud-init.yaml 50-cloud-init.yaml.backup
$ ls
$ 50-cloud-init.yaml 50-cloud-init.yaml.backup$ nano 50-cloud-init.yaml# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
#network:
# ethernets:
# ens160:
# dhcp4: yes
# version: 2
network:
version: 2
renderer: networkd
ethernets:
ens160:
dhcp4: no
addresses: [192.168.1.230/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8]
Last updated