How to Give Your IIoT Device a Public URL with Tunnelmole

How to Give Your IIoT Device a Public URL with Tunnelmole

Connecting your Industrial IoT (IIoT) devices to the internet is fundamental to unlocking their value. Whether you’re monitoring sensor data from a factory floor, managing a fleet of …


This content originally appeared on DEV Community and was authored by Robbie Cahill

How to Give Your IIoT Device a Public URL with Tunnelmole

Connecting your Industrial IoT (IIoT) devices to the internet is fundamental to unlocking their value. Whether you're monitoring sensor data from a factory floor, managing a fleet of remote assets, or integrating with cloud analytics platforms, you need a reliable way to communicate with your hardware. However, a significant hurdle stands in the way: these devices are often tucked away on local networks, behind firewalls and NAT, making them inaccessible from the public internet.

Traditionally, solving this problem involved complex and often insecure solutions like static IPs, port forwarding, or setting up VPNs. These methods require deep networking knowledge, can be a security risk if not configured perfectly, and are difficult to scale.

This is where Tunnelmole comes in. This guide will show you how to use Tunnelmole, a simple and open-source tunneling tool, to instantly give your IIoT device a secure, public URL. You'll be able to access your device's web interface, receive webhooks, and integrate with cloud services in minutes, without any complex network configuration.

We will walk through a practical example using a Raspberry Pi, a popular choice for IIoT projects, but the principles apply to any IIoT device capable of running a web server.

What is IIoT?

The Industrial Internet of Things (IIoT) refers to the network of interconnected sensors, instruments, and other devices connected with industrial computer applications, including manufacturing and energy management. This connectivity allows for data collection, exchange, and analysis, potentially facilitating improvements in productivity and efficiency as well as other economic benefits.

Unlike consumer IoT (like smart home devices), IIoT focuses on instrumentation and control in industries such as manufacturing, oil and gas, utilities, and transportation. The stakes are higher, with a strong emphasis on reliability, security, and scalability.

Common IIoT use cases include:

  • Predictive Maintenance: Analyzing sensor data (vibration, temperature) to predict equipment failure before it happens.
  • Remote Monitoring & Control: Managing and monitoring assets in remote or hazardous locations from a central control room.
  • Supply Chain Optimization: Tracking goods and assets in real-time across the supply chain.
  • Smart Metering: Automating the collection of consumption data for utilities like water, gas, and electricity.

A common thread in all these applications is the need for data to flow from the device to a central server, cloud platform, or operator's dashboard. This is why having a public endpoint is so critical.

Why a Public URL is Crucial for Your IIoT Device

A public URL acts as a stable, accessible front door to your IIoT device. Without one, your device is an isolated island of data. With one, it becomes a fully-fledged participant in your digital ecosystem.

Here’s why a public URL is a game-changer for IIoT development and operations:

  1. Remote Monitoring and Dashboards: You can build or connect to web-based dashboards (like Grafana, Tableau, or custom-built ones) to visualize real-time sensor data from anywhere in the world. This is essential for operational awareness and data-driven decision-making.

  2. Webhook Integration: Modern cloud services and automation platforms (like AWS IoT, Azure IoT Hub, IFTTT, Zapier) use webhooks to push real-time notifications. For example, a cloud-based rules engine could send a webhook to your device to trigger an action, like turning on a fan when a temperature threshold is exceeded. Your device needs a public URL to receive these incoming HTTP requests.

  3. Remote Configuration and Management: Need to update a setting, restart a process, or pull a log file from a device deployed in the field? A public URL connected to a simple web interface allows you to perform these management tasks remotely through a browser, without needing physical access or complex SSH tunneling setups.

  4. Rapid Prototyping and Demos: When developing an IIoT application, you can instantly share a live demo of your device's web interface with colleagues or clients by simply sharing the Tunnelmole URL. No need to deploy to a public cloud or set up a staging server.

The Challenge: Why Your IIoT Device Isn't Publicly Accessible

Most IIoT devices are deployed on private local area networks (LANs). They get a private IP address (like 192.168.1.100) from the local router. This router uses Network Address Translation (NAT) to manage traffic between the local network and the public internet.

This setup is great for security and for conserving public IP addresses, but it means incoming requests from the internet don't know how to find your specific device among the many others on the same network. Your device is effectively invisible to the outside world.

