Ask / Submit
2

How can I get my phone's IP address without touching it?

asked 2017-05-12 15:33:44 +0300

Federico gravatar image

updated 2017-05-12 16:56:57 +0300

EDIT: I didn't explain myself clearly probably, so I'd better change my formulation completely.

I am sitting in front of my laptop. I'd like to access my Jolla via SSH. To do this, I have to type ssh nemo@??? (or something equivalent, like typing it in an input box). Problem: my phone's IP address changes depending on which network I am in. Some of these networks have DHCP, and some are workplace networks on which I have no admin access to the router. So I don't really know what to put instead of ???, unless I physically reach for my phone, find its IP (with ifconfig, or on the settings/developer mode page) and copy it onto my laptop by hand.

Is there a way to set things up so that I don't have to reach the phone to check this address? As far as I know Jolla does not support Zeroconf, which would be a solution.

edit retag flag offensive close delete

Comments

Am I right, that you actually want assign a fixed IPv4 to your Jolla?

hoschi ( 2017-05-12 15:48:54 +0300 )edit

@hoschi No - I want a way to figure out its IP (or something to replace ??? in ssh nemo@???) no matter which network it's connected to.

Federico ( 2017-05-12 16:10:05 +0300 )edit

@Federico i dont think my idea is a good solution, but if you want to learn a bit abit about scripting this would be a great fun little project. write a script that pings through the local ip address space and compare the mac with your jolla. additionally automatically set up the ssh connection after finding the jolla. im sure there many ways to do that. good and bad. but sounds super fun! :-)

misc11 ( 2017-05-12 17:11:21 +0300 )edit

I upvoted now your question, because the idea behind and the ARP (johanh) based solution are awesome! IP-Protocol, knowledge is power.

hoschi ( 2017-05-12 22:54:45 +0300 )edit

ssh nemo@Sailfish

Moo-Crumpus ( 2017-05-16 09:08:43 +0300 )edit

8 Answers

Sort by » oldest newest most voted
4

answered 2017-05-13 10:28:06 +0300

beeki gravatar image

DNS is the answer, either your dhcp-server should update your local dns somehow (jolla.local, jolla.home, jolla.office.example.com). Or your phone should update globaldns somehow, dyndns.com/someother.service or the real dynamic-dns.

There are also local autodiscovery stuff (mDNS) but that needs something also running on the client-side, and they might not work properly if the devices are on a different broadcast domains.

edit flag offensive delete publish link more

Comments

+1 for DNS (given that it is dynamically updated by the DHCP server). I gave my phone a more unique hostname and successfully use it both at home and at work.

luen ( 2017-05-16 01:14:44 +0300 )edit

DNS is ok, but won't help if connected to mobile networks using Restricted Cone NAT since incoming connections simply will not work. Therefore I run a TOR hidden service on my jolla and a TOR Socks Proxy an my laptop. With an ssh configuration like

Host jolla
    hostname myhiddenserviceaddress.onion
    User nemo
    proxyCommand socat - socks4a:127.0.0.1:%h:%p,socksport=9050

I can login to my Jolla with ssh jolla whenever it is somehow connected and has access to the TOR network.

Eierkopp ( 2017-05-21 15:50:37 +0300 )edit
3

answered 2017-05-12 17:27:46 +0300

johanh gravatar image

updated 2017-05-12 21:03:45 +0300

This assumes that your laptop and your Jolla is in the same subnetwork (broadcast area). Check the MAC address of your Jolla and write it down (on your laptop). On your laptop, ping the broadcast address in your network, e.g. "ping 192.168.1.255" (in windows, ping -b in linux) (or whatever your broadcast address is). This should populate your arp table with all addresses in the subnetwork. On linux show them with "arp" or on windows with "arp -a". You should see the MAC address of the Jolla associated with the current IP address in the list of addresses. This could easily be scripted to grep for the MAC address also.

Edit. Don't know why, but populating the arp table doesn't seem to work as easily in linux (in Windows it works). Maybe distro-specific? I had to install "arp-scan" and run "sudo arp-scan --localnet" to discover devices on the same LAN. Then I was able to see the Jolla MAC adress and IP.

Edit 2. In Linux, "sudo nmap -sn --send-ip 192.168.1.0/24" also works to discover devices in the same LAN and update the arp table.

