Configure eth0 on Raspberry Pi

Connecting my RasPi to my home LAN, was quite easy. Although, the no. of ways I could connect them together are many,  I decided to go the old-school way. Simply connect the Ethernet port of my Router and RasPi , via a straight through cable and get started. My router had already been assigned an IP address, i.e.

The next thing I had to do was configure the eth0 interface on my RasPi and assign it a static IP.

These are the steps I followed:

    1. Open the network interfaces file:
      sudo vi /etc/network/interfaces
    2. In there, replaced the following lines:
      auto eth0 
      iface eth0 inet dhcp
      with this:
      auto eth0
      iface eth0 inet static


    3. Then opened resolv.conf file:    sudo vi /etc/resolv.conf
    4. In the file, removed all lines and typed in only this line:
      Where, is my gateway, which would help me to connect my RasPi on LAN, with internet.
      Save the file and exit the file editor.
    5. Now in terminal, restart the network interfaces:
      sudo networking restart
    6. Then ping my gateway:
      If it pings, then, ethernet interface is ready to use, else you  should reboot RasPi and retry pinging again.