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:
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 mccThen initialize MCC with the public network and start the service on both nodes:
sudo mcc init --parents public.staex.io <NETWORK-CERTIFICATE-BASE64>
sudo systemctl enable --now mccGet Node IDs#
On each machine, retrieve the unique node identifier:
mcc idRecord 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:
docker run --rm -d -p 8080:80 --name mcc-demo-service nginxThis 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:
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:
mcc resolve my-service1
curl http://my-service1.staex:8080The 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
digcommands against the MCC DNS service to resolve tunnel names and node addresses - Run
mcc nodesto list all visible nodes in the network - Create additional tunnels to remote devices and services using the same
create-tunnelworkflow