3

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?

3
  • Do you have a switch or network between your pi & desktop? or are you just using a cable? If cable is your desktop acting as a DHCP server to give the pi an ip address? Have you set your pi up for static or dynamic ip? (step 4 on your list makes it sound like dynamic so a dhcp server is necessary). For step 5 have you enabled openssh-server on the pi to allow you to ssh in? What OS have you got on the pi (Ubuntu[-mate] 16.04 too? or other?)
    – guiverc
    Dec 2, 2017 at 12:53
  • I'm using an ethernet cable. The OS flashed on my pi is Raspbian (raspberrypi.org/downloads/raspbian). I just flashed the OS in an SD card, plugged it into my pi and connected to my laptop directly via cable. On Windows the IP detection works, but on Ubuntu I'm not able to figure out the ip address of my pi.
    – Satwik
    Dec 2, 2017 at 13:01
  • OK, I just looked it up, and the pi's ethernet port has auto crossover so you can directly connect between the PI and your PC, BUT you still need a DHCP server setup on the PC, and that's not something I would recommend if that PC is normally connected to a network itself. So the info we need to answer your question is: what does your home network look like? Is the PC connected via WiFi, or a different ethernet port?
    – user760856
    Dec 2, 2017 at 15:03

2 Answers 2

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.

0

When I connect two Raspberry Pi's together, I listen via tcpdump on the one connected to the monitor with the keyboard, etc. Usually, I can do: sudo tcpdump | grep 169.254. Eventually I will see the IP addresses of both cable connected computer printed in the terminal. I can then verify with ping IP dev2 which is the headless Pi. If I get ping results I now have the headless Pi's IP address.

$ sudo tcpdump | grep 169.254 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
19:51:50.844180 ARP, Request who-has 169.254.18.229 tell 0.0.0.0, length 46
19:51:52.298896 ARP, Request who-has 169.254.18.229 tell 0.0.0.0, length 46
19:51:54.041081 ARP, Request who-has 169.254.18.229 tell 0.0.0.0, length 46
19:51:56.064068 IP 169.254.18.229 > igmp.mcast.net: igmp v3 report, 1 group record(s)
19:51:56.132954 ARP, Request who-has 169.254.18.229 tell 169.254.18.229, length 46

It turns out the headless Pi is 169.254.18.229 and the other Pi is 169.254.144.13.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .