Staex logostaexDocs
Docs/Quick Start: Two Nodes

Quick Start: Two Nodes

Connect two machines through encrypted Staex tunnels and access services across nodes.

Prerequisites#

You need two machines (physical or virtual), each running Debian or Ubuntu Linux with:

  • An active internet connection
  • UDP traffic allowed through the firewall

Install MCC on Both Nodes#

Run the following installation commands on each machine:

bash
curl -o /tmp/staex-repo.noarch.deb https://packages.staex.io/linux/deb/staex-repo.noarch.deb
sudo apt-get install /tmp/staex-repo.noarch.deb
sudo apt-get update
sudo apt-get install mcc

Then initialize MCC with the public network and start the service on both nodes:

bash
sudo mcc init --parents public.staex.io <NETWORK-CERTIFICATE-BASE64>
sudo systemctl enable --now mcc

Get Node IDs#

On each machine, retrieve the unique node identifier:

bash
mcc id

Record both node IDs. You will need the remote node's ID when creating tunnels.

Deploy a Service on Node 2#

Start a demo service on Node 2 (the server side). For example, launch an nginx container:

bash
docker run --rm -d -p 8080:80 --name mcc-demo-service nginx

This exposes a basic web server on port 8080 of Node 2.

Create Tunnels#

On Node 2 (the server), create a tunnel that exposes the local service to Node 1:

bash
sudo mcc create-tunnel --targets tcp:8080 --name my-service1 --remote-node <NODE_1_ID>

Replace with the node ID you retrieved from Node 1.

Access the Service#

From Node 1, resolve the tunnel name and access the service running on Node 2:

bash
mcc resolve my-service1
curl http://my-service1.staex:8080

The request is routed through the encrypted MCC tunnel. Node 2's real IP address is never exposed.

Explore Further#

With both nodes connected you can explore additional capabilities:

  • Use dig commands against the MCC DNS service to resolve tunnel names and node addresses
  • Run mcc nodes to list all visible nodes in the network
  • Create additional tunnels to remote devices and services using the same create-tunnel workflow