edit flag offensive delete publish link more
2

answered 2017-05-12 19:16:18 +0300

eson gravatar image

Well, I know it's not optimal, but anyway useful...

apt-get install nmap
nmap -sP 192.168.1.0/24

Of course you should use your actual lan interval.

edit flag offensive delete publish link more

Comments

I'd do exact this. Recent versions of nmap should show the manufacturer according to its internal MAC address database. Otherwise, just take note of your Jolla's MAC address to find it in the list.

As for Zeroconf: Jolla of course does this when using IPv6 and radvd. Hey, it's running Linux! :)

Venty ( 2017-05-13 12:54:08 +0300 )edit

@Venty You're right. I have Nmap 7.01 and manufacturer is shown. You just need to run above command as su.

eson ( 2017-05-13 14:56:04 +0300 )edit
1

answered 2017-05-12 16:29:19 +0300

lakutalo gravatar image

updated 2017-05-19 17:02:34 +0300

What about the app IP Address from Jolla Store created by @rainisto? It shows your address right on the screen of your phone.

Another way would be to set up your DHCP server on your router at home to assign a fixed IP address for the mac address of your Jolla. And sometimes you may succeed by typing nemo@Jolla.local if your router is smart enough.

Third alternative is to use mac address instead of IP, like in this example. Works ostensibly alright if you're on a linux box ( if you change the mac address to yours ):

ssh nemo@`for ((i=100; i<=110; i++));do arp -a 192.168.1.$i; done | grep 00:35:cf:56:b2:2g | awk '{print $2}' | sed -e 's/(//' -e 's/)//'`

Either way, you will have to touch your phone sooner or later. ;)

edit flag offensive delete publish link more

Comments

Sorry, I have edited the question -- this is not what I was looking for (still requires accessing the phone physically and copying information from it). The second solution would be OK, if only it didn't require support from the network.

Federico ( 2017-05-12 16:32:23 +0300 )edit
1

answered 2017-05-12 16:55:32 +0300

Giacomo Di Giacomo gravatar image

If you have access to your router management interface, check attached devices and try to make up which one is your phone (e. g. from its MAC address).

edit flag offensive delete publish link more
1

answered 2017-05-13 05:36:41 +0300

mlwane gravatar image

updated 2017-05-13 05:42:00 +0300

I believe what you're looking for is avahi (zeroconf). This is an implementation of mDNS which resolves the hostname to an IP address in a network, you can then access the device with something like "nemo@hostname.local".

Have a look at the following question.

edit flag offensive delete publish link more
0

answered 2017-05-12 16:18:37 +0300

tom.i gravatar image

On Linux system there is hosntame -I which shows you IP adress, unfortunatelly, this doesn't work on Jolla, because there is older hostname version.

So you should probably use ifconfig or ip addr show and grep inet or inet addr:

So it should look like this:

ifconfig | grep inet

or

ip addr show | grep inet

And then you have to parse it via sed or awk or so.

edit flag offensive delete publish link more

Comments

Thanks, but this is not what I was looking for -- I have edited the question to explain myself more clearly now.

Federico ( 2017-05-12 16:28:13 +0300 )edit

So you want to use actual IP address which you're using with your laptop too?

tom.i ( 2017-05-12 16:35:47 +0300 )edit

@tom.i Not sure what you mean... I want to get my Jolla's IP address remotely, so that I can ssh into it without having to reach for it physically to copy its address. Essentially I need a sort of dynamic DNS or static address that works on each network.

Federico ( 2017-05-12 16:39:25 +0300 )edit

@Federico - and are you connected via your laptop to that network you want to be reachable via Jolla phone too? So you want to sshish to it from laptop to phone and use actual network you're connected with laptop?

You've written, that you're sitting in front of your laptop and you want to connect to your phone, so I think that laptop know IP range of your connected network. Than you should use nmap for this. e.g. nmap -sn 192.168.0.0/16 for searching Jolla phone domain name in the result from your laptop

tom.i ( 2017-05-12 16:45:37 +0300 )edit
0

answered 2017-05-19 14:41:07 +0300

eatdirt gravatar image

You can use "ddclient", on openrepos, and a Dns provider. dyndns, changeip etc... provide free dns names.

cheers.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2017-05-12 15:33:44 +0300

Seen: 755 times

Last updated: May 19