Install n2x-node Agent
The n2x-node
agent is an open-source app that runs on the devices or applications you want to connect to the n2x.io platform.
n2x-node
is available for a variety of Linux platforms, macOS and Windows.
Check out its GitHub repository for more details and information on support, contributing, etc.
Minimum Requirements
n2x-node
has the same minimum requirements as Go:
- Linux kernel version 2.6.23 or later
- Windows 7 or later
- FreeBSD 11.2 or later
- MacOS 10.11 El Capitan or later
Download Binaries
Linux, macOS and Windows binary downloads are available from the Releases page at the n2x-node GitHub Repository.
You can download the pre-compiled binaries and install them with the appropriate tools.
Linux Installation
The n2x.io platform provides a one-line command for the simplest and quickest way to install the n2x-node
agent in Linux. You'll find this command readily available when you add a new node through the n2x.io webUI.
-
Download the latest release.
curl -LO "https://dl.n2x.io/binaries/stable/latest/linux/amd64/n2x-node"
-
Validate the binary (optional).
Download the
n2x-node
checksum file:curl -LO "https://dl.n2x.io/binaries/stable/latest/linux/amd64/n2x-node_checksum.sha256"
Validate the
n2x-node
binary against the checksum file:sha256sum --check < n2x-node_checksum.sha256
If valid, the output must be:
n2x-node: OK
If the check fails, sha256 exits with nonzero status and prints output similar to:
n2x-node: FAILED sha256sum: WARNING: 1 computed checksum did NOT match
-
Install
n2x-node
and create its configuration file according to your needs.sudo install -o root -g root -m 0750 n2x-node /usr/local/bin/n2x-node sudo mkdir /etc/n2x sudo vim /etc/n2x/n2x-node.yml
Configuration Options
For detailed information and a complete list of configuration options, refer to the n2x-node configuration reference. These options allow you to customize your
n2x-node
agent for specific needs. -
Create the
n2x-node.service
for systemd.sudo cat << EOF > /etc/systemd/system/n2x-node.service [Unit] Description=n2x-node service Documentation=https://github.com/n2x-io/x-node After=network.target [Service] Type=simple # Another Type: forking # User= WorkingDirectory=/var/local/n2x ExecStart=/usr/local/bin/n2x-node start Restart=always # Other restart options: always, on-abort, etc # The install section is needed to use # 'systemctl enable' to start on boot # For a user service that you want to enable # and start automatically, use 'default.target' # For system level services, use 'multi-user.target' [Install] WantedBy=multi-user.target EOF
-
Ensure the
tun
kernel module is loaded.sudo modprobe tun
-
Start the
n2x-node
service.sudo systemctl daemon-reload sudo systemctl enable n2x-node sudo systemctl start n2x-node
-
Check
n2x-node
service status.sudo systemctl status n2x-node
n2x.io provides a package repository that contains both DEB and RPM downloads.
- Run the following to setup a new APT
sources.list
entry and installn2x-node
.
echo 'deb [trusted=yes] https://repo.n2x.io/apt/ /' | sudo tee /etc/apt/sources.list.d/n2x.list
sudo apt update
sudo apt install n2x-node
- Check
n2x-node
service status.
sudo systemctl status n2x-node
- Run the following to create a
n2x.repo
file and installn2x-node
.
cat <<EOF | sudo tee /etc/yum.repos.d/n2x.repo
[n2x]
name=n2x Repository - Stable
baseurl=https://repo.n2x.io/yum
enabled=1
gpgcheck=0
EOF
sudo yum install n2x-node
- Check
n2x-node
service status.
sudo systemctl status n2x-node
Automating Installation on Main Cloud Platforms
Let's explore how to automate the n2x-node
agent installation process on Linux VMs within main cloud environments.
Simplify the installation process for the n2x-node
agent on your Linux VMs within the AWS cloud environment:
-
Configure User Data: During VM creation within AWS, navigate to the
Advanced details
section and scroll down to locate theUser data
field. Here, paste the one-line installation command provided by n2x.io when you add a new node to your n2x.io platform. -
Launch VM: Once you've added the command, proceed with launching your virtual machine instance.
Monitoring Script Output
The script's output will be logged to the file
/var/log/cloud-init-output.log
on your newly created VM. You can access this log file to review the installation process and confirm successful deployment of then2x-node
agent.Additional Resources
For a deeper dive into AWS user data, refer to the official documentation.
Simplify the installation process for the n2x-node
agent on your Linux VMs within the Azure cloud environment:
-
Configure Custom Data: When creating a new VM in Azure, navigate to the
Advanced settings
section. Locate theCustom data
field and paste the one-line installation command provided by n2x.io when you add a new nodeto your n2x.io platform. -
Launch VM: After adding the command, proceed with launching your virtual machine instance.
Monitoring Script Output
The script's output will be logged to the file
/var/log/cloud-init-output.log
on your newly created VM. You can access this log file to review the installation process and confirm successful deployment of then2x-node
agent.Additional Resources
For a deeper dive into Azure custom data, refer to the official documentation.
Simplify the installation process for the n2x-node
agent on your Linux VMs within the Google Cloud Platform (GCP) environment:
-
Configure Startup Script: When creating a new VM in GCP, navigate to the
Advanced Options
section and then selectManagement
. Under theAutomation
section, locate the field forstartup scripts
and paste the one-line installation command provided by n2x.io when you add a new node to your n2x.io platform. -
Launch VM: Proceed with launching your virtual machine instance after adding the command.
Monitoring Script Output
To review the installation process and confirm successful deployment of the n2x-node agent, access the script's output on your VM using the following command:
sudo journalctl -u google-startup-scripts.service
Additional Resources
For a deeper understanding of GCP startup scripts, refer to the official documentation.
macOS Installation
The n2x.io platform provides a one-line command for the simplest and quickest way to install the n2x-node
agent in macOs. You'll find this command readily available when you add a new node through the n2x.io web interface.
-
Download the latest release.
curl -LO "https://dl.n2x.io/binaries/stable/latest/darwin/amd64/n2x-node"
curl -LO "https://dl.n2x.io/binaries/stable/latest/darwin/arm64/n2x-node"
-
Validate the binary (optional).
Download the n2x-node checksum file:
curl -LO "https://dl.n2x.io/binaries/stable/latest/darwin/amd64/n2x-node_checksum.sha256"
curl -LO "https://dl.n2x.io/binaries/stable/latest/darwin/arm64/n2x-node_checksum.sha256"
Validate the n2x-node binary against the checksum file:
shasum --algorithm 256 --check n2x-node_checksum.sha256
If valid, the output must be:
n2x-node: OK
If the check fails, sha256 exits with nonzero status and prints output similar to:
n2x-node: FAILED sha256sum: WARNING: 1 computed checksum did NOT match
-
Install
n2x-node
and create its configuration file according to your needs.chmod +x n2x-node sudo mkdir -p /usr/local/libexec sudo mv n2x-node /usr/local/libexec/n2x-node sudo chown root: /usr/local/libexec/n2x-node sudo mkdir /etc/n2x sudo vim /etc/n2x/n2x-node.yml sudo chmod 600 /etc/n2x/n2x-node.yml
Warning
In macOS,
agent.iface
must beutun[0-9]+
in then2x-node.yml
, beingutun5
usually a good choice for that setting. Use the commandifconfig -a
before launching then2x-node
service and check that the interface is not in-use.Configuration Options
For detailed information and a complete list of configuration options, refer to the n2x-node configuration reference. These options allow you to customize your
n2x-node
agent for specific needs. -
Install and start the n2x-node agent as a system service.
sudo /usr/local/libexec/n2x-node service-install
-
Check the service status.
launchctl print system/io.n2x.n2x-node
You should get an output like this:
system/io.n2x.n2x-node = { active count = 1 path = /Library/LaunchDaemons/io.n2x.n2x-node.plist state = running program = /usr/local/libexec/n2x-node arguments = { /usr/local/libexec/n2x-node service-start } working directory = /var/tmp stdout path = /usr/local/var/log/io.n2x.n2x-node.out.log stderr path = /usr/local/var/log/io.n2x.n2x-node.err.log default environment = { PATH => /usr/bin:/bin:/usr/sbin:/sbin } environment = { XPC_SERVICE_NAME => io.n2x.n2x-node } domain = system minimum runtime = 10 exit timeout = 5 runs = 1 pid = 3925 immediate reason = speculative forks = 28 execs = 1 initialized = 1 trampolined = 1 started suspended = 0 proxy started suspended = 0 last exit code = (never exited) spawn type = daemon (3) jetsam priority = 4 jetsam memory limit (active) = (unlimited) jetsam memory limit (inactive) = (unlimited) jetsamproperties category = daemon submitted job. ignore execute allowed jetsam thread limit = 32 cpumon = default properties = keepalive | runatload | inferred program }
Windows Installation
The n2x.io platform provides a one-line command for the simplest and quickest way to install the n2x-node
agent in Windows. You'll find this command readily available when you add a new node through the n2x.io web interface.
-
Open the Windows PowerShell as Administrator and create a folder for n2x.
mkdir 'C:\Program Files\n2x'
-
Download the latest release into the n2x folder.
curl -Uri "https://dl.n2x.io/binaries/stable/latest/windows/amd64/n2x-node.exe" -Outfile n2x-node.exe
-
Validate the binary (optional).
Download the n2x-node.exe checksum file:
curl -Uri "https://dl.n2x.io/binaries/stable/latest/windows/amd64/n2x-node.exe_checksum.sha256" -Outfile n2x-node.exe_checksum.sha256
Validate the
n2x-node.exe
binary against the checksum file:-
Using Command Prompt to manually compare CertUtil's output to the checksum file downloaded:
CertUtil -hashfile n2x-node.exe SHA256 type n2x-node.exe_checksum.sha256
-
Using PowerShell to automate the verification using the -eq operator to get a
True
orFalse
result:$($(CertUtil -hashfile .\n2x-node.exe SHA256)[1] -replace " ", "") -eq $(type .\n2x-node.exe_checksum.sha256).split(" ")[0]
-
-
Download the
wintun
driver from https://wintun.net. -
Unzip the wintun archive and copy the AMD64 binary
wintun.dll
toC:\Program Files\n2x
. -
Use an editor to create the n2x-node configuration file
C:\Program Files\n2x\n2x-node.yml
.Configuration Options
For detailed information and a complete list of configuration options, refer to the n2x-node configuration reference. These options allow you to customize your
n2x-node
agent for specific needs. -
Install the
n2x-node
agent as a Windows service.'C:\Program Files\n2x\n2x-node.exe' service-install
Info
The instructions below assume that the
wintun.dll
,n2x-node.exe
andn2x-node.yml
files are stored inC:\Program Files\n2x
. -
Start the
n2x-node
service.start-Service n2x-node
-
Check
n2x-node
service status.get-Service n2x-node
Running with Docker
You can also run the n2x-node
agent as a Docker container.
Registry:
ghcr.io/n2x-io/n2x-node
The n2x.io platform provides a one-line command for the simplest and quickest way to running the n2x-node
agent in Docker. You'll find this command readily available when you add a new node through the n2x.io web interface.
Example usage:
docker run -d --restart=always \
--net=host \
--cap-add=net_admin \
--device=/dev/net/tun \
--name n2x-node \
-v /etc/n2x:/etc/n2x:ro \
ghcr.io/n2x-io/n2x-node:latest start
Artifacts Verification
All artifacts are checksummed and the checksum file is signed with cosign.
-
Download the files you want and the
checksums.txt
,checksum.txt.pem
andchecksums.txt.sig
files from the Releases page: -
Verify the signature:
cosign verify-blob \ --cert checksums.txt.pem \ --signature checksums.txt.sig \ checksums.txt
-
If the signature is valid, you can then verify the SHA256 sums match with the downloaded binary:
sha256sum --ignore-missing -c checksums.txt
Our Docker images are signed with cosign.
Verify the signatures:
COSIGN_EXPERIMENTAL=1 cosign verify ghcr.io/n2x-io/n2x-node
Configuration
Once installed you can review the configuration at /etc/n2x/n2x-node.yml
.
Configuration Options
For detailed information and a complete list of configuration options, refer to the n2x-node configuration reference. These options allow you to customize your n2x-node
agent for specific needs.
Uninstall
To remove n2x-node
agent from the system, use the following commands:
sudo systemctl stop n2x-node
sudo systemctl disable n2x-node
sudo rm /etc/systemd/system/n2x-node.service
sudo systemctl daemon-reload
sudo rm /usr/local/bin/n2x-node
sudo rm /etc/n2x/n2x-node.yml
sudo rmdir /etc/n2x
sudo rm -rf /var/lib/n2x
sudo rm -rf /var/cache/n2x
sudo systemctl stop n2x-node
sudo apt-get -y remove n2x-node
sudo rm /etc/n2x/n2x-node.yml
sudo rmdir /etc/n2x
sudo rm -rf /var/lib/n2x
sudo rm -rf /var/cache/n2x
sudo systemctl stop n2x-node
sudo yum -y remove n2x-node
sudo rm /etc/n2x/n2x-node.yml
sudo rmdir /etc/n2x
sudo rm -rf /var/lib/n2x
sudo rm -rf /var/cache/n2x
To remove n2x-node
agent from the system, use the following commands:
sudo /usr/local/libexec/n2x-node service-uninstall
sudo rm /usr/local/libexec/n2x-node
sudo rm /etc/n2x/n2x-node.yml
sudo rmdir /etc/n2x
To remove n2x-node
agent from the system, open the Windows PowerShell as Administrator and use the following commands:
stop-Service "n2x-node"
'C:\Program Files\n2xn2x-node.exe` service-uninstall
rm 'C:\Program Files\n2x' -r -force