Tag Archives: Ethernet Cable

Connecting To a Raspberry Pi via an Ethernet Cable

You can use your Raspberry Pi or RBPi single board computer in different ways. Sometimes you may have a keyboard, mouse, and display to connect to your RBPi to use it as a regular computer. At other times, you may prefer to communicate with it through another computer such as a desktop or a laptop. Your method of communication may also vary. For example, if your RBPi is at a distance, you may have to connect to it over the Internet via Wi-Fi.

However, Wi-Fi may be an unreliable and a slow way of connecting to your RBPi if you are communicating with it often using SSH or a remote desktop application. Rather, a faster method would be to use a direct Ethernet connection, which would also be a lot more stable. Since you are connecting to your RBPi directly with an Ethernet cable, you are actually bypassing your local network and not sharing the bandwidth with other computers. Moreover, a direct Ethernet connection allows you to connect to your RBPi even when you are away from your home network, experiencing slow connectivity and or network time outs.

For this, all you need is an Ethernet cable. You will need to assign a static IP address to the Ethernet port of the RBPi. The static IP address will depend on the IP address of the computer and its Ethernet adapter that you will be using to connect to the RBPi. The process of assigning a static IP address is straightforward and should be easy for any OS.

If you are using a Windows computer to connect to your RBPi, open up the Network Connections window from the task bar or by accessing the Control Panel. Now look at the Properties of the Ethernet connection under Internet Protocol Version 4. This will show an IP address of the form 10.0.0.6 or similar.

In some cases, the internet connection may also be set for automatic assignment. Here, you need to connect your RBPi to the computer via an Ethernet cable first. Now access the Windows command prompt and use the ipconfig command to see the address your computer has automatically assigned to the connected RBPi. Next, you will also need to note the default gateway IP, which is the local IP address of your network router.

Apart from the above, you will also need to find out the IP addresses of the domain name servers used by your RBPi for finding websites on the Internet. This you can find out by executing the command cat /etc/resolv.conf on the command prompt of your RBPi.

Now you must edit the /etc/dhcpcd.conf file on your RBPi and modify the three IP addresses in the file. Change the last number of the IP address of your computer’s Ethernet adapter, to any other number between 0 and 255. This becomes the static IP address you will use to SSH or connect remotely to your RBPi.

The static router is the IP address of the default gateway IP you noted earlier and the static domain name servers are the IPs you noted from the /etc/resolv.conf. Save the dhcpcd.conf file and reboot your RBPi. Enjoy your connection.