For decades ifup and ifdown were the 'standard' method to configure network interfaces in Unix and Linux systems.
Ubuntu (Canonical) has migrated from ifupdown to netplan, which requires a different skill set to handle.


DHCP

Choosing NetworkManger as renderer.
-Create a file in /etc/netplan/config.yaml (suggestion: delete other files in that directory to reduce confusion).
-Content of /etc/netplan/config.yaml:

network:
  version: 2
  renderer: NetworkManager

After the file is saved,
$sudo netplan generate
$sudo netplan apply
$sudo reboot

For static IP, I prefer to use systemd-networkd, but one can stick with NetworkManger if so desired.


Static IP

Choosing systemd-networkd as renderer.

-Determine the logical name of the Ethernet card:
$sudo lshw -class network | grep logical
-Comment out all lines in /etc/network/interfaces that were left behind by previous Ubuntu versions.
-Create a file in /etc/netplan/config.yaml (suggestion: delete other files in that directory to reduce confusion).
(yaml requires extremely careful indentation, use spaces, don't use tab)
-Content of /etc/netplan/config.yaml:

#your LAN IP address and default gateway may be different
network:
   version: 2
   renderer: networkd
   ethernets:
     eth0:
       addresses: [192.168.1.3/24]
       routes:
       - to: default
         via: 192.168.1.254

-Edit /etc/systemd/resolved.conf to specify your preferred DNS servers (nameservers) e.g. Google public DNS
DNS=8.8.8.8  2001:4860:4860::8888

After the files are saved:
$sudo netplan generate
$sudo netplan apply
$sudo reboot


Check network setup:
$ip address  (similar to ifconfig)
$resolvectl   (similar to nslookup or dig)


Notes:
-$cat /etc/resolv.conf will show nameserver 127.0.0.53 (it is a stub resolver). Don't edit that file or remove the symlink, it is there by design to point to the real DNS servers, magically revealed/disclosed by the resolvectl command.
-Instead of using Google public DNS nameservers, one can choose Cloudfare, Quad9 or private DNS servers.


 Troubleshooting

-If the symbolic link is accidentally broken, restore it:
 $sudo ln -s /run/systemd/resolve/stub-resolv.conf  /etc/resolv.conf
-Sometimes the resolvconf package causes conflicts with netplan, delete resolvconf package to calm things down:
 $sudo apt purge resolvconf