How to add IP-based devices to network?
Often you want to add an IoT device that speaks IPv4 to your VPN but you can not install VPN on this device. One example of such device is IP camera.
Staex offers tunnels feature that helps solve this problem. Currently this is Linux-only feature.
To connect an IoT device to one of your regular Staex nodes use the following command.
mcc create-tunnel --remote-node NODEID --targets tcp:80 --external-ip-address x.x.x.x
Here x.x.x.x
is IPv4 address of the IoT device,
NODEID
is the node id of the client endpoint
and tcp:80
is the protocol and port specification.
The command creates necessary configuration files under /etc/mcc/tunnels
directory.
The tunnel is activated without the need to restart mcc
.
systemctl restart mcc
Now you can verify that the server and client endpoints appeared in the routing table.
mcc nodes
NODE_ID ADDRESS LAST_SEEN PARENT TAGS TYPE
3zb3xe4gh757dnhdsyrzxxv6efvpgkzg82m08a8w88a5sf48w7x0 x.x.x.x 4cc9pkyvvj6accsnc3ac79wy7zstw25cra7ka596tc3a8sg7k5ag server-endpoint
pvyts5x5rmtv9wkbzvvcr0vbwkmcqqpc7v6b51qc605vcy01b3yg 4cc9pkyvvj6accsnc3ac79wy7zstw25cra7ka596tc3a8sg7k5ag client-endpoint
4cc9pkyvvj6accsnc3ac79wy7zstw25cra7ka596tc3a8sg7k5ag y.y.y.y:9376 2023-10-17T10:48:34.485+0200 kd2npmmtvp6p02v7yhgqjdpg58xs9v2sw19k2a8skz4vbdqq1f50
kd2npmmtvp6p02v7yhgqjdpg58xs9v2sw19k2a8skz4vbdqq1f50 y.y.y.y:9376 2023-10-17T10:48:34.485+0200
Here 3zb3xe4gh757dnhdsyrzxxv6efvpgkzg82m08a8w88a5sf48w7x0
is the
node id
of your IoT device.
You can use this id with any command in place of DNS name from any other node in Staex network.
ping 3zb3xe4gh757dnhdsyrzxxv6efvpgkzg82m08a8w88a5sf48w7x0