Configure Network Using ip Command in Ubuntu Server

Temporary Method -

$ ip a # to get the interface name after connecting LAN
$ sudo ip a add 192.168.1.8/24 dev <network-interface-name>
$ ip link set dev <network-interface-name> up
$ sudo ip route add default via 192.168.1.1

Permanent Solution - Ref: https://netplan.io/examples/

$ vim /etc/netplan/00-installer-config.yaml

# This is the network config written by 'subiquity'
network:
  version: 2
  ethernets:
    enx1027f579a565:
      dhcp4: false
      addresses: [192.168.1.10/24]
      nameservers:
        addresses: [8.8.8.8,8.8.4.4,192.168.1.1]
      routes:
        - to: default
          via: 192.168.1.1

$ sudo netplan apply # or  sudo netplan --debug apply

Allow ssh Connection After Lid Down

$ sudo vim /etc/systemd/logind.conf
# Make the necessary changes
...
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=ignore
#HandleRebootKey=reboot
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
LidSwitchIgnoreInhibited=no
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
...