How to change Ubuntu Server from dynamic address (DHCP) to a static IP address?

You need to change addresses into following files:

  • /etc/network/interfaces
  • /etc/resolv.conf

The following article from www.howtogeek.com prefers vi editor, but I use nano editor.
sudo nano /etc/network/interfaces

change to something like this
iface eth0 inet static
     address 192.168.1.5
     netmask 255.255.255.0
     network 192.168.1.0
     broadcast 192.168.1.255
     gateway 192.168.1.1

and DNS settings
sudo nano /etc/resolv.conf
and then restart
sudo /etc/init.d/networking restart

If you have DHCP client enabled, you must disable it. Consult the following article for more details:

Ubuntu DHCP to a Static IP Address

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current ye@r *