I need to reset my computer's ip address to dhcp from static

Solution 1:

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.

sudo gedit /etc/network/interfaces

You will see this:

auto eth0
   iface eth0 inet static
   address 10.0.0.100
   netmask 255.255.255.0
   network 10.0.0.1
   broadcast 10.0.0.255
   gateway 46.185.128.91

Replace it with:

auto eth0
   iface eth0 inet dhcp

Then restart networking components.

sudo /etc/init.d/networking restart

Solution 2:

You didn't really specify what version of Ubuntu you're running (especially since you said you've been running it for a few years), so I'll just assume you've been upgrading regularly and we're talking Ubuntu 12.04 here.

You need to modify the /etc/network/interfaces file...

$ sudo gedit /etc/network/interfaces

...with the following (assuming your network interface is eth0... change the values as appropriate to your own situation):

auto eth0
iface eth0 inet dhcp

Before saving the file, make sure there are no other references to that interface (in this case, "eth0") anywhere (there shouldn't be). But if you'd set up static manually in the past, you might see something like this:

iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1

If you don't see that block, you may want to just give that a shot and see if your interface comes up with a DHCP-assigned IP address when you restart networking (sudo /etc/init.d/networking restart).

Whatever you decide (DHCP or static), you'll need to restart networking after editing that file:

$ sudo /etc/init.d/networking restart

If you set a static IP, however, you also need to make sure that the other information that you would normally receive via DHCP is correct as well. This includes your DNS information (such as nameservers). Edit the /etc/resolv.conf file:

$ sudo gedit /etc/resolv.conf

This file includes your nameservers (you may also include a domain to search, but not necessary). It's usually just your router, but you may be using something else entirely (I'll give you OpenDNS here, just because I know it works):

nameserver 208.67.220.220
nameserver 208.67.222.222

If you don't have any nameservers specified, then you won't be able to use domain names for Internet access (i.e., "ping google.com").

You can test DNS by performing a simple lookup:

$ nslookup google.com

You should get something back that includes something like:

...
Name:    google.com
Address: 74.125.227.100
...

If that works, then you're all set!