can not find ip address of connected raspberry pi via nmap
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
can not find ip address of connected raspberry pi via nmap
hi, I have a raspberry pi which is connected to interenet with my phone (via hotspot)
I am sure the raspberry pi is connected because I see it in the connected device in my phone.
I wanted to find the ip address of my raspberry pi so I can ssh into it.
I used this command "nmap -sn 192.168.45.0/24" but I don't find the ip of my raspberry pi via this command.
I found this command by googling how to find the ip address of connected device.
For the command I used 192.168.45.0/24 because in my windows machine when I type ipconfig in cmd, I see in section wireless LAN adapter WiFi, there is IPv4 which is 192.168.45.202
So I thought I need to do nmap -sn 192.168.45.0/24 but I don't still get the ip of raspberry pi.
both my pc and raspberry pi are connected to my internet of phone.
If the question is not clear please let me know to improve it.
Perhaps your phone's tethering does not pass ping through? The -sn option is a ping scan and not a port scan. Since you are wish to connect to the Raspberry Pi, you might try a port scan on just the SSH port:
Code:
nmap -p 22 192.168.45.0/24
Or even if there is also a web server,
Code:
nmap -p 22,80,443 192.168.45.0/24
If you have HTTP and HTTPS up and running there, too.
Starting Nmap 7.80 ( https://nmap.org ) at 2024-05-04 17:06 CEST
Nmap scan report for 192.168.45.4
Host is up (0.0071s latency).
PORT STATE SERVICE
22/tcp closed ssh
Nmap scan report for 192.168.45.208
Host is up (0.072s latency).
PORT STATE SERVICE
22/tcp closed ssh
Nmap done: 256 IP addresses (2 hosts up) scanned in 6.63 seconds
the ip 192.168.45.208 correspond to the washing machine in my home.
For the ip 192.168.45.4 I don't know what device is it.
But I know if I write ipconfig in cmd in windows, I see this ip as default gateway.
I know nothing about the network and these stuff, I tried ssh 192.168.45.4 but I get this:
ssh: connect to host 192.168.45.4 port 22: Connection refused
I don't think it's the ip address of my raspberry pi.
Can you check the Raspberry Pi itself this first time and 1) verify that OpenSSH is up and running, 2) that there is no packet filter blocking incoming TCP port 22, and 3) that your Raspberry Pi is on the same subnet as your legacy OS?
Code:
systemctl status ssh
sudo nft list ruleset
ifconfig
You can set a "signature" block of your own for your account here by going to the menu "Edit Profile" and then the menu item there "Edit Signature".
the issue is that I can't use my raspberry pi, (I don't have monitor or screen)
I was using only ssh to use my raspberry pi but now the ssh is not working and I don't know how I can follow your instruction.
like you said to do
Code:
systemctl status ssh
sudo nft list ruleset
ifconfig
I need maybe to get a screen and connect it to my raspberry then I try the things you told me.
I need maybe to get a screen and connect it to my raspberry then I try the things you told me.
Yes, that is probably the next step, since it seem that the most likely reason for not showing up may be that it is either not connecting to the wi-fi or might not have OpenSSH-server running.
If you have a system which can read EXT4 file systems, a second approach might be to check the system files directly. But a far easier way is to connect the Raspberry Pi to a monitor or television long enough to ensure that it is connecting to the wi-fi and that OpenSSH-server is starting automatically using the raspi-config utility if necessary.
Out of curiosity, which method did you use to install the Raspberry Pi OS on the microSD card? Usually there is a step there to turn on SSH, but on some older versions of the rpi-imager utility there can be problems getting that to stick.
Last edited by Turbocapitalist; 05-04-2024 at 10:55 AM.
Reason: typo
well I used dietpi image from this link : https://dietpi.com/#downloadinfo
Then I used a software called Rufus, to burn the image into sd card.
Then after that I opend ssd directory in my windows, and inside the file "dietpi.txt" set IP address that I will use for ssh connection.
Then I put the sd card into raspberry pi and then after first boot I was able to ssh into it.
I used to ssh for some days then after a week, I suddenly see I can no longer ssh into it.
here is a video that I followed for installation of dietpi os into sd card for raspberry. https://www.youtube.com/watch?v=vlMpn9u0Y4o
Thanks. If it used to connect, then that raises new questions. Since that is the case I think that checking it at its own console is the way to go. For now that means attaching a monitor or television, and a keyboard.
(Though later if you go really advanced and if you have a serial-to-USB adapter to connect to the right GPIO pins, you can prepare the system to use a serial console.)
By the way, both the rpi-imager and the Raspberry Pi OS image can be found here:
I actually see when I unplug the raspberry pi on there is new device added and when I plug it off, that device is gone from the connected list in my phone.
that's why I say that I am sure the raspberry pi is connected to the interenet.
That's a good sign then. It is connecting to the LAN. However, it does look like OpenSSH-server is not running on the Raspberry Pi at the moment. As mentioned that would be the next thing to check once you can connect a screen to it.
If you normally unplug the Pi without shutdown the filesystem may of become read only which maybe why you can see it but not login. As suggested the easiest way to check would be to attach a monitor and keyboard. You could use your Windows omputer but need a live linux distribution to actually check it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.