Change Ubuntu System from DHCP to a Static IP Address
open the /etc/network/interfaces file.
sudo vi /etc/network/interfaces
If you are using DHCP for your primary network card which is usually eth0, you will see the following lines
iface eth0 inet dhcp
As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should add and here is the example and you can change these settings according to your network settings.
iface eth0 inet static
Restart the neworking service using the following command
sudo /etc/init.d/networking restart