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. 192.168.137.1
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:
- Open the network interfaces file:
sudo vi /etc/network/interfaces
- In there, replaced the following lines:
iface eth0 inet dhcp
iface eth0 inet static
- Then opened resolv.conf file:
sudo vi /etc/resolv.conf
- In the file, removed all lines and typed in only this line:
Where, 184.108.40.206 is my gateway, which would help me to connect my RasPi on LAN, with internet.
Save the file and exit the file editor.
- Now in terminal, restart the network interfaces:
sudo networking restart
- Then ping my gateway:
If it pings, then, ethernet interface is ready to use, else you should reboot RasPi and retry pinging again.