back home

DHCP to a Static IP Address Ubuntu

March 9, 2014

Changing DHCP without a GUI will require some effort, but thatโ€™s classic linux, right?

Ok, lets do it !
First, open interface file using your fav editor. I’m going to use nano.

$ sudo nano /etc/networking/interfaces

at opened file, change with the following lines:

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
    dns-nameservers 8.8.8.8 8.8.4.4 #dns google

Then edit file resolv.conf

$ sudo nano /etc/resolv.conf

and type this value (I use dns google)

nameserver 8.8.8.8
nameserver 8.8.4.4

Now, delete dhcp-client service with command:

$ sudo apt-get remove dhcp-client

And restart NIC

$ sudo /etc/init.d/networking restart