3

I've been using Google Cloud's IoT Core for some time and the need to SSH into devices as come up. Since we do BtoB it is mainly for support and debugging purposes. I was wandering if the service can provide me with the external IP of the device or anything that could help me establish a SSH connection.

Thanks in advance !

  • 1
    Probably won't be of much help, but no, you can't get the device ip from Google. What you can do is set up your devices to react to a command from IoT Core and open a reverse SSH to an IP. Of course, you need access to the device to add this so think about it for your next devices. – Luiz Ferraz Dec 03 '19 at 00:19
  • It is unlikely that your IoT devices will have public IP addresses. They should be behind a firewall and/or NAT type of devices. @LuizFerraz comment is very interesting and should work with the correct configuration for future deployments. – John Hanley Dec 03 '19 at 00:36
  • I'm a little surprised about "SSH" into the IoT device. My world of IoT is that the devices are a lot lower level than anything that could support SSH. This is why the IoT Core Configuration function was provided ... https://cloud.google.com/iot/docs/how-tos/config/configuring-devices The assumption is that configuration of a device will be done by the device itself when it receives a message asking it to do such. – Kolban Dec 03 '19 at 01:07
  • @Kolban - SSH is not too CPU or memory demanding. However, this really depends on the hardware and networking environment. With today's chips, this is easy to implement. I have built small-device ssh tunnels many times. For micro IoT devices with `bit-per-second` speeds, SSH would be useless. – John Hanley Dec 03 '19 at 02:20
  • LuizFerraz this is indeed what I might do. I realised that all of my devices will be behind an internet router and so a firewall / NAT. Kolban we are using a raspberry pi. The 'devices' or more like gateways than actual devices. I see where you're coming from however. – Charles Smith Dec 03 '19 at 21:11

1 Answers1

2

SSH into devices as come up

Device state is for storing the current status for your device. This could include the device IP among any other metadata that you would want shared between the device and the Cloud.

Assuming that you have access to the device and it's in your registry, you could store a state message that you can later retrieve for the device.

If you wanted to "trigger" retrieving the device state you could send a telemetry message - which creates a PubSub message - to then update any persistent store (e.g. Cloud SQL, BigQuery, etc) you're using to track online devices.

class
  • 8,621
  • 29
  • 30
  • While I agree with this, as mentionned in the initial comments this would not be useful if the device is behind a firewall. It would however be really useful when on premises and connected to the local network. I will check this as the accepted answer. Thank you. – Charles Smith Jan 10 '20 at 16:06