-1

The problem

I'm developing an IOT device that will connect to a common Wifi router. As you know in order to make this device publicly accessible from WAN you'll have to do some ports forwarding or DMZ in the router. But in this scenario I don't want to touch the router. So I have to figure out a way to keep this device accessible from WAN.


My solution

On boot I make the device to call an http server running node.js + socket.io, I can keep a TCP connection alive and have my server as a gateway from WAN to the device:

enter image description here

Could be this the only solution? Can achieve this is a smartest/easiest way without having to touch the router?

3
  • The best solution is to use IPv6 such that your connectivity isn't broken by NAT. But because it is still possible to come across networks which haven't been updated to support IPv6 yet, you will need a fallback method for those. What you describe is a usable fallback on many networks. The more layers of NAT, the less reliable it will be. If users try to use it through NAT4444 on networks with zero IPv6 support and they can't get it to work, then you'll probably have to tell those users to fix their network.
    – kasperd
    Aug 18, 2015 at 22:01
  • Keepalives of some sort are really the only solution to IPv4 NAT, but they do have implications for battery life in wireless devices. You have to send them frequently enough that the gateway doesn't forget your connection, but not so frequently that you drain the battery. Make sure your device supports IPv6. Aug 18, 2015 at 22:20
  • While IPv6 will solve the problem with NAT most routers implement a stateful firewall and only allow connection establishment from inside the network. If this is the case even IPv6 will not help because the router will reject the connection attempt from outside. To work around this you again need to establish the connection from inside and keep it open, like you do with IPv4. Aug 19, 2015 at 2:35

1 Answer 1

1

I recommend looking at MQTT. It does exactly what you require and is quickly becoming a defacto standard for IoT style implementations. Its also now an OASIS standard as well.

2
  • The problem is that MQTT is design in a way that the publisher is the IOT device (like a sensor) and the subscriber is a user (on a computer for example). In my case the IOT device is the subscriber and the publisher is the user. Do you know any examples of an implementation of MQTT in this way?
    – DomingoSL
    Aug 18, 2015 at 20:33
  • If you are developing the IoT device then you can implement the MQTT client so that is is able to subscribe to topics as well if you want it to receive information. Aug 18, 2015 at 20:51

Not the answer you're looking for? Browse other questions tagged .