I assume this is an ordinary server, behind a router or switch that then connects to the internet. I'd rename the 50-cloud-init.yaml file:
sudo mv /etc/netplan/50-cloud-init.yaml /etc/netplan/01-netcfg.yaml
Then find out the relevant interface name:
ifconfig
Assuming, for an example, that your relevant interface is enp0s25, edit the file:
sudo nano /etc/netplan/01-netcfg.yaml
Amend the file to read:
network:
version: 2
renderer: networkd
ethernets:
enp0s25:
addresses: [192.168.100.40/22]
gateway4: 192.168.100.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
Of course, substitute your exact details here. Spacing, indentation, etc. are crucial. Proofread carefully. Save (Ctrl+O followed by Enter) and close (Ctrl+X) the text editor.
Next:
sudo netplan apply
sudo ip link set enp0s25 down
sudo ip link set enp0s25 up
Did you get the requested IP address?
ip addr show
Can you ping?
ping -c3 8.8.8.8
ping -c3 www.ubuntu.com
If you get ping returns, you are all set.
network-configgenerates50-cloud-init.cfg. andcloud-init( http://cloudinit.readthedocs.io/en/latest/ ) triggersnetwork-config( http://cloudinit.readthedocs.io/en/latest/topics/network-config.html ). That happens on initial creation, and on restarting but only when your force it. – Rinzwind May 23 '18 at 14:0050-cloud-init.cfg-- I have50-curtin-networking.cfgand50-cloud-init-yaml. Did you mean the former? If so, how exactly do you "force" cloud-init to regenerate50-cloud-init.yamlfrom50-curtin-networking.cfg? – kartik_subbarao May 23 '18 at 15:18