Configure eth0 to not use DHCP

By default the Raspberry Pi uses DHCP to configure its network interfaces, including, on the model B, the built-in ethernet port. If you want to change this so the ethernet port has a static IP address, here's how.

DHCP for eth0 is enabled in the file /etc/network/interfaces. Here is what it looks like by default on a Raspberry Pi under the official version of Raspbian:

The above example assigns the address 192.168.1.1 to eth0 with a subnet mask of 255.255.255.0, and sets the default gateway to 192.168.1.254.

Edit the file /etc/network/interfaces with the nano utility like this:

sudo nano /etc/network/interfaces

The second thing you need to do is check that you have a valid DNS server listed in /etc/resolv.conf. Edit this file using nano and add your DNS server if it is not already there. If you are using a broadband router, add the address of your router as the DNS server.