How to assign a static IP address in Ubuntu through the command line :
Obtain the network interface’s name and default gateway.
Identify the location of the Netplan configuration.
Edit the Netplan setup to add a static IP address.