3

I tried to find all machines which are connected my modem. I tried 192.168.x.0/24 command on gnome-terminal but it couldn't find any. My brother's laptop and my mobile phone are already connected the modem but this command couldn't find them.

Here is the output :

root@tugrul:/home/tugrul# nmap -sP 192.168.1.0/24
Starting Nmap 6.40 ( http://nmap.org ) at 2015-09-22 01:40 EEST
Nmap scan report for 192.168.1.1
Host is up (0.0050s latency).
MAC Address: xx:xx:xx:xx:xx:xx (Shenzhen Zowee Technology Co.)
Nmap scan report for 192.168.x.x
Host is up.
Nmap done: 256 IP addresses (2 hosts up) scanned in 3.40 seconds

I also tried nmap -sn 192.168.6.0/24 but there was no difference:

$ nmap -sn 192.168.6.0/24
Nmap scan report for 192.168.1.1
Host is up (0.0043s latency).
MAC Address:  (Shenzhen Zowee Technology Co.)
Nmap scan report for 192.168.1.15
Host is up.
Nmap done: 256 IP addresses (2 hosts up) scanned in 3.06 seconds

How can I do that ?

m.tuğrul
  • 31
  • 1
  • 2
  • 8
  • [Please don't use version tags (e.g. `14.04`) unless your issue is only relevant to one version of Ubuntu.](http://meta.askubuntu.com/q/7245/85695) – terdon Sep 21 '15 at 22:54
  • That's strange. The command you show should have worked. Are you sure the other devices are on the same network? Is their IP address `192.168.1.XX`? – terdon Sep 21 '15 at 22:55
  • Yes, the other devices are connected same modem in my room. But command couldn't find. I'm triying last 2 ours. – m.tuğrul Sep 21 '15 at 22:57
  • Use `sudo` before the `nmap` command as TCP SYN packets are sent to only ports 80 and 443 when `nmap -sP` is run as unprivileged user.. – heemayl Sep 21 '15 at 23:00
  • I wanna ask one thing, when I start working on terminal, I do sudo su and I work as root. I'm new on Linux. Is not it same? – m.tuğrul Sep 21 '15 at 23:02
  • @heemayl that might be worth posting as an answer. – terdon Sep 21 '15 at 23:05
  • @terdon it seems OP is already working as `root`.. – heemayl Sep 21 '15 at 23:08
  • @heemayl ah, yes, I missed that. Still strange though, `nmap -sP 192.168.1.0/24` shows all machines on my network. m.tuğrul could you show us the IPs of the machines you can't find? Don't worry, sharing *internal* IPs (e.g. 192.168.1.10) [is completely safe](http://askubuntu.com/q/435261/85695). – terdon Sep 21 '15 at 23:11
  • yes I am already working as a root. I wrote sudo su and I started to work as root – m.tuğrul Sep 21 '15 at 23:13
  • I addition to what @terdon has asked for could you please run it as `nmap -sn 192.168.6.0/24` as `root` of course..just want to check as `-sP` is deprecated in favor of `-sn`.. – heemayl Sep 21 '15 at 23:14
  • Will I share screenshot @terdon? – m.tuğrul Sep 21 '15 at 23:15
  • @m.tuğrul no, just copy the text from the terminal and paste it into your answer. I still suspect that these machines are not on the same network somehow, so please also show i) your **internal** IP and ii) the **internal** IP of one of the devices. – terdon Sep 21 '15 at 23:16
  • I paste the output as you said – m.tuğrul Sep 21 '15 at 23:19
  • I already paste output of process as an ansver and I checked devices. Devices is already connected my modem. – m.tuğrul Sep 21 '15 at 23:30
  • Thanks (I added it to your question instead) but you still haven't told us the IP you are trying to find. As I said, there is no danger in sharing internal IPs (they are only accessible from inside your network) and it would help us be sure that you're running the right command. – terdon Sep 21 '15 at 23:33
  • 192.168.1.2 my brothers machine ip. I know I know but I forgot sharing the ip which I want to find. – m.tuğrul Sep 21 '15 at 23:38
  • Add the output of `ifconfig` for both systems, also, what OS your brother use? – Braiam Sep 22 '15 at 15:54
  • my brother use Windows 7, I'm out of city for 5 days. I didn't bring my computer with me, it stayed at home. – m.tuğrul Sep 22 '15 at 16:14
  • Doesn't work doesn't work I'll be crazy doesn't work. Now 5 machines are connected my modem but I can't find ip address of them on my ubuntu.Please help me. – m.tuğrul Sep 27 '15 at 19:13
  • hi guys, I found ip adresses on my local network. I wan't ask you one more things. How to connect to other machine via network ports? Is that possible? I know software development (Java). – m.tuğrul Oct 03 '15 at 10:44

3 Answers3

2

try arp-scan. install it by sudo apt install arp-scan:

sudo arp-scan -l

  • Doesn't exists other way? I'll try your solution but Can't we do that without tools? – m.tuğrul Sep 21 '15 at 22:55
  • you'll probably need to run *something*. I'm not sure what you mean with "tools" though. –  Sep 21 '15 at 22:58
  • Is arp-scan a tool like nmap developed by some guy or I understand wrong this? – m.tuğrul Sep 21 '15 at 23:00
  • every piece of software is developed by "some guy" afaik. –  Sep 21 '15 at 23:07
  • thank you for your interest, I tried but it doesn't find other devices. I checked the other devices, they are connected but I couldn't find with arp-scan or my way. Thank you again – m.tuğrul Sep 21 '15 at 23:10
2

Use netdiscover

netdiscover -i <interface>

If you're trying to find the devices in the wifi network, the command would be

netdiscover -i wlan0
Root
  • 106
  • 5
0

Your command should have worked. It does on my system anyway, as does arp-scan as suggested by Adonis. If, however, you don't want to install any tools, you could use a brute approach and just ping everything:

for i in 192.168.1.{1..100}; do 
    ping -w 1 -c 1 $i >/dev/null && echo "$i is up"; 
done

The command above will ping every IP between 192.168.1.1 and 192.168.1.100. If a host is pingable (if it is connected), it will print the host's name.

However, this will be slow and cumbersome and is not really a good solution. Use arp-scan or nmap as you did instead.

Pang
  • 371
  • 1
  • 5
  • 12
terdon
  • 98,183
  • 15
  • 197
  • 293
  • Thank you for your interest, all of you. Why isn't my command working on my network but working on yours? It made me crazy. – m.tuğrul Sep 21 '15 at 23:04