3

I don't have a monitor which accepts HDMI, so my only way to log into my Raspberry Pi is through ssh on another machine. To do that, however, I first have to retrieve my Raspberry Pi's IP on my local network. The problem is that my Raspberry Pi doesn't show up when I scan all listening devices. I tried with nmap and then ssh to all shown connected devices, but none let me log in as user pi with password raspberry. I connected to my router website, which should contain a list of all devices which are currently connected, but, still, the raspberry pi is not in it.

I have a Raspberry Pi 2B. I tried installing the latest Raspberry OS from scratch, both the full version and the light one. I reduced the raspberry pi installation to power supply, SD card and Ethernet cable. I checked the light pins: the PWR one lights continuously, and the ACT one turns on and off with a high frequency for the first ten-twenty seconds, and then switches completely off. According to the documentation and various forums, it's quite normal behavior for a Raspberry Pi which succeeded booting. Of course, the Ethernet lights are on and the cable works fine with other computers. I finally looked for possible issues in booting, crawling on forums for problem symptoms that matched my case. But found none, my Raspberry Pi seems to work normally, except that I can't connect to it.

Last time I used it (few years ago), it worked like a charm.

Would it be possible that, by default, it doesn't connect to the local network (which would be weird for a debian-like distro such a Raspberry OS, but you never know...)? If so, how can I force it to do so?

EDIT: Some clarifications needed I think:

  • I put a file called ssh within the boot partition (I already did this in the past, so I know the procedure);
  • my router ip management is a standard DHCP, and it refuses static IP;
  • I have full access over all the devices connected to it, checked them all and the pi is not in there;
  • I already tried to nmap my whole subnetwork (without success);
  • finally, I only have Linux systems.

I'll try to connect my raspberry pi directly to an other computer an simulate a DHCP server, to see how it reacts.

7
  • you could use a free MQTT broker to publish your IP .... have a look here shiftr.io/shiftr-io/try ..... you can use a private connection (click on Explore to see how other people have set up their connections) .... you would be publishing a private IP, so it is not a security risk ... if you are worried anyway, then publish only the last octet of the IP and encrypt it in some way .... for example, an IP 192.168.1.34 could be published as 843467
    – jsotola
    Nov 6, 2020 at 18:17
  • I'm sorry but I don't really see how is that related to solving my issue. I already know what my IP is, and it's not what I'm looking for. I'm looking for the one of my raspberry pi, and I don't need to publish it, I need to know it... Finally, I don't really understand the idea behind publishing and encrypted version of my private IP. Either no one can decipher it, and it was no purpose, or someone can decipher it, and it still was no purpose encrypting it...
    – jthulhu
    Nov 6, 2020 at 19:21
  • the RPi publishes its IP ... your PC subscribes to the MQTT topic to retrieve the IP .. i did say if you are worried anyway, then encrypt it
    – jsotola
    Nov 6, 2020 at 20:08
  • 1
    did you create a ssh in the boot partition? Is using a fixed IP address an option for you? Does dullaart.website/raspberry/1_headless_setup.html (my personal experiences) help you? Nov 6, 2020 at 22:38
  • @LjmDullaart yes ssh, no fixed ip. Nice tutorials btw, however I don't want static IP (and my raspberry doens't have WiFi). Besides that, I basically did what you did, except for making vi my default editor (emacs rules).
    – jthulhu
    Nov 7, 2020 at 18:36

4 Answers 4

6

You already reduced the setup to a minimum to locate the error. That's what I would suggest. But there is still your network environment involved. You can try to use a wired direct device to device connection.

A fresh flashed raspios_lite_armhf will work out of the box with a wired connection. It either request an ip address from a DHCP server, or if not available, it uses a Link-local address with an ip address from the subnet 169.254.0.0/16 and multicast DNS (mDNS). If you have a PC/Laptop with a Linux operating system and link local addressing with mDNS configured you should be able to connect to the RasPi with name raspberrypi.local, for example:

laptop ~$ ping raspberrypi.local

or if ssh enabled

laptop ~$ ssh [email protected]

nmap should always find the ip address.

If it works then you know that the problem is your network environment. If it doesn't work then the configuration of the PC/Laptop is wrong or the hardware of the RasPi is broken.

2
  • raspberrypi.local doesn't seem to be working. nmap is the very first tool I tried in order to find out my raspberry ip, but it didn't work out (eg. I tried sshing every found device, but none worked). Btw what happens if there are multiple PIs in the local network? Who claims the raspberrypi.local address?
    – jthulhu
    Nov 6, 2020 at 21:12
  • @BlackBeans With my testing there is no local network. I suggested to direct connect a PC to the RasPi with only one ethernet cable and without any switch or router; one end plugged into the PC the other end plugged into the RasPi. If the connection doesn't work then the possible errors I have described in the last paragraph of my answer. The network name is given by the device name with .local appended when using mDNS. If you have multiple devices named raspberrypi then you have the same network name raspberrypi.local with different ip addresses. The network name is not unique.
    – Ingo
    Nov 6, 2020 at 22:18
4

There are a number of problems that can cause your Pi to be not-recognized.

I will dispense with the hardware connectivity; I assume you that works.

If you do not know the Pi's address, and you have a DHCP server (often as part of you (A)DSL router or cable modem), you can check what new address is being handed-out. Pi's are normally B8:27:EB, DC:A6:32 or E4:5F:01 in my experience.

If you cannot find it in your DHCP server, and you have a relatively small subnet, you may try to do a ping-sweep (nmap -sP 10.128.0.0/20; provide your own network) over it. First ping-sweep with the pi disconnected, and then with the pi connected. the diff of those two should give you the IP address.

If the Pi cannot get an IP address (for example, because you do not use DHCP on your network), it will use APIPA (Automatic Private IP Addressing). It will give it an address in the 169.254.0.0/16 network. If that is the case, you may want to put a temporary second IP address on your computer to access the Pi and do a long sweep over the APIPA network/

ifconfig eth0:0 169.244.0.1 netmask 255.255.0.0 up
nmap -sP 169.254.0.0/16

If you don't have a DHCP server, and the APIPA-range sweep does not provide the desired result, you should (at least temporarily) create a DHCP server.

Normally, you should now have the IP address of the Pi.

It should be pingable.

But, if you did not create a ssh file on the boot partition, ssh will not be accessible.

1

When making the image from scratch, don't forget to enable ssh by creating a file named ssh on the SD before you put it in the pi. While you are at it, add a line to cmdline.txt that says

ip=192.168.1.12

or similar. ( IP must be within the proper subnet.)

When in a similar situation with other devices that don't have static ip capabilities, sometimes I just connect the pi/device directly to my computer with an ethernet cable and run the dhcp server on the computer. Most modern network adapters won't even need a crossover cable.

For Windows, I use DHCP Server for Windows. Note that you may need to assign your computer a static IP in the appropriate subnet for this particular Windows software to work properly.

1

Problem solved! The issue was my ethernet cable: even though all LEDs were on, and even though it worked on other computers, changing it made it work. I have no real ideas on why the Raspberry Pi didn't accept it, but still didn't complain about it...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.