How to ssh into raspberry pi via ethernet

I've been trying to connect my headless raspberry pi to my Ubuntu 16.04 via the ethernet cable since a week, but have not been able to get the IP address of the connected raspberry pi.

I've tried tools like nmap but nothing shows up in the result. My Ubuntu desktop detects when the ethernet cable is plugged into pi but is not able to establish an Automatic Ethernet connection. I've also tried to creating a static ethernet connection (by manually assigning IP address of the form 192.168.43.x), but that doesn't work as well because I guess the raspberry pi is not assigned the address set in the static ethernet configuration.

Here are the steps that I've followed:

  1. Power up the Raspberry pi.
  2. Connect it to my ubuntu desktop via ethernet cable.
  3. My system tries to detect it, but fails on Auto Ethernet. However, statically configured ethernet connection works.
  4. Then I try to figure out the IP address of the raspberry pi, using nmap or other tools.
  5. Finally, if I'm able to successfully discover the IP address of connecte raspberry pi, ssh into the pi.

I've read several guides on the internet, but I can't complete the step 4 successfully. Can someone please help me out?


Solution 1:

By default, the pi is configured to pick-up an IP address via a DHCP server. So somewhere in the network there has to be a DHCP server running. If you're trying to connect the two devices directly via a single ethernet cable, then your network IS the single cable, which means that you need to install a DHCP server on the laptop end. I would not recommend this, because if your laptop is normally connected to another network, then the DHCP server would need to be specifically configured to listen ONLY on the ethernet port that you plan to use to connect with.

If your PC[laptop] is normally connected to a network, then is there some reason that you can't just connect your pi to that same network?

Without more info, I'm assuming your PC is connected to your network via WiFi (which is why you have an open Ethernet port that you think you can just use to connect the pi to?). If you are using WiFi, then more than likely that WiFi router also has LAN ethernet ports (usually blue in color). Just plug your pi directly into the router via a standard ethernet cable. The WiFi router will then provide the pi with an IP address via DHCP.

Now at this point, you might get lucky, and your router is setup to do local hostname resolution; so from your laptop, open an SSH client, and in the hostname/IP address box just type: raspberrypi and try to connect.

If that works, great, if not, then you'll need to login to your router to determine what IP address was assigned to the pi.

This is usually done via web interface, so just point your browser to: http://192.168.1.1 [if that doesn't work, then you'll need to know the IP address for your default gateway, and use that instead. Most of the time it's: 192.168.1.1, 192.168.0.1, or 10.0.0.1]

When you do so, you'll get prompted for a username/password from the router. If you've never done this before, that info is usually printed on the router itself. Once you're logged in, then look for something like "connected devices". That should give you a list of device names and the IP address each has been assigned. Look for raspberrypi, and write down the IP address, then use that on your laptop to connect to the pi.

If you provide the make/model of your router, I can give you more detailed instructions.