In this page we are discussing about how to set static ip in ubuntu 18.04.
At first we want to know how many network interfaces are available in our server, for this execute the command .
Then the output like:
To configure a static IP address on your Ubuntu 18.04 server you need to modify a relevant netplan network configuration file within
/etc/netplan/ directory.Then you can see the file
Open the file using vi or other editers.
Then to set your network interface enp0s8 to static IP address give ip address ,gateway and dns servers.
Once all are done ,then execute the command:
sudo netplan apply
In case you run into some issues execute:
sudo netplan --debug apply
Now you set static ip to your server. You can confirm it by executing the command ipconfig -a.