[HowTo] Change Ubuntu IP Address from DHCP to Static

For those who are new to Ubuntu or Debian, the default setting of your network card is DHCP. And in some cases you want to use a static IP, maybe to bypass some filter or your DHCP server is not working properly and you cannot connect to the network unless your network administrator comes and fixes it. In that situation you really need to change your network configuration from DHCP to a static IP.

To change your network configuration from DHCP to static IP is not hard. You can follow these steps below:

1. Open your terminal client

2. Type this command:

sudo vim /etc/network/interfaces

3. Then you will see there are 2 network interfaces, lo and eth0. See example below:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

4. Change the eth0 one according to your network settings (you can call your network administrator and have them tell you the settings), see example below:

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

5. Save that file and close

6. Restart your network to apply the new settings, with this command:

/etc/init.d/networking restart

7. See your network configuration by typing:

ifconfig

That’s it. Thanks for reading this article. Please leave any comment if you have another tip or input.