To overcome this, you might consider:

  • Port Forwarding: Manually configuring the router to forward incoming traffic on a specific port to your device's private IP. This can be a security risk, is difficult to manage at scale, and is often impossible on networks you don't control (like cellular or corporate networks).
  • VPNs (Virtual Private Networks): Creating a secure network between your device and a central server. This is a robust solution but can be complex and costly to set up and maintain, especially for large fleets of devices.
  • Dynamic DNS: A service that maps a domain name to a changing (dynamic) IP address. This helps but doesn't solve the core problem of getting through the firewall and NAT.

These solutions are often overkill, insecure, or too complex for the simple goal of exposing a single web service.

Introducing Tunnelmole: Your Instant Public URL

Tunnelmole simplifies this entire process. It works by creating a secure "tunnel" from your IIoT device to the public Tunnelmole service.

Here’s how it works at a high level:

  1. You run the Tunnelmole client (tmole) on your IIoT device.
  2. tmole establishes a persistent, outbound connection to a public Tunnelmole server. Since the connection is outbound, it easily passes through firewalls and NAT without any special configuration.
  3. The Tunnelmole server generates a unique public URL (e.g., https-some-random-id.tunnelmole.net) and assigns it to your tunnel.
  4. When a request comes in to your public URL, the Tunnelmole server sends it down the secure tunnel to the tmole client on your device.
  5. The tmole client forwards the request to the local web service running on your device (e.g., a Python Flask or Node.js Express app on localhost:8080).

The entire process is reversed for the response. This creates a seamless bridge between the public internet and your local device, almost as if you were able to run a public server on any device.

Step-by-Step Guide: Getting a Public URL for Your IIoT Device

Let's walk through a practical example. We'll use a Raspberry Pi to simulate an IIoT device. Our goal is to run a simple web server on the Pi that displays sensor data and make it accessible via a public Tunnelmole URL.

Prerequisites

  • An IIoT device like a Raspberry Pi, BeagleBone, or any Linux-based single-board computer.
  • The device must be connected to the internet.
  • You must have shell (SSH or direct) access to the device.
  • Node.js and npm installed on the device. Most Linux distributions can install this with sudo apt-get install nodejs npm.

Step 1: Create a Simple IIoT Web Server

First, let's create a basic web application on our device that serves some data. We'll use Python with the Flask framework because it's lightweight and easy to set up.

  1. Install Flask:

    pip3 install Flask
    
  2. Create the application file:
    Create a file named app.py.

    nano app.py
    
  3. Add the code:
    This simple app will have one endpoint that returns some mock sensor data in JSON format. In a real-world scenario, this function would read data from a connected sensor.

    from flask import Flask, jsonify
    import random
    
    app = Flask(__name__)
    
    def read_temperature_sensor():
        # In a real application, you would read this from a hardware sensor.
        # Here, we'll just generate a random value.
        return round(20.0 + random.uniform(-2.0, 2.0), 2)
    
    @app.route('/')
    def home():
        return "<h1>IIoT Device is Online</h1><p>Visit /data to see sensor readings.</p>"
    
    @app.route('/data')
    def get_data():
        temp = read_temperature_sensor()
    
        sensor_data = {
            'deviceId': 'PI-001',
            'timestamp': __import__('datetime').datetime.now().isoformat(),
            'sensors': [
                {
                    'type': 'temperature',
                    'value': temp,
                    'unit': 'Celsius'
                }
            ]
        }
        return jsonify(sensor_data)
    
    if __name__ == '__main__':
        # Listen on all network interfaces on port 5000
        app.run(host='0.0.0.0', port=5000)
    
  4. Run the server:

    python3 app.py
    

    You should see an output indicating the server is running on http://0.0.0.0:5000. It is now listening for connections on port 5000.

Step 2: Install Tunnelmole

Now, we'll install Tunnelmole on the same device. Tunnelmole is a native NodeJS application.

There are a few ways to install Tunnelmole. If you have NodeJS installed, the easiest is with npm.

sudo npm install -g tunnelmole

Alternatively, you can use the install script which works for most Linux distributions and Mac.

curl -O https://install.tunnelmole.com/xD345/install && sudo bash install

Step 3: Get Your Public URL

With your web server running on port 5000, open a new terminal window (or use a tool like screen or tmux to run it in the background) and run the following command:

tmole 5000

Tunnelmole will start, connect to the service, and display your public URLs.

$ tmole 5000
Your Tunnelmole Public URLs are below and are accessible internet wide. Always use HTTPs for the best security

