Getting spark core ip address

im building a project here, and it needs to be connected on the internet however multiple spark core are needed. how can i get the spark cores unique ip addresses in order for me to register each of them uniquely?

Hi @paolosofio01,

If you’re looking to get the IP address of the core on your local network, you can ask the core for it’s IP using something like this:

https://community.spark.io/t/network-localip-to-string-to-get-it-via-spark-variable/2581

If you want your core’s public IP address that’s a little trickier, but there are lots of ways to accomplish it, does that help or do you need the public IP?

Thanks,
David

im sorry im a little bit confused, whats the difference of public ip address to local? thanks for the reply!

Public is the IP address which you can reach from the outside via internet.

Local IP is the IP address assigned to each device on your home network. They can talk to each other LOCALLY but in order to reach them EXTERNALLY, you will need your public IP which is assigned by your ISP :wink:

eg. 192.168.1.10 is your core Local IP. When you ping 192.168.1.10 from your friend’s computer, you will not be able to reach it.

However, if you have a proper setup of your router, pinging 201.10.120.34 which is your Public IP will allow your to reach your core from outside. :wink:

1 Like

what ip address do i need to make a computer or a server listen or detect the location of the core?

I’m not a networking expert but i know you can either check your public IP in your router settings or simply visit http://www.whatsmyip.org/

Let’s see what the rest say about reaching multiple cores with the same public IP :wink:

no what i mean is that, lets say i have four spark cores and i want it to have a unique ip address each. at the same time i will also create a program, desktop application (.exe) with google maps or any map for the main reason is to detect or locate its current location. all of them will go under one internet provider only. will i use public ip address to detect or will i use the local ip?

  • main thing is i need to detect the current location of each spark core.

thank you for your response and time kenneth and dave!

@paolosofio01, I think you are going about this the wrong way. A unique IP is not possible because your router assigns a LOCAL IP, not an internet IP. Your router’s IP is assigned by your service provider’s servers which is your “public” IP. It can change unless you have paid for a “static” non-changing IP. To find the “location” of a Core, you are really finding the location of the router since it has the public IP.

So, because you cannot assign a unique public IP to your core, you can query http://www.realip.info/api/p/realip.php, parse the simple JSON-formatted public IP that it returns and Spark.publish() that IP and your core name/ID to the cloud. Then, your server can subscribe to those events, grab the IP/name and to a lookup on the IP to get an approximate location.

2 Likes

Hi @paolosofio01,

One way to find the core’s location would be to write a program that scanned for nearby wifi networks, and reported that list to a WiFi geolocation service like https://location.services.mozilla.com/ . I started building a library people could use for this, but I haven’t had time to work on it recently, it’s very close. Maybe I should just release it as is and maybe people would hack on it / use it as a starting point?

Thanks,
David

3 Likes

hi @Dave

is there a way where i can contact you directly? im a little bit confused in using the spark core, tho im really excited to use this its still new to me. im currently working on a project for a school and i want to explain it further, there so much i wanna talk things. btw im from the phillipines and im developing a project in one university. so can you help me out to understand things one by one? i’ll appreciate it very much! thanks!

Hi @paolosofio01,

You can ping me on the forums by using my handle @Dave and I usually try to answer those within 24 hours or less when I can. You can also private message me by clicking on my username. :slight_smile:

The forums here and the documentation are a great place to learn and ask questions, so I wouldn’t limit yourself to just talking to me :smiley: – there are a ton of really smart and helpful people here.

We also sometimes hang out on IRC Freenode channel #spark, and we just had a getting started hangout yesterday, and will hopefully do another one soon – https://community.spark.io/t/noobie-run-into-a-wall-getting-started-basic-questions-about-spark-closed/5206

Thanks!
David

im developing a security device with the use of (4) spark core also im creating a executable program that has a live map on it, in which the main purpose is to locate the current location of the spark.

  • its just university wide
  • under one wi-fi server
  • whenever one registered spark devices is connected to university wifi it will automatically locate is location

Question

  1. how am i gonna able to find the location of the spark, im planning that with the use of its ip address and gps if im right?
  2. how can i program the desktop application for it to listen the registered spark devices (to be unique within each other)
  3. am i going to use static maps to locate the ip address of the spark devices?
  4. is there something missing in my concept?

thanks guys!

I would use the :spark:'s name or DeviceID instead of relying on IP addresses.

Every core has a unique DeviceID, and you get to name every core when you claim it.

Both these identifiers are unique and work regardless of what network the :spark: uses to connect to the internet.

@paolosofio01, the concept of tracking the approximate location of an ip only works based on public IPs and not internal IPs as assigned by your University’s internal network. You will not be able to locate a Core based on its IP unless the following is satisfied:

  • Different wireless access points on Campus assign IPs within a fixed group of IPs (eg. 10.8.x.x). Typically, large networks are divided into subnets, each having unique IPs withing those subnets. This is not uncommon for large networks since the University can control all internal IPs as it wishes since they are on on the public internet.

  • Those IP ranges are geographically (on Campus at least) discernible (eg. by building or faculty)

  • There is no “firewalling” between IP subnets otherwise your server may not be able to see the entire network.

  • If the above is not possible, then another possibility is each wireless access point has a unique SSID which can be assigned a geographical location.

Without these conditions, a unique IP/SSID that can be roughly traced to a location on campus will not be possible.

i think all of those scenarios are satisfied by the university. now what will i do to make the core connect with its unique ip address in the university network?

-also i need to program the core that with a push of a button it will automatically connect with the university network and send or echo a signal message to the desktop application that traces the cores location.

thanks @peekay123

@paolosofio01, assuming those conditions ARE being satisfied then you need to test if the Core can connect to the University wireless network. Often these networks required domain type credentials (username/password) to connect. The Core does not support this type of authentication. Have you got a Core connected on the University network already?

1 Like

we already got an approval for the university that the cores will be on exception, thus they are requiring us to give them the ip address or credentials of the cores. sounds like that the cores will be registered not as a student that has limited bandwidth.

1 Like

@paolosofio01, that seems odd because the IP is variable but he MAC address is unique to each Core. Also, the Core has no “credentials”. Can you clarify?

1 Like

im saying that the ip addresses of the cores will be under the exception that they will not need to enter (username/password) its like the cores are automatically connected to the university network.

im saying that they want to get the network credentials of each core so that they will place it under exception.

could it be that the university is providing you a set of static IP addresses that are exempt from bandwidth throttling.

the issue would be that if you gave the university the IP address once the core is connected, there is a good chance it will change the next time you turn it on, because im sure the university is using DHCP.
http://www.thegeekstuff.com/2013/03/dhcp-basics/

i would recommend giving your university the MAC addresses of the spark cores. they will then be able to make DHCP reservations for your spark cores so they always get the exempt IP’s and eliminate bandwidth throttle.

2 Likes