This project is about connecting to your Pi with Ethernet. Suppose you have no access to Wi-Fi but you need to connect to Pi, then this project will help you in that peak moment. So, let's get started.
Step 1Install Raspbian on a SD card with at least 8 GB. Now create a blank file called SSH with no extension.
Step 2Now eject the SD card and plug it into your Raspberry Pi and connect a 5v power supply to Raspberry Pi.
Step 3Now take a Ethernet cable and connect it to Pi and PC.
In your PC, right click on the Windows logo and select Command prompt.
In command prompt, type in the following command:
ipconfig
Step 6Now it shows Windows IP Configuration. In that scroll down to find Ethernet adapter Ethernet. In that section find IPv4 Address and note it down.
Now install a software called Advanced IP scanner and run it. In it enter the IP address you noted and add a hyphen ( - ) and enter the same IP address but replace 1 with 254 in end of IP.
Ex: Suppose your IP is 192.168.137.1 then enter as
192.168.137.1 - 192.168.137.254
Now click on Scan on Top-left. It shows IP address of your PC and Pi. Note down the IP address of the Pi.
(Hostname of my Pi is Suprabath. so, it shows Suprabath.mshome.net)
(For you it shows Raspberrypi.mshome.net.)
Step 9Now this is the IP address of your Pi. Now connect to Pi from PC by PuTTY.
Now we need assign a Static IP address to the Pi. Now in command line enter the following command:-
route -ne
Step 11Now it shows Kernel IP routing table. In that find Gateway of eth0 and note it down.
(In my case it is 192.168.137.1)
(This is mostly the IP address of your PC.)
Step 12Now we need to edit a file called dhcpcd.conf by the following command:-
sudo nano /etc/dhcpcd.conf
Step 13In that file, scroll down to bottom and paste the following code:-
interface eth0
static ip_address=192.168.137.5
static routers=192.168.137.1
static domain_name_servers=192.168.137.1
In this code,
static ip_address is the IP you want to assign to your Pi. (my case 192.168.137.5)
static routers is the gateway of the Ethernet connection. (my case 192.168.137.1)
static domain_name_servers is also the gateway of Ethernet connection.
Step 14Now save the file by ctrl+x and y and hit Enter. Now reboot your Pi by the following command:
sudo reboot
Step 15Now after use the IP you assigned to Pi to access it via Ethernet.
(my case 192.168.137.5)
Now we have reached to the end of the project.
Thank you!
Comments