https://krcy2t-ip-1-2-3-4.tunnelmole.net ⟶ http://localhost:5000
http://krcy2t-ip-1-2-3-4.tunnelmole.net ⟶ http://localhost:5000

And that's it! Your IIoT device now has a live, public HTTPS URL.

Step 4: Access Your Device Remotely

Now, take the https:// URL provided by Tunnelmole and open it in a web browser on your phone or computer. You should see the "IIoT Device is Online" message.

Next, navigate to the /data endpoint by appending it to your URL (e.g., https://krcy2t-ip-1-2-3-4.tunnelmole.net/data). You will see the JSON output with the latest sensor reading. Every time you refresh the page, the tmole client on your Pi will forward the request to your Python app, which will return a new random temperature.

Key Tunnelmole Features for IIoT Projects

Feature Description Benefit for IIoT
Open Source Both the client and server are fully open source (MIT and AGPL licenses). You can inspect the code to ensure it meets your security standards. Trust and Security: Full transparency into how your data is being handled. No black boxes.
Self-Hostable You can optionally host the Tunnelmole server on your own infrastructure for maximum control and security, or use the tunnelmole provided service (default) Data Sovereignty: Keep all traffic within your own network, which can be a requirement for sensitive industrial data.
Free Public URLs The default managed service provides free, randomly generated URLs without needing an account. Low Barrier to Entry: Get started with prototyping and testing immediately at no cost.
Custom Subdomains The paid or self-hosted service allows you to use a persistent, easy-to-remember subdomain (e.g., my-factory.tunnelmole.net). Stability: Essential for production systems where you need a stable endpoint for cloud services or dashboards.
Native Node.js The client is a lightweight Node.js application, which is compatible with a wide range of devices, including Raspberry Pi. Wide Compatibility: Runs on almost any device where you can install Node.js.

Conclusion: Bridging the Gap in Industrial IoT

The Industrial IoT holds immense promise for transforming industries, but its potential is often locked away by networking complexities. Simple, secure, and reliable connectivity is the key that unlocks this potential.

By providing an instant public URL, Tunnelmole empowers engineers and developers to bridge the gap between their devices in the field and the cloud services that drive value. It eliminates the need for insecure port forwarding or complex VPNs, allowing you to focus on what truly matters: building innovative IIoT applications.

Whether you are prototyping a new sensor system, deploying a remote monitoring dashboard, or integrating with a cloud-based machine learning platform, Tunnelmole provides the connectivity you need to get the job done quickly and securely.

Ready to connect your devices? Get started with Tunnelmole today.


This content originally appeared on DEV Community and was authored by Robbie Cahill


Print Share Comment Cite Upload Translate Updates
APA

Robbie Cahill | Sciencx (2025-07-12T01:49:16+00:00) How to Give Your IIoT Device a Public URL with Tunnelmole. Retrieved from https://www.scien.cx/2025/07/12/how-to-give-your-iiot-device-a-public-url-with-tunnelmole/

MLA
" » How to Give Your IIoT Device a Public URL with Tunnelmole." Robbie Cahill | Sciencx - Saturday July 12, 2025, https://www.scien.cx/2025/07/12/how-to-give-your-iiot-device-a-public-url-with-tunnelmole/
HARVARD
Robbie Cahill | Sciencx Saturday July 12, 2025 » How to Give Your IIoT Device a Public URL with Tunnelmole., viewed ,<https://www.scien.cx/2025/07/12/how-to-give-your-iiot-device-a-public-url-with-tunnelmole/>
VANCOUVER
Robbie Cahill | Sciencx - » How to Give Your IIoT Device a Public URL with Tunnelmole. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/07/12/how-to-give-your-iiot-device-a-public-url-with-tunnelmole/
CHICAGO
" » How to Give Your IIoT Device a Public URL with Tunnelmole." Robbie Cahill | Sciencx - Accessed . https://www.scien.cx/2025/07/12/how-to-give-your-iiot-device-a-public-url-with-tunnelmole/
IEEE
" » How to Give Your IIoT Device a Public URL with Tunnelmole." Robbie Cahill | Sciencx [Online]. Available: https://www.scien.cx/2025/07/12/how-to-give-your-iiot-device-a-public-url-with-tunnelmole/. [Accessed: ]
rf:citation
» How to Give Your IIoT Device a Public URL with Tunnelmole | Robbie Cahill | Sciencx | https://www.scien.cx/2025/07/12/how-to-give-your-iiot-device-a-public-url-with-tunnelmole/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.