For wheezy:

Edit file /etc/network/interfaces from:

interfaces

to:

Static ip

For jessie:

  1. Do not change /etc/network/interfaces.
  2. Change the content of /etc/dhcpcd.conf to the following:
		
 interface eth0
 static ip_address=192.168.1.40/24
 static routers=192.168.1.1
 static domain_name_servers=8.8.8.8 8.8.4.4