Edit file /etc/network/interfaces from:
to:
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