Mange the IP address on Ubuntu server

Change to static IP address

  1. update /etc/netplan/50-cloud-init.yaml
network:
    ethernets:
        enp0s3:
            dhcp4: false
            addresses: [192.168.1.202/24]
            gateway4: 192.168.1.1
            nameservers:
              addresses: [8.8.8.8,8.8.4.4,192.168.1.1]
    version: 2
  1. apply the changes
sudo netplan apply
  1. review the ip address
$ ip a

Change to DHCP
update above config option dhcp